@awayjs/scene 0.13.248 → 0.13.250

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.
@@ -2400,6 +2400,7 @@ var DisplayObject = /** @class */ (function (_super) {
2400
2400
  var index = this._masks.indexOf(this._scriptMask);
2401
2401
  if (index !== -1) {
2402
2402
  this._masks.splice(index, 1);
2403
+ this._scriptMask.maskMode = false;
2403
2404
  }
2404
2405
  }
2405
2406
  this._scriptMask = mask;
@@ -6618,9 +6619,9 @@ var MouseEvent$1 = /** @class */ (function (_super) {
6618
6619
  function MouseEvent(type) {
6619
6620
  var _this = _super.call(this, type) || this;
6620
6621
  /**
6621
- * Current button that fire event
6622
+ * Current buttons status
6622
6623
  */
6623
- _this.button = 0;
6624
+ _this.buttons = 0;
6624
6625
  return _this;
6625
6626
  }
6626
6627
  Object.defineProperty(MouseEvent.prototype, "bubbles", {
@@ -6679,7 +6680,7 @@ var MouseEvent$1 = /** @class */ (function (_super) {
6679
6680
  result.shiftKey = this.shiftKey;
6680
6681
  result._iParentEvent = this;
6681
6682
  result._iAllowedToPropagate = this._iAllowedToPropagate;
6682
- result.button = this.button;
6683
+ result.buttons = this.buttons;
6683
6684
  return result;
6684
6685
  };
6685
6686
  Object.defineProperty(MouseEvent.prototype, "scenePosition", {
@@ -6705,7 +6706,7 @@ var MouseEvent$1 = /** @class */ (function (_super) {
6705
6706
  configurable: true
6706
6707
  });
6707
6708
  MouseEvent.prototype._dispatchEvent = function (dispatcher, target) {
6708
- if (!dispatcher.isMouseDisabled()) {
6709
+ if (!dispatcher.isMouseDisabled() || this.type == MouseEvent.MOUSE_OUT || this.type == MouseEvent.ROLL_OUT) {
6709
6710
  dispatcher.container.dispatchEvent(this, target);
6710
6711
  FrameScriptManager.execute_queue();
6711
6712
  }
@@ -6845,12 +6846,12 @@ var MovieClip = /** @class */ (function (_super) {
6845
6846
  //this.debugVisible=true;
6846
6847
  _this._onMouseOver = function (_event) {
6847
6848
  if (_this.buttonEnabled)
6848
- _this.currentFrameIndex = 1;
6849
+ _this.currentFrameIndex = (_event.buttons & 1 /* PRIMARY_BUTTON */) ? _this.currentFrameIndex == 0 ? 0 : 2 : 1;
6849
6850
  else
6850
6851
  _this.currentFrameIndex = 0;
6851
6852
  };
6852
6853
  _this._onMouseOut = function (_event) {
6853
- _this.currentFrameIndex = 0;
6854
+ _this.currentFrameIndex = (_event.buttons & 1 /* PRIMARY_BUTTON */ && _this.currentFrameIndex != 0) ? 1 : 0;
6854
6855
  };
6855
6856
  _this._onMouseDown = function (_event) {
6856
6857
  if (_this.buttonEnabled)
@@ -6859,17 +6860,11 @@ var MovieClip = /** @class */ (function (_super) {
6859
6860
  _this.currentFrameIndex = 0;
6860
6861
  };
6861
6862
  _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
6863
  _this.currentFrameIndex = 1;
6872
6864
  };
6865
+ _this._onMouseUpOutside = function (_event) {
6866
+ _this.currentFrameIndex = 0;
6867
+ };
6873
6868
  _this._timeline = timeline;
6874
6869
  if (spriteMode) {
6875
6870
  _this.transformToSprite();
@@ -7363,8 +7358,7 @@ var MovieClip = /** @class */ (function (_super) {
7363
7358
  this.addEventListener(MouseEvent$1.MOUSE_OUT, this._onMouseOut);
7364
7359
  this.addEventListener(MouseEvent$1.MOUSE_DOWN, this._onMouseDown);
7365
7360
  this.addEventListener(MouseEvent$1.MOUSE_UP, this._onMouseUp);
7366
- this.addEventListener(MouseEvent$1.DRAG_OVER, this._onDragOver);
7367
- this.addEventListener(MouseEvent$1.DRAG_OUT, this._onDragOut);
7361
+ this.addEventListener(MouseEvent$1.MOUSE_UP_OUTSIDE, this._onMouseUpOutside);
7368
7362
  this.mouseChildren = false;
7369
7363
  };
7370
7364
  MovieClip.prototype.removeButtonListeners = function () {
@@ -7372,8 +7366,7 @@ var MovieClip = /** @class */ (function (_super) {
7372
7366
  this.removeEventListener(MouseEvent$1.MOUSE_OUT, this._onMouseOut);
7373
7367
  this.removeEventListener(MouseEvent$1.MOUSE_DOWN, this._onMouseDown);
7374
7368
  this.removeEventListener(MouseEvent$1.MOUSE_UP, this._onMouseUp);
7375
- this.removeEventListener(MouseEvent$1.DRAG_OVER, this._onDragOver);
7376
- this.removeEventListener(MouseEvent$1.DRAG_OUT, this._onDragOut);
7369
+ this.removeEventListener(MouseEvent$1.MOUSE_UP_OUTSIDE, this._onMouseUpOutside);
7377
7370
  };
7378
7371
  MovieClip.prototype.getTimelineChildAtSessionID = function (sessionID) {
7379
7372
  return this._sessionID_childs[sessionID];
@@ -14886,8 +14879,8 @@ var SceneImage2D = /** @class */ (function (_super) {
14886
14879
  if (!useBlend && this._lastUsedFill !== null) {
14887
14880
  // bitmap was filled plain, go clear TMP to this color too
14888
14881
  renderer.disableClear = false;
14889
- renderer.view.backgroundColor = this._lastUsedFill;
14890
- renderer.view.backgroundAlpha = (this._lastUsedFill >>> 24 & 0xff) / 0xff;
14882
+ renderer.view.backgroundColor = this._lastUsedFill & 0xffffff;
14883
+ renderer.view.backgroundAlpha = this._transparent ? (this._lastUsedFill >>> 24 & 0xff) / 0xff : 1;
14891
14884
  }
14892
14885
  else {
14893
14886
  // we clear TMP and render to it, prepare to composing
@@ -15000,7 +14993,6 @@ var MouseManager = /** @class */ (function () {
15000
14993
  this._isAVM1Dragging = false;
15001
14994
  this._isDown = false;
15002
14995
  this._stage = stage;
15003
- this.onClick = this.onClick.bind(this);
15004
14996
  this.onDoubleClick = this.onDoubleClick.bind(this);
15005
14997
  this.onMouseDown = this.onMouseDown.bind(this);
15006
14998
  this.onMouseMove = this.onMouseMove.bind(this);
@@ -15016,15 +15008,12 @@ var MouseManager = /** @class */ (function () {
15016
15008
  this._mouseDragging = false;
15017
15009
  //register stage
15018
15010
  var container = this._stage.container;
15019
- container.addEventListener('click', this.onClick);
15020
- container.addEventListener('dblclick', this.onClick);
15021
15011
  container.addEventListener('touchstart', this.onMouseDown);
15022
15012
  container.addEventListener('mousedown', this.onMouseDown);
15023
15013
  window.addEventListener('touchmove', this.onMouseMove);
15024
15014
  window.addEventListener('mousemove', this.onMouseMove);
15025
15015
  window.addEventListener('mouseup', this.onMouseUp);
15026
15016
  container.addEventListener('touchend', this.onMouseUp);
15027
- container.addEventListener('touchend', this.onClick);
15028
15017
  container.addEventListener('mousewheel', this.onMouseWheel);
15029
15018
  container.addEventListener('mouseover', this.onMouseOver);
15030
15019
  container.addEventListener('mouseout', this.onMouseOut);
@@ -15098,7 +15087,6 @@ var MouseManager = /** @class */ (function () {
15098
15087
  MouseManager.prototype.dispose = function () {
15099
15088
  //unregister stage
15100
15089
  var container = this._stage.container;
15101
- container.removeEventListener('click', this.onClick);
15102
15090
  container.removeEventListener('dblclick', this.onDoubleClick);
15103
15091
  container.removeEventListener('touchstart', this.onMouseDown);
15104
15092
  container.removeEventListener('mousedown', this.onMouseDown);
@@ -15106,7 +15094,6 @@ var MouseManager = /** @class */ (function () {
15106
15094
  window.removeEventListener('mousemove', this.onMouseMove);
15107
15095
  window.removeEventListener('mouseup', this.onMouseUp);
15108
15096
  container.removeEventListener('touchend', this.onMouseUp);
15109
- container.removeEventListener('touchend', this.onClick);
15110
15097
  container.removeEventListener('wheel', this.onMouseWheel);
15111
15098
  container.removeEventListener('mouseover', this.onMouseOver);
15112
15099
  container.removeEventListener('mouseout', this.onMouseOut);
@@ -15188,6 +15175,7 @@ var MouseManager = /** @class */ (function () {
15188
15175
  event.ctrlKey = sourceEvent.ctrlKey;
15189
15176
  event.altKey = sourceEvent.altKey;
15190
15177
  event.shiftKey = sourceEvent.shiftKey;
15178
+ event.buttons = sourceEvent.buttons;
15191
15179
  }
15192
15180
  event = this.setUpEvent(event, collision, commonAncestor);
15193
15181
  this.dispatchEvent(event, event.rootNode);
@@ -15254,25 +15242,16 @@ var MouseManager = /** @class */ (function () {
15254
15242
  && this._mouseDragCollision.rootNode != dispatcher) {
15255
15243
  // no avm1dragging is in process, but current collision
15256
15244
  // is not the same as collision that appeared on mouse-down,
15257
- // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
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
- }
15245
+ // need to dispatch a MOUSE_UP_OUTSIDE after mouse up
15263
15246
  }
15264
15247
  else if (this._mouseDragging && this._mouseDragCollision
15265
15248
  && this._mouseDragCollision.rootNode == dispatcher) {
15266
15249
  // no avm1dragging is in process,
15267
- // but current collision is not the same as collision that appeared on mouse-down,
15268
- // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
15250
+ // current collision is the same as collision that appeared on
15251
+ // mouse-down, need to dispatch a MOUSE_CLICK event after mouse up
15269
15252
  upRootNode = this._mouseDragCollision.rootNode;
15270
15253
  upContainerNode = this._mouseDragCollision.containerNode;
15271
15254
  }
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
15255
  if (upRootNode) {
15277
15256
  //console.log("onRelease", upRootNode)
15278
15257
  this.dispatchEvent(event, upRootNode);
@@ -15281,8 +15260,14 @@ var MouseManager = /** @class */ (function () {
15281
15260
  this.dispatchEvent(event, dispatcher);
15282
15261
  else if (this._eventBubbling)
15283
15262
  this._stage.dispatchEvent(event);
15284
- if (upContainerNode)
15263
+ if (upContainerNode) {
15264
+ if (!this._isAVM1Dragging)
15265
+ this.setupAndDispatchEvent(this._mouseClick, this._isTouch ? this._mouseMoveEvent : event, this._mouseDragCollision);
15285
15266
  this.setupAndDispatchEvent(this._dragStop, event, this._mouseDragCollision);
15267
+ }
15268
+ else if (this._mouseDragging && this._mouseDragCollision) {
15269
+ this.setupAndDispatchEvent(this._mouseUpOutside, event, this._mouseDragCollision);
15270
+ }
15286
15271
  this._mouseDragCollision = null;
15287
15272
  this._mouseDragging = false;
15288
15273
  this._isAVM1Dragging = false;
@@ -15316,14 +15301,13 @@ var MouseManager = /** @class */ (function () {
15316
15301
  var prevCollisionNode = (_d = this._prevCollision) === null || _d === void 0 ? void 0 : _d.rootNode;
15317
15302
  if (collisionNode != prevCollisionNode) {
15318
15303
  // 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 instead of MOUSE_OVER MOUSE_OUT
15304
+ // If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT as well as MOUSE_OVER MOUSE_OUT
15320
15305
  // DRAG_OVER and DRAG_OUT are only dispatched on the object that was hit on the mouse-down
15321
15306
  // (_mouseDragEntity)
15322
15307
  // Store the info if the collision is a enabled Button (_collisionIsEnabledButton)
15323
15308
  if (prevCollisionNode) {
15324
- if (!this._isTouch && !this._mouseDragging)
15325
- this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._prevCollision);
15326
- else if (this._mouseDragging && this._mouseDragCollision
15309
+ this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._prevCollision);
15310
+ if (this._mouseDragging && this._mouseDragCollision
15327
15311
  && this._mouseDragCollision.rootNode == prevCollisionNode)
15328
15312
  this.setupAndDispatchEvent(this._dragOut, this._mouseMoveEvent, this._prevCollision);
15329
15313
  }
@@ -15364,10 +15348,8 @@ var MouseManager = /** @class */ (function () {
15364
15348
  }
15365
15349
  this._collisionIsEnabledButton = collisionNode ? collisionNode.buttonEnabled : false;
15366
15350
  if (collisionNode) {
15367
- if (!this._isTouch && !this._mouseDragging)
15368
- this.setupAndDispatchEvent(this._mouseOver, this._mouseMoveEvent, collision);
15369
- else if (this._mouseDragging && this._mouseDragCollision &&
15370
- this._mouseDragCollision.rootNode == collisionNode)
15351
+ this.setupAndDispatchEvent(this._mouseOver, this._mouseMoveEvent, collision);
15352
+ if (this._mouseDragging)
15371
15353
  this.setupAndDispatchEvent(this._dragOver, this._mouseMoveEvent, collision);
15372
15354
  }
15373
15355
  this._prevCollision = collision;
@@ -15591,7 +15573,7 @@ var MouseManager = /** @class */ (function () {
15591
15573
  event.ctrlKey = sourceEvent.ctrlKey;
15592
15574
  event.altKey = sourceEvent.altKey;
15593
15575
  event.shiftKey = sourceEvent.shiftKey;
15594
- event.button = (sourceEvent instanceof MouseEvent) ? sourceEvent.button : 0;
15576
+ event.buttons = (sourceEvent instanceof MouseEvent) ? sourceEvent.buttons : 0;
15595
15577
  this._queuedEvents.push(event);
15596
15578
  };
15597
15579
  // ---------------------------------------------------------------------
@@ -15669,11 +15651,6 @@ var MouseManager = /** @class */ (function () {
15669
15651
  this.updateColliders(event);
15670
15652
  this.queueDispatch(this._mouseOver, event);
15671
15653
  };
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
15654
  MouseManager.prototype.onDoubleClick = function (event) {
15678
15655
  !MouseManager.inputRecorder || MouseManager.inputRecorder.recordEvent(event);
15679
15656
  this.updateColliders(event);
@@ -18197,7 +18174,7 @@ var Scene = /** @class */ (function () {
18197
18174
  _awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
18198
18175
  _awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
18199
18176
 
18200
- console.debug('AwayJS - Scene - 0.13.248');
18177
+ console.debug('AwayJS - Scene - 0.13.250');
18201
18178
 
18202
18179
  exports.Timeline = Timeline;
18203
18180
  exports.ControllerBase = ControllerBase;