@awayjs/scene
Version:
AwayJS scene classes
90 lines (89 loc) • 3.28 kB
JavaScript
import { __extends } from "tslib";
import FrameScriptManager from '../managers/FrameScriptManager';
import { PointerEvent } from './PointerEvent';
/**
* A touchEvent is dispatched when a touch event occurs over a touchEnabled object in View.
* TODO: we don't have screenZ data, tho this should be easy to implement
*/
var TouchEvent = /** @class */ (function (_super) {
__extends(TouchEvent, _super);
/**
* Create a new touchEvent object.
* @param type The type of the touchEvent.
*/
function TouchEvent(type) {
var _this = _super.call(this, type) || this;
/**
* Unique identifier of associated touchPoint
*/
_this.touchPointID = 0;
return _this;
}
/**
* Creates a copy of the touchEvent object and sets the value of each property to match that of the original.
*/
TouchEvent.prototype.clone = function () {
var result = new TouchEvent(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.touchPointID = this.touchPointID;
result.ctrlKey = this.ctrlKey;
result.shiftKey = this.shiftKey;
result._iParentEvent = this;
result._iAllowedToPropagate = this._iAllowedToPropagate;
return result;
};
TouchEvent.prototype._dispatchEvent = function (dispatcher, target) {
if (!dispatcher.isMouseDisabled() || this.type == TouchEvent.TOUCH_OUT || this.type == TouchEvent.TOUCH_ROLL_OUT) {
dispatcher.container.dispatchEvent(this, target);
FrameScriptManager.execute_queue();
}
};
/**
* Defines the value of the type property of a touchOver3d event object.
*/
TouchEvent.TOUCH_OVER = 'touchOver3d';
/**
* Defines the value of the type property of a touchOut3d event object.
*/
TouchEvent.TOUCH_OUT = 'touchOut3d';
/**
* Defines the value of the type property of a rollOver3d event object.
*/
TouchEvent.TOUCH_ROLL_OVER = 'touchRollOver3d';
/**
* Defines the value of the type property of a rollOut3d event object.
*/
TouchEvent.TOUCH_ROLL_OUT = 'touchRollOut3d';
/**
* Defines the value of the type property of a touchUp3d event object.
*/
TouchEvent.TOUCH_END = 'touchUp3d';
/**
* Defines the value of the type property of a touchDown3d event object.
*/
TouchEvent.TOUCH_BEGIN = 'touchDown3d';
/**
* Defines the value of the type property of a touchMove3d event object.
*/
TouchEvent.TOUCH_MOVE = 'touchMove3d';
/**
* Defines the value of the type property of a click3d event object.
*/
TouchEvent.TOUCH_TAP = 'tap3d';
return TouchEvent;
}(PointerEvent));
export { TouchEvent };