@awayjs/scene
Version:
AwayJS scene classes
74 lines (73 loc) • 2.47 kB
JavaScript
import { __extends } from "tslib";
import { EventBase } from '@awayjs/core';
/**
* 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 PointerEvent = /** @class */ (function (_super) {
__extends(PointerEvent, _super);
/**
* Create a new MouseEvent object.
* @param type The type of the MouseEvent.
*/
function PointerEvent(type) {
return _super.call(this, type) || this;
}
Object.defineProperty(PointerEvent.prototype, "bubbles", {
/**
* @inheritDoc
*/
get: function () {
var doesBubble = this._iAllowedToPropagate && this._iAllowedToImmediatlyPropagate;
this._iAllowedToPropagate = true;
this._iAllowedToImmediatlyPropagate = true;
// Don't bubble if propagation has been stopped.
return doesBubble;
},
enumerable: false,
configurable: true
});
/**
* @inheritDoc
*/
PointerEvent.prototype.stopPropagation = function () {
this._iAllowedToPropagate = false;
if (this._iParentEvent)
this._iParentEvent.stopPropagation();
};
/**
* @inheritDoc
*/
PointerEvent.prototype.stopImmediatePropagation = function () {
this._iAllowedToPropagate = false;
this._iAllowedToImmediatlyPropagate = false;
if (this._iParentEvent)
this._iParentEvent.stopImmediatePropagation();
};
Object.defineProperty(PointerEvent.prototype, "scenePosition", {
/**
* The position in scene space where the event took place
*/
get: function () {
return this.containerNode.getMatrix3D().transformVector(this.position);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PointerEvent.prototype, "sceneNormal", {
/**
* The normal in scene space where the event took place
*/
get: function () {
var sceneNormal = this.containerNode.getMatrix3D().deltaTransformVector(this.normal);
sceneNormal.normalize();
return sceneNormal;
},
enumerable: false,
configurable: true
});
PointerEvent.prototype._dispatchEvent = function (dispatcher, target) {
};
return PointerEvent;
}(EventBase));
export { PointerEvent };