123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- var BABYLON;
- (function (BABYLON) {
- var ActionEvent = (function () {
- function ActionEvent(source, pointerX, pointerY, meshUnderPointer) {
- this.source = source;
- this.pointerX = pointerX;
- this.pointerY = pointerY;
- this.meshUnderPointer = meshUnderPointer;
- }
- ActionEvent.CreateNew = function (source) {
- var scene = source.getScene();
- return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer);
- };
- return ActionEvent;
- })();
- BABYLON.ActionEvent = ActionEvent;
- var ActionManager = (function () {
- function ActionManager(scene) {
- // Members
- this.actions = new Array();
- this._scene = scene;
- }
- Object.defineProperty(ActionManager, "NothingTrigger", {
- get: function () {
- return ActionManager._NothingTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnPickTrigger", {
- get: function () {
- return ActionManager._OnPickTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnLeftPickTrigger", {
- get: function () {
- return ActionManager._OnLeftPickTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnRightPickTrigger", {
- get: function () {
- return ActionManager._OnRightPickTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnCenterPickTrigger", {
- get: function () {
- return ActionManager._OnCenterPickTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnPointerOverTrigger", {
- get: function () {
- return ActionManager._OnPointerOverTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnPointerOutTrigger", {
- get: function () {
- return ActionManager._OnPointerOutTrigger;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ActionManager, "OnEveryFrameTrigger", {
- get: function () {
- return ActionManager._OnEveryFrameTrigger;
- },
- enumerable: true,
- configurable: true
- });
- // Methods
- ActionManager.prototype.getScene = function () {
- return this._scene;
- };
- ActionManager.prototype.registerAction = function (action) {
- if (action.trigger === ActionManager.OnEveryFrameTrigger) {
- if (this.getScene().actionManager !== this) {
- BABYLON.Tools.Warn("OnEveryFrameTrigger can only be used with scene.actionManager");
- return null;
- }
- }
- this.actions.push(action);
- action._actionManager = this;
- action._prepare();
- return action;
- };
- ActionManager.prototype.processTrigger = function (trigger, evt) {
- for (var index = 0; index < this.actions.length; index++) {
- var action = this.actions[index];
- if (action.trigger === trigger) {
- action._executeCurrent(evt);
- }
- }
- };
- ActionManager.prototype._getEffectiveTarget = function (target, propertyPath) {
- var properties = propertyPath.split(".");
- for (var index = 0; index < properties.length - 1; index++) {
- target = target[properties[index]];
- }
- return target;
- };
- ActionManager.prototype._getProperty = function (propertyPath) {
- var properties = propertyPath.split(".");
- return properties[properties.length - 1];
- };
- ActionManager._NothingTrigger = 0;
- ActionManager._OnPickTrigger = 1;
- ActionManager._OnLeftPickTrigger = 2;
- ActionManager._OnRightPickTrigger = 3;
- ActionManager._OnCenterPickTrigger = 4;
- ActionManager._OnPointerOverTrigger = 5;
- ActionManager._OnPointerOutTrigger = 6;
- ActionManager._OnEveryFrameTrigger = 7;
- return ActionManager;
- })();
- BABYLON.ActionManager = ActionManager;
- })(BABYLON || (BABYLON = {}));
- //# sourceMappingURL=babylon.actionManager.js.map
|