@awayjs/view
Version:
View for AwayJS
90 lines (89 loc) • 3.37 kB
JavaScript
import { __extends } from "tslib";
import { EventDispatcher, UUID } from '@awayjs/core';
import { PickEntity } from './base/PickEntity';
import { RaycastPicker } from './pick/RaycastPicker';
import { BoundsPicker } from './pick/BoundsPicker';
import { TabPicker } from './pick/TabPicker';
/**
* @class away.pool.PickGroup
*/
var PickGroup = /** @class */ (function (_super) {
__extends(PickGroup, _super);
/**
* //TODO
*
* @param materialClassGL
*/
function PickGroup() {
var _this = _super.call(this) || this;
_this.id = UUID.Next();
_this._raycastPickerPool = new RaycastPickerPool(_this);
_this._boundsPickerPool = new BoundsPickerPool(_this);
_this._tabPickerPool = PickGroup._tabPickerPool || (PickGroup._tabPickerPool = new TabPickerPool());
return _this;
}
PickGroup.getInstance = function () {
return PickGroup._instance || (PickGroup._instance = new PickGroup());
};
PickGroup.prototype.requestAbstraction = function (asset) {
return PickGroup._store.length ? PickGroup._store.pop() : new PickEntity();
};
PickGroup.prototype.storeAbstraction = function (abstraction) {
PickGroup._store.push(abstraction);
};
PickGroup.prototype.getRaycastPicker = function (node) {
return node.getAbstraction(this._raycastPickerPool);
};
PickGroup.prototype.getBoundsPicker = function (node) {
return node.getAbstraction(this._boundsPickerPool);
};
PickGroup.prototype.getTabPicker = function (node) {
return node.getAbstraction(this._tabPickerPool);
};
PickGroup._store = [];
return PickGroup;
}(EventDispatcher));
export { PickGroup };
var RaycastPickerPool = /** @class */ (function () {
function RaycastPickerPool(pickGroup) {
this.id = UUID.Next();
this.pickGroup = pickGroup;
}
RaycastPickerPool.prototype.requestAbstraction = function (assetClass) {
return RaycastPickerPool._store.length ? RaycastPickerPool._store.pop() : new RaycastPicker();
};
RaycastPickerPool.prototype.storeAbstraction = function (abstraction) {
RaycastPickerPool._store.push(abstraction);
};
RaycastPickerPool._store = [];
return RaycastPickerPool;
}());
export { RaycastPickerPool };
var BoundsPickerPool = /** @class */ (function () {
function BoundsPickerPool(pickGroup) {
this.id = UUID.Next();
this.pickGroup = pickGroup;
}
BoundsPickerPool.prototype.requestAbstraction = function (assetClass) {
return BoundsPickerPool._store.length ? BoundsPickerPool._store.pop() : new BoundsPicker();
};
BoundsPickerPool.prototype.storeAbstraction = function (abstraction) {
BoundsPickerPool._store.push(abstraction);
};
BoundsPickerPool._store = [];
return BoundsPickerPool;
}());
export { BoundsPickerPool };
var TabPickerPool = /** @class */ (function () {
function TabPickerPool() {
this.id = UUID.Next();
}
TabPickerPool.prototype.requestAbstraction = function (assetClass) {
return TabPickerPool._store.length ? TabPickerPool._store.pop() : new TabPicker();
};
TabPickerPool.prototype.storeAbstraction = function (abstraction) {
TabPickerPool._store.push(abstraction);
};
TabPickerPool._store = [];
return TabPickerPool;
}());