convex-pixel
Version:
The library for creating pseudo 3d interactive scenes based on webgl
47 lines • 1.99 kB
JavaScript
import { __extends } from "tslib";
import * as PIXI from "pixi.js";
import { CameraControllerEventTypes } from "./events/event-types";
var CameraControllerManager = /** @class */ (function (_super) {
__extends(CameraControllerManager, _super);
function CameraControllerManager(_camera) {
var _this = _super.call(this) || this;
_this._camera = _camera;
_this._controllers = [];
_this._handlerControllerMove = function (target) {
_this.emit(CameraControllerEventTypes.MOVE, target);
};
_this._handlerControllerPOV = function (target) {
_this.emit(CameraControllerEventTypes.POV, target);
};
_this._handlerControllerZoom = function (zoom) {
_this.emit(CameraControllerEventTypes.ZOOM, zoom);
};
_this._handlerControllerRotate = function (rotation) {
_this.emit(CameraControllerEventTypes.ROTATE, rotation);
};
return _this;
}
CameraControllerManager.prototype.add = function (controller) {
this._controllers.push(controller);
controller.camera = this._camera;
controller.onMove = this._handlerControllerMove;
controller.onPOV = this._handlerControllerPOV;
controller.onZoom = this._handlerControllerZoom;
controller.onRotate = this._handlerControllerRotate;
};
CameraControllerManager.prototype.removeAll = function () {
while (this._controllers.length > 0) {
var controller = this._controllers.pop();
if (controller) {
controller.destroy();
}
}
};
CameraControllerManager.prototype.destroy = function () {
this.removeAll();
_super.prototype.removeAllListeners.call(this);
};
return CameraControllerManager;
}(PIXI.utils.EventEmitter));
export { CameraControllerManager };
//# sourceMappingURL=camera-controller-manager.js.map