@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.
@@ -112,7 +112,6 @@ export class MouseManager {
112
112
  */
113
113
  constructor(stage: Stage) {
114
114
  this._stage = stage;
115
- this.onClick = this.onClick.bind(this);
116
115
  this.onDoubleClick = this.onDoubleClick.bind(this);
117
116
  this.onMouseDown = this.onMouseDown.bind(this);
118
117
  this.onMouseMove = this.onMouseMove.bind(this);
@@ -130,8 +129,6 @@ export class MouseManager {
130
129
 
131
130
  //register stage
132
131
  const container = this._stage.container;
133
- container.addEventListener('click', this.onClick);
134
- container.addEventListener('dblclick', this.onClick);
135
132
  container.addEventListener('touchstart', this.onMouseDown);
136
133
  container.addEventListener('mousedown', this.onMouseDown);
137
134
 
@@ -140,7 +137,6 @@ export class MouseManager {
140
137
  window.addEventListener('mouseup', this.onMouseUp);
141
138
 
142
139
  container.addEventListener('touchend', this.onMouseUp);
143
- container.addEventListener('touchend', this.onClick);
144
140
  container.addEventListener('mousewheel', this.onMouseWheel);
145
141
  container.addEventListener('mouseover', this.onMouseOver);
146
142
  container.addEventListener('mouseout', this.onMouseOut);
@@ -174,7 +170,6 @@ export class MouseManager {
174
170
  public dispose() {
175
171
  //unregister stage
176
172
  const container = this._stage.container;
177
- container.removeEventListener('click', this.onClick);
178
173
  container.removeEventListener('dblclick', this.onDoubleClick);
179
174
  container.removeEventListener('touchstart', this.onMouseDown);
180
175
  container.removeEventListener('mousedown', this.onMouseDown);
@@ -182,7 +177,6 @@ export class MouseManager {
182
177
  window.removeEventListener('mousemove', this.onMouseMove);
183
178
  window.removeEventListener('mouseup', this.onMouseUp);
184
179
  container.removeEventListener('touchend', this.onMouseUp);
185
- container.removeEventListener('touchend', this.onClick);
186
180
  container.removeEventListener('wheel', this.onMouseWheel);
187
181
  container.removeEventListener('mouseover', this.onMouseOver);
188
182
  container.removeEventListener('mouseout', this.onMouseOut);
@@ -279,6 +273,7 @@ export class MouseManager {
279
273
  event.ctrlKey = sourceEvent.ctrlKey;
280
274
  event.altKey = sourceEvent.altKey;
281
275
  event.shiftKey = sourceEvent.shiftKey;
276
+ event.buttons = sourceEvent.buttons;
282
277
  }
283
278
 
284
279
  event = this.setUpEvent(event, collision, commonAncestor);
@@ -358,27 +353,16 @@ export class MouseManager {
358
353
  && this._mouseDragCollision.rootNode != dispatcher) {
359
354
  // no avm1dragging is in process, but current collision
360
355
  // is not the same as collision that appeared on mouse-down,
361
- // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
362
- if ((<any> this._mouseDragCollision.rootNode).buttonEnabled)
363
- this.setupAndDispatchEvent(this._mouseOut, event, this._mouseDragCollision);
364
- if (!this._eventBubbling) {
365
- this.setupAndDispatchEvent(this._mouseUpOutside, event, this._mouseDragCollision);
366
- }
356
+ // need to dispatch a MOUSE_UP_OUTSIDE after mouse up
367
357
  } else if (this._mouseDragging && this._mouseDragCollision
368
358
  && this._mouseDragCollision.rootNode == dispatcher) {
369
359
  // no avm1dragging is in process,
370
- // but current collision is not the same as collision that appeared on mouse-down,
371
- // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
360
+ // current collision is the same as collision that appeared on
361
+ // mouse-down, need to dispatch a MOUSE_CLICK event after mouse up
372
362
  upRootNode = this._mouseDragCollision.rootNode;
373
363
  upContainerNode = this._mouseDragCollision.containerNode;
374
364
  }
375
365
 
376
- if (this._mouseDragging && dispatcher)
377
- this.setupAndDispatchEvent(this._mouseOver, event, collision);
378
-
379
- if (this._isTouch && upContainerNode)
380
- this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._mouseDragCollision);
381
-
382
366
  if (upRootNode) {
383
367
  //console.log("onRelease", upRootNode)
384
368
  this.dispatchEvent(event, upRootNode);
@@ -387,8 +371,13 @@ export class MouseManager {
387
371
  else if (this._eventBubbling)
388
372
  this._stage.dispatchEvent(event);
389
373
 
390
- if (upContainerNode)
374
+ if (upContainerNode) {
375
+ if (!this._isAVM1Dragging)
376
+ this.setupAndDispatchEvent(this._mouseClick, this._isTouch ? this._mouseMoveEvent : event, this._mouseDragCollision);
391
377
  this.setupAndDispatchEvent(this._dragStop, event, this._mouseDragCollision);
378
+ } else if (this._mouseDragging && this._mouseDragCollision) {
379
+ this.setupAndDispatchEvent(this._mouseUpOutside, event, this._mouseDragCollision);
380
+ }
392
381
 
393
382
  this._mouseDragCollision = null;
394
383
  this._mouseDragging = false;
@@ -432,16 +421,16 @@ export class MouseManager {
432
421
  if (collisionNode != prevCollisionNode) {
433
422
 
434
423
  // If colliding object has changed, queue OVER and OUT events.
435
- // If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT instead of MOUSE_OVER MOUSE_OUT
424
+ // If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT as well as MOUSE_OVER MOUSE_OUT
436
425
  // DRAG_OVER and DRAG_OUT are only dispatched on the object that was hit on the mouse-down
437
426
  // (_mouseDragEntity)
438
427
 
439
428
  // Store the info if the collision is a enabled Button (_collisionIsEnabledButton)
440
429
 
441
430
  if (prevCollisionNode) {
442
- if (!this._isTouch && !this._mouseDragging)
443
- this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._prevCollision);
444
- else if (this._mouseDragging && this._mouseDragCollision
431
+ this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._prevCollision);
432
+
433
+ if (this._mouseDragging && this._mouseDragCollision
445
434
  && this._mouseDragCollision.rootNode == prevCollisionNode)
446
435
  this.setupAndDispatchEvent(this._dragOut, this._mouseMoveEvent, this._prevCollision);
447
436
  }
@@ -487,10 +476,9 @@ export class MouseManager {
487
476
  this._collisionIsEnabledButton = collisionNode ? (<any> collisionNode).buttonEnabled : false;
488
477
 
489
478
  if (collisionNode) {
490
- if (!this._isTouch && !this._mouseDragging)
491
- this.setupAndDispatchEvent(this._mouseOver, this._mouseMoveEvent, collision);
492
- else if (this._mouseDragging && this._mouseDragCollision &&
493
- this._mouseDragCollision.rootNode == collisionNode)
479
+ this.setupAndDispatchEvent(this._mouseOver, this._mouseMoveEvent, collision);
480
+
481
+ if (this._mouseDragging)
494
482
  this.setupAndDispatchEvent(this._dragOver, this._mouseMoveEvent, collision);
495
483
  }
496
484
 
@@ -721,7 +709,7 @@ export class MouseManager {
721
709
  event.ctrlKey = sourceEvent.ctrlKey;
722
710
  event.altKey = sourceEvent.altKey;
723
711
  event.shiftKey = sourceEvent.shiftKey;
724
- event.button = (sourceEvent instanceof MouseEvent) ? <0> sourceEvent.button : 0;
712
+ event.buttons = (sourceEvent instanceof MouseEvent) ? <0> sourceEvent.buttons : 0;
725
713
 
726
714
  this._queuedEvents.push(event);
727
715
  }
@@ -816,12 +804,6 @@ export class MouseManager {
816
804
  this.queueDispatch(this._mouseOver, event);
817
805
  }
818
806
 
819
- public onClick(event: MouseEvent): void {
820
- !MouseManager.inputRecorder || MouseManager.inputRecorder.recordEvent(event);
821
- this.updateColliders(event);
822
- this.queueDispatch(this._mouseClick, event);
823
- }
824
-
825
807
  public onDoubleClick(event: MouseEvent): void {
826
808
  !MouseManager.inputRecorder || MouseManager.inputRecorder.recordEvent(event);
827
809
  this.updateColliders(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awayjs/scene",
3
- "version": "0.13.248",
3
+ "version": "0.13.249",
4
4
  "description": "AwayJS scene classes",
5
5
  "main": "bundle/awayjs-scene.umd.js",
6
6
  "module": "dist/index.js",