@awayjs/scene 0.13.248 → 0.13.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/awayjs-scene.umd.js +29 -53
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/base/MouseButtons.d.ts +23 -0
- package/dist/lib/base/MouseButtons.d.ts.map +1 -0
- package/dist/lib/base/MouseButtons.js +0 -0
- package/dist/lib/display/MovieClip.d.ts +1 -2
- package/dist/lib/display/MovieClip.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.js +7 -15
- package/dist/lib/events/MouseEvent.d.ts +3 -2
- package/dist/lib/events/MouseEvent.d.ts.map +1 -1
- package/dist/lib/events/MouseEvent.js +4 -4
- package/dist/lib/managers/MouseManager.d.ts +0 -1
- package/dist/lib/managers/MouseManager.d.ts.map +1 -1
- package/dist/lib/managers/MouseManager.js +17 -33
- package/index.ts +2 -1
- package/lib/base/MouseButtons.ts +27 -0
- package/lib/display/MovieClip.ts +9 -18
- package/lib/events/MouseEvent.ts +5 -4
- package/lib/managers/MouseManager.ts +18 -36
- package/package.json +1 -1
|
@@ -6618,9 +6618,9 @@ var MouseEvent$1 = /** @class */ (function (_super) {
|
|
|
6618
6618
|
function MouseEvent(type) {
|
|
6619
6619
|
var _this = _super.call(this, type) || this;
|
|
6620
6620
|
/**
|
|
6621
|
-
* Current
|
|
6621
|
+
* Current buttons status
|
|
6622
6622
|
*/
|
|
6623
|
-
_this.
|
|
6623
|
+
_this.buttons = 0;
|
|
6624
6624
|
return _this;
|
|
6625
6625
|
}
|
|
6626
6626
|
Object.defineProperty(MouseEvent.prototype, "bubbles", {
|
|
@@ -6679,7 +6679,7 @@ var MouseEvent$1 = /** @class */ (function (_super) {
|
|
|
6679
6679
|
result.shiftKey = this.shiftKey;
|
|
6680
6680
|
result._iParentEvent = this;
|
|
6681
6681
|
result._iAllowedToPropagate = this._iAllowedToPropagate;
|
|
6682
|
-
result.
|
|
6682
|
+
result.buttons = this.buttons;
|
|
6683
6683
|
return result;
|
|
6684
6684
|
};
|
|
6685
6685
|
Object.defineProperty(MouseEvent.prototype, "scenePosition", {
|
|
@@ -6705,7 +6705,7 @@ var MouseEvent$1 = /** @class */ (function (_super) {
|
|
|
6705
6705
|
configurable: true
|
|
6706
6706
|
});
|
|
6707
6707
|
MouseEvent.prototype._dispatchEvent = function (dispatcher, target) {
|
|
6708
|
-
if (!dispatcher.isMouseDisabled()) {
|
|
6708
|
+
if (!dispatcher.isMouseDisabled() || this.type == MouseEvent.MOUSE_OUT || this.type == MouseEvent.ROLL_OUT) {
|
|
6709
6709
|
dispatcher.container.dispatchEvent(this, target);
|
|
6710
6710
|
FrameScriptManager.execute_queue();
|
|
6711
6711
|
}
|
|
@@ -6845,12 +6845,12 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6845
6845
|
//this.debugVisible=true;
|
|
6846
6846
|
_this._onMouseOver = function (_event) {
|
|
6847
6847
|
if (_this.buttonEnabled)
|
|
6848
|
-
_this.currentFrameIndex = 1;
|
|
6848
|
+
_this.currentFrameIndex = (_event.buttons & 1 /* PRIMARY_BUTTON */) ? _this.currentFrameIndex == 0 ? 0 : 2 : 1;
|
|
6849
6849
|
else
|
|
6850
6850
|
_this.currentFrameIndex = 0;
|
|
6851
6851
|
};
|
|
6852
6852
|
_this._onMouseOut = function (_event) {
|
|
6853
|
-
_this.currentFrameIndex = 0;
|
|
6853
|
+
_this.currentFrameIndex = (_event.buttons & 1 /* PRIMARY_BUTTON */ && _this.currentFrameIndex != 0) ? 1 : 0;
|
|
6854
6854
|
};
|
|
6855
6855
|
_this._onMouseDown = function (_event) {
|
|
6856
6856
|
if (_this.buttonEnabled)
|
|
@@ -6859,17 +6859,11 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6859
6859
|
_this.currentFrameIndex = 0;
|
|
6860
6860
|
};
|
|
6861
6861
|
_this._onMouseUp = function (_event) {
|
|
6862
|
-
_this.currentFrameIndex = _this.currentFrameIndex == 0 ? 0 : 1;
|
|
6863
|
-
};
|
|
6864
|
-
_this._onDragOver = function (_event) {
|
|
6865
|
-
if (_this.buttonEnabled)
|
|
6866
|
-
_this.currentFrameIndex = 2;
|
|
6867
|
-
else
|
|
6868
|
-
_this.currentFrameIndex = 0;
|
|
6869
|
-
};
|
|
6870
|
-
_this._onDragOut = function (_event) {
|
|
6871
6862
|
_this.currentFrameIndex = 1;
|
|
6872
6863
|
};
|
|
6864
|
+
_this._onMouseUpOutside = function (_event) {
|
|
6865
|
+
_this.currentFrameIndex = 0;
|
|
6866
|
+
};
|
|
6873
6867
|
_this._timeline = timeline;
|
|
6874
6868
|
if (spriteMode) {
|
|
6875
6869
|
_this.transformToSprite();
|
|
@@ -7363,8 +7357,7 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7363
7357
|
this.addEventListener(MouseEvent$1.MOUSE_OUT, this._onMouseOut);
|
|
7364
7358
|
this.addEventListener(MouseEvent$1.MOUSE_DOWN, this._onMouseDown);
|
|
7365
7359
|
this.addEventListener(MouseEvent$1.MOUSE_UP, this._onMouseUp);
|
|
7366
|
-
this.addEventListener(MouseEvent$1.
|
|
7367
|
-
this.addEventListener(MouseEvent$1.DRAG_OUT, this._onDragOut);
|
|
7360
|
+
this.addEventListener(MouseEvent$1.MOUSE_UP_OUTSIDE, this._onMouseUpOutside);
|
|
7368
7361
|
this.mouseChildren = false;
|
|
7369
7362
|
};
|
|
7370
7363
|
MovieClip.prototype.removeButtonListeners = function () {
|
|
@@ -7372,8 +7365,7 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7372
7365
|
this.removeEventListener(MouseEvent$1.MOUSE_OUT, this._onMouseOut);
|
|
7373
7366
|
this.removeEventListener(MouseEvent$1.MOUSE_DOWN, this._onMouseDown);
|
|
7374
7367
|
this.removeEventListener(MouseEvent$1.MOUSE_UP, this._onMouseUp);
|
|
7375
|
-
this.removeEventListener(MouseEvent$1.
|
|
7376
|
-
this.removeEventListener(MouseEvent$1.DRAG_OUT, this._onDragOut);
|
|
7368
|
+
this.removeEventListener(MouseEvent$1.MOUSE_UP_OUTSIDE, this._onMouseUpOutside);
|
|
7377
7369
|
};
|
|
7378
7370
|
MovieClip.prototype.getTimelineChildAtSessionID = function (sessionID) {
|
|
7379
7371
|
return this._sessionID_childs[sessionID];
|
|
@@ -15000,7 +14992,6 @@ var MouseManager = /** @class */ (function () {
|
|
|
15000
14992
|
this._isAVM1Dragging = false;
|
|
15001
14993
|
this._isDown = false;
|
|
15002
14994
|
this._stage = stage;
|
|
15003
|
-
this.onClick = this.onClick.bind(this);
|
|
15004
14995
|
this.onDoubleClick = this.onDoubleClick.bind(this);
|
|
15005
14996
|
this.onMouseDown = this.onMouseDown.bind(this);
|
|
15006
14997
|
this.onMouseMove = this.onMouseMove.bind(this);
|
|
@@ -15016,15 +15007,12 @@ var MouseManager = /** @class */ (function () {
|
|
|
15016
15007
|
this._mouseDragging = false;
|
|
15017
15008
|
//register stage
|
|
15018
15009
|
var container = this._stage.container;
|
|
15019
|
-
container.addEventListener('click', this.onClick);
|
|
15020
|
-
container.addEventListener('dblclick', this.onClick);
|
|
15021
15010
|
container.addEventListener('touchstart', this.onMouseDown);
|
|
15022
15011
|
container.addEventListener('mousedown', this.onMouseDown);
|
|
15023
15012
|
window.addEventListener('touchmove', this.onMouseMove);
|
|
15024
15013
|
window.addEventListener('mousemove', this.onMouseMove);
|
|
15025
15014
|
window.addEventListener('mouseup', this.onMouseUp);
|
|
15026
15015
|
container.addEventListener('touchend', this.onMouseUp);
|
|
15027
|
-
container.addEventListener('touchend', this.onClick);
|
|
15028
15016
|
container.addEventListener('mousewheel', this.onMouseWheel);
|
|
15029
15017
|
container.addEventListener('mouseover', this.onMouseOver);
|
|
15030
15018
|
container.addEventListener('mouseout', this.onMouseOut);
|
|
@@ -15098,7 +15086,6 @@ var MouseManager = /** @class */ (function () {
|
|
|
15098
15086
|
MouseManager.prototype.dispose = function () {
|
|
15099
15087
|
//unregister stage
|
|
15100
15088
|
var container = this._stage.container;
|
|
15101
|
-
container.removeEventListener('click', this.onClick);
|
|
15102
15089
|
container.removeEventListener('dblclick', this.onDoubleClick);
|
|
15103
15090
|
container.removeEventListener('touchstart', this.onMouseDown);
|
|
15104
15091
|
container.removeEventListener('mousedown', this.onMouseDown);
|
|
@@ -15106,7 +15093,6 @@ var MouseManager = /** @class */ (function () {
|
|
|
15106
15093
|
window.removeEventListener('mousemove', this.onMouseMove);
|
|
15107
15094
|
window.removeEventListener('mouseup', this.onMouseUp);
|
|
15108
15095
|
container.removeEventListener('touchend', this.onMouseUp);
|
|
15109
|
-
container.removeEventListener('touchend', this.onClick);
|
|
15110
15096
|
container.removeEventListener('wheel', this.onMouseWheel);
|
|
15111
15097
|
container.removeEventListener('mouseover', this.onMouseOver);
|
|
15112
15098
|
container.removeEventListener('mouseout', this.onMouseOut);
|
|
@@ -15188,6 +15174,7 @@ var MouseManager = /** @class */ (function () {
|
|
|
15188
15174
|
event.ctrlKey = sourceEvent.ctrlKey;
|
|
15189
15175
|
event.altKey = sourceEvent.altKey;
|
|
15190
15176
|
event.shiftKey = sourceEvent.shiftKey;
|
|
15177
|
+
event.buttons = sourceEvent.buttons;
|
|
15191
15178
|
}
|
|
15192
15179
|
event = this.setUpEvent(event, collision, commonAncestor);
|
|
15193
15180
|
this.dispatchEvent(event, event.rootNode);
|
|
@@ -15254,25 +15241,16 @@ var MouseManager = /** @class */ (function () {
|
|
|
15254
15241
|
&& this._mouseDragCollision.rootNode != dispatcher) {
|
|
15255
15242
|
// no avm1dragging is in process, but current collision
|
|
15256
15243
|
// is not the same as collision that appeared on mouse-down,
|
|
15257
|
-
// need to dispatch a MOUSE_UP_OUTSIDE
|
|
15258
|
-
if (this._mouseDragCollision.rootNode.buttonEnabled)
|
|
15259
|
-
this.setupAndDispatchEvent(this._mouseOut, event, this._mouseDragCollision);
|
|
15260
|
-
if (!this._eventBubbling) {
|
|
15261
|
-
this.setupAndDispatchEvent(this._mouseUpOutside, event, this._mouseDragCollision);
|
|
15262
|
-
}
|
|
15244
|
+
// need to dispatch a MOUSE_UP_OUTSIDE after mouse up
|
|
15263
15245
|
}
|
|
15264
15246
|
else if (this._mouseDragging && this._mouseDragCollision
|
|
15265
15247
|
&& this._mouseDragCollision.rootNode == dispatcher) {
|
|
15266
15248
|
// no avm1dragging is in process,
|
|
15267
|
-
//
|
|
15268
|
-
// need to dispatch a
|
|
15249
|
+
// current collision is the same as collision that appeared on
|
|
15250
|
+
// mouse-down, need to dispatch a MOUSE_CLICK event after mouse up
|
|
15269
15251
|
upRootNode = this._mouseDragCollision.rootNode;
|
|
15270
15252
|
upContainerNode = this._mouseDragCollision.containerNode;
|
|
15271
15253
|
}
|
|
15272
|
-
if (this._mouseDragging && dispatcher)
|
|
15273
|
-
this.setupAndDispatchEvent(this._mouseOver, event, collision);
|
|
15274
|
-
if (this._isTouch && upContainerNode)
|
|
15275
|
-
this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._mouseDragCollision);
|
|
15276
15254
|
if (upRootNode) {
|
|
15277
15255
|
//console.log("onRelease", upRootNode)
|
|
15278
15256
|
this.dispatchEvent(event, upRootNode);
|
|
@@ -15281,8 +15259,14 @@ var MouseManager = /** @class */ (function () {
|
|
|
15281
15259
|
this.dispatchEvent(event, dispatcher);
|
|
15282
15260
|
else if (this._eventBubbling)
|
|
15283
15261
|
this._stage.dispatchEvent(event);
|
|
15284
|
-
if (upContainerNode)
|
|
15262
|
+
if (upContainerNode) {
|
|
15263
|
+
if (!this._isAVM1Dragging)
|
|
15264
|
+
this.setupAndDispatchEvent(this._mouseClick, this._isTouch ? this._mouseMoveEvent : event, this._mouseDragCollision);
|
|
15285
15265
|
this.setupAndDispatchEvent(this._dragStop, event, this._mouseDragCollision);
|
|
15266
|
+
}
|
|
15267
|
+
else if (this._mouseDragging && this._mouseDragCollision) {
|
|
15268
|
+
this.setupAndDispatchEvent(this._mouseUpOutside, event, this._mouseDragCollision);
|
|
15269
|
+
}
|
|
15286
15270
|
this._mouseDragCollision = null;
|
|
15287
15271
|
this._mouseDragging = false;
|
|
15288
15272
|
this._isAVM1Dragging = false;
|
|
@@ -15316,14 +15300,13 @@ var MouseManager = /** @class */ (function () {
|
|
|
15316
15300
|
var prevCollisionNode = (_d = this._prevCollision) === null || _d === void 0 ? void 0 : _d.rootNode;
|
|
15317
15301
|
if (collisionNode != prevCollisionNode) {
|
|
15318
15302
|
// If colliding object has changed, queue OVER and OUT events.
|
|
15319
|
-
// If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT
|
|
15303
|
+
// If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT as well as MOUSE_OVER MOUSE_OUT
|
|
15320
15304
|
// DRAG_OVER and DRAG_OUT are only dispatched on the object that was hit on the mouse-down
|
|
15321
15305
|
// (_mouseDragEntity)
|
|
15322
15306
|
// Store the info if the collision is a enabled Button (_collisionIsEnabledButton)
|
|
15323
15307
|
if (prevCollisionNode) {
|
|
15324
|
-
|
|
15325
|
-
|
|
15326
|
-
else if (this._mouseDragging && this._mouseDragCollision
|
|
15308
|
+
this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._prevCollision);
|
|
15309
|
+
if (this._mouseDragging && this._mouseDragCollision
|
|
15327
15310
|
&& this._mouseDragCollision.rootNode == prevCollisionNode)
|
|
15328
15311
|
this.setupAndDispatchEvent(this._dragOut, this._mouseMoveEvent, this._prevCollision);
|
|
15329
15312
|
}
|
|
@@ -15364,10 +15347,8 @@ var MouseManager = /** @class */ (function () {
|
|
|
15364
15347
|
}
|
|
15365
15348
|
this._collisionIsEnabledButton = collisionNode ? collisionNode.buttonEnabled : false;
|
|
15366
15349
|
if (collisionNode) {
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
else if (this._mouseDragging && this._mouseDragCollision &&
|
|
15370
|
-
this._mouseDragCollision.rootNode == collisionNode)
|
|
15350
|
+
this.setupAndDispatchEvent(this._mouseOver, this._mouseMoveEvent, collision);
|
|
15351
|
+
if (this._mouseDragging)
|
|
15371
15352
|
this.setupAndDispatchEvent(this._dragOver, this._mouseMoveEvent, collision);
|
|
15372
15353
|
}
|
|
15373
15354
|
this._prevCollision = collision;
|
|
@@ -15591,7 +15572,7 @@ var MouseManager = /** @class */ (function () {
|
|
|
15591
15572
|
event.ctrlKey = sourceEvent.ctrlKey;
|
|
15592
15573
|
event.altKey = sourceEvent.altKey;
|
|
15593
15574
|
event.shiftKey = sourceEvent.shiftKey;
|
|
15594
|
-
event.
|
|
15575
|
+
event.buttons = (sourceEvent instanceof MouseEvent) ? sourceEvent.buttons : 0;
|
|
15595
15576
|
this._queuedEvents.push(event);
|
|
15596
15577
|
};
|
|
15597
15578
|
// ---------------------------------------------------------------------
|
|
@@ -15669,11 +15650,6 @@ var MouseManager = /** @class */ (function () {
|
|
|
15669
15650
|
this.updateColliders(event);
|
|
15670
15651
|
this.queueDispatch(this._mouseOver, event);
|
|
15671
15652
|
};
|
|
15672
|
-
MouseManager.prototype.onClick = function (event) {
|
|
15673
|
-
!MouseManager.inputRecorder || MouseManager.inputRecorder.recordEvent(event);
|
|
15674
|
-
this.updateColliders(event);
|
|
15675
|
-
this.queueDispatch(this._mouseClick, event);
|
|
15676
|
-
};
|
|
15677
15653
|
MouseManager.prototype.onDoubleClick = function (event) {
|
|
15678
15654
|
!MouseManager.inputRecorder || MouseManager.inputRecorder.recordEvent(event);
|
|
15679
15655
|
this.updateColliders(event);
|
|
@@ -18197,7 +18173,7 @@ var Scene = /** @class */ (function () {
|
|
|
18197
18173
|
_awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
|
|
18198
18174
|
_awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
|
|
18199
18175
|
|
|
18200
|
-
console.debug('AwayJS - Scene - 0.13.
|
|
18176
|
+
console.debug('AwayJS - Scene - 0.13.249');
|
|
18201
18177
|
|
|
18202
18178
|
exports.Timeline = Timeline;
|
|
18203
18179
|
exports.ControllerBase = ControllerBase;
|