UNPKG

@awayjs/scene

Version:
123 lines (122 loc) 4.34 kB
import { __extends } from "tslib"; import FrameScriptManager from '../managers/FrameScriptManager'; import { PointerEvent } from './PointerEvent'; /** * A MouseEvent is dispatched when a mouse event occurs over a mouseEnabled object in View. * TODO: we don't have screenZ data, tho this should be easy to implement */ var MouseEvent = /** @class */ (function (_super) { __extends(MouseEvent, _super); /** * Create a new MouseEvent object. * @param type The type of the MouseEvent. */ function MouseEvent(type) { var _this = _super.call(this, type) || this; /** * Current buttons status */ _this.buttons = 0; return _this; } /** * Creates a copy of the MouseEvent object and sets the value of each property to match that of the original. */ MouseEvent.prototype.clone = function () { var result = new MouseEvent(this.type); /* TODO: Debug / test - look into isDefaultPrevented if (isDefaultPrevented()) result.preventDefault(); */ result.screenX = this.screenX; result.screenY = this.screenY; result.view = this.view; result.containerNode = this.containerNode; result.rootNode = this.rootNode; result.traversable = this.traversable; result.material = this.material; result.uv = this.uv; result.position = this.position; result.normal = this.normal; result.elementIndex = this.elementIndex; result.delta = this.delta; result.ctrlKey = this.ctrlKey; result.shiftKey = this.shiftKey; result._iParentEvent = this; result._iAllowedToPropagate = this._iAllowedToPropagate; result.buttons = this.buttons; return result; }; MouseEvent.prototype._dispatchEvent = function (dispatcher, target) { if (!dispatcher.isMouseDisabled() || this.type == MouseEvent.MOUSE_OUT || this.type == MouseEvent.ROLL_OUT) { dispatcher.container.dispatchEvent(this, target); FrameScriptManager.execute_queue(); } }; /** * Defines the value of the type property of a mouseOver3d event object. */ MouseEvent.MOUSE_OVER = 'mouseOver3d'; /** * Defines the value of the type property of a mouseOut3d event object. */ MouseEvent.MOUSE_OUT = 'mouseOut3d'; /** * Defines the value of the type property of a rollOver3d event object. */ MouseEvent.ROLL_OVER = 'rollOver3d'; /** * Defines the value of the type property of a rollOut3d event object. */ MouseEvent.ROLL_OUT = 'rollOut3d'; /** * Defines the value of the type property of a mouseUp3d event object. */ MouseEvent.MOUSE_UP = 'mouseUp3d'; /** * Defines the value of the type property of a mouseUp3d event object. */ MouseEvent.MOUSE_UP_OUTSIDE = 'mouseUpOutside3d'; /** * Defines the value of the type property of a mouseDown3d event object. */ MouseEvent.MOUSE_DOWN = 'mouseDown3d'; /** * Defines the value of the type property of a mouseMove3d event object. */ MouseEvent.MOUSE_MOVE = 'mouseMove3d'; /** * Defines the value of the type property of a dragMove3d event object. */ MouseEvent.DRAG_MOVE = 'dragMove3d'; /** * Defines the value of the type property of a dragOut3d event object. */ MouseEvent.DRAG_OUT = 'dragOut3d'; /** * Defines the value of the type property of a dragOver3d event object. */ MouseEvent.DRAG_OVER = 'dragOver3d'; /** * Defines the value of the type property of a dragStart3d event object. */ MouseEvent.DRAG_START = 'dragStart3d'; /** * Defines the value of the type property of a dragStop3d event object. */ MouseEvent.DRAG_STOP = 'dragStop3d'; /** * Defines the value of the type property of a click3d event object. */ MouseEvent.CLICK = 'click3d'; /** * Defines the value of the type property of a doubleClick3d event object. */ MouseEvent.DOUBLE_CLICK = 'doubleClick3d'; /** * Defines the value of the type property of a mouseWheel3d event object. */ MouseEvent.MOUSE_WHEEL = 'mouseWheel3d'; return MouseEvent; }(PointerEvent)); export { MouseEvent };