@awayjs/scene
Version:
AwayJS scene classes
61 lines (60 loc) • 2.2 kB
JavaScript
import { AbstractMethodError } from '@awayjs/core';
import { HierarchicalProperty } from '@awayjs/view';
var ControllerBase = /** @class */ (function () {
function ControllerBase(targetObject) {
if (targetObject === void 0) { targetObject = null; }
this._pAutoUpdate = true;
this.targetObject = targetObject;
}
ControllerBase.prototype.pNotifyUpdate = function () {
if (this._pTargetObject)
this._pTargetObject._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
};
Object.defineProperty(ControllerBase.prototype, "targetObject", {
get: function () {
return this._pTargetObject;
},
set: function (val) {
if (this._pTargetObject == val)
return;
if (this._pTargetObject && this._pAutoUpdate)
this._pTargetObject._iController = null;
this._pTargetObject = val;
if (this._pTargetObject && this._pAutoUpdate)
this._pTargetObject._iController = this;
this.pNotifyUpdate();
},
enumerable: false,
configurable: true
});
Object.defineProperty(ControllerBase.prototype, "autoUpdate", {
get: function () {
return this._pAutoUpdate;
},
set: function (val) {
if (this._pAutoUpdate == val)
return;
this._pAutoUpdate = val;
if (this._pTargetObject) {
if (this._pAutoUpdate)
this._pTargetObject._iController = this;
else
this._pTargetObject._iController = null;
}
},
enumerable: false,
configurable: true
});
ControllerBase.prototype.update = function (interpolate) {
if (interpolate === void 0) { interpolate = true; }
throw new AbstractMethodError();
};
ControllerBase.prototype.updateController = function () {
if (this._pControllerDirty && this._pAutoUpdate) {
this._pControllerDirty = false;
this.pNotifyUpdate();
}
};
return ControllerBase;
}());
export { ControllerBase };