@awayjs/scene 0.13.275 → 0.13.277

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- console.debug('AwayJS - Scene - 0.13.275');
1
+ console.debug('AwayJS - Scene - 0.13.277');
2
2
  export { Timeline } from './lib/base/Timeline';
3
3
  export { ControllerBase } from './lib/controllers/ControllerBase';
4
4
  export { FirstPersonController } from './lib/controllers/FirstPersonController';
@@ -14,8 +14,6 @@ export declare class MouseManager {
14
14
  private _pickerLookup;
15
15
  private _pointerDataArray;
16
16
  private _updateDirty;
17
- private _mouseDragCollision;
18
- private _mouseDragging;
19
17
  private _focusNode;
20
18
  allowKeyInput: boolean;
21
19
  private _eventBubbling;
@@ -34,7 +32,7 @@ export declare class MouseManager {
34
32
  private _focusOut;
35
33
  private _useSoftkeyboard;
36
34
  private _isAVM1Dragging;
37
- startDragObject(collision?: PickingCollision): void;
35
+ startDragObject(collision?: PickingCollision, isAVM1Dragging?: boolean): void;
38
36
  stopDragObject(): void;
39
37
  get showCursor(): boolean;
40
38
  set showCursor(value: boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"MouseManager.d.ts","sourceRoot":"","sources":["../../../lib/managers/MouseManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM9E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;GAGG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAe;IACvC,OAAc,aAAa,EAAE,cAAc,CAAC;IAE5C,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoC;IA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AU,GAAG,IAAI;IAUtC,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAkBjD,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAkB/C,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAK5C,OAAO,CAAC,eAAe;CAyBvB"}
@@ -39,7 +39,6 @@ var MouseManager = /** @class */ (function () {
39
39
  this.onKeyDown = this.onKeyDown.bind(this);
40
40
  this.onKeyUp = this.onKeyUp.bind(this);
41
41
  this._showCursor = true;
42
- this._mouseDragging = false;
43
42
  //register stage
44
43
  var container = this._stage.container;
45
44
  container.addEventListener('touchstart', this.onMouseDown);
@@ -56,11 +55,12 @@ var MouseManager = /** @class */ (function () {
56
55
  // supress context menu
57
56
  container.addEventListener('contextmenu', function (e) { return e.preventDefault(); });
58
57
  }
59
- MouseManager.prototype.startDragObject = function (collision) {
60
- this._isAVM1Dragging = true;
58
+ MouseManager.prototype.startDragObject = function (collision, isAVM1Dragging) {
59
+ if (isAVM1Dragging === void 0) { isAVM1Dragging = false; }
60
+ this._isAVM1Dragging = isAVM1Dragging;
61
61
  // we MUST overrider collision target if present, because draggable !== drag emitter
62
62
  if (collision)
63
- this._mouseDragCollision = collision;
63
+ this._pointerDataArray[0].dragCollision = collision;
64
64
  };
65
65
  MouseManager.prototype.stopDragObject = function () {
66
66
  this._isAVM1Dragging = false;
@@ -216,7 +216,7 @@ var MouseManager = /** @class */ (function () {
216
216
  }
217
217
  };
218
218
  MouseManager.prototype._fireMouseEventsInternal = function (pointerData, forcePicker) {
219
- var _a, _b;
219
+ var _a, _b, _c;
220
220
  if (forcePicker === void 0) { forcePicker = null; }
221
221
  var collision;
222
222
  if (forcePicker) {
@@ -235,7 +235,6 @@ var MouseManager = /** @class */ (function () {
235
235
  dispatcher = collision === null || collision === void 0 ? void 0 : collision.rootNode;
236
236
  this.setUpEvent(event, pointerData, collision);
237
237
  if (event.type == pointerData.down.type) {
238
- this._mouseDragging = true;
239
238
  // no event-bubbling. dispatch on stage first
240
239
  if (!this._eventBubbling)
241
240
  this._stage.dispatchEvent(event);
@@ -245,14 +244,14 @@ var MouseManager = /** @class */ (function () {
245
244
  if (!pointerData.isMouse)
246
245
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
247
246
  if (pointerData.id == 0)
248
- this._mouseDragCollision = collision;
247
+ pointerData.dragCollision = collision;
249
248
  if (dispatcher)
250
249
  this.dispatchEvent(event, dispatcher);
251
250
  else if (this._eventBubbling)
252
251
  this._stage.dispatchEvent(event);
253
- if (this._mouseDragCollision) {
254
- this.setFocus((_a = this._mouseDragCollision) === null || _a === void 0 ? void 0 : _a.rootNode);
255
- this.setupAndDispatchEvent(this._dragStart, pointerData, this._mouseDragCollision);
252
+ if (pointerData.dragCollision) {
253
+ this.setFocus(pointerData.dragCollision.rootNode);
254
+ this.setupAndDispatchEvent(this._dragStart, pointerData, pointerData.dragCollision);
256
255
  }
257
256
  }
258
257
  else if (event.type == pointerData.up.type) {
@@ -263,25 +262,23 @@ var MouseManager = /** @class */ (function () {
263
262
  // so we need to recheck the collision ?
264
263
  var upContainerNode = null;
265
264
  var upRootNode = null;
266
- if (this._isAVM1Dragging && this._mouseDragCollision) {
265
+ if (this._isAVM1Dragging && pointerData.dragCollision) {
267
266
  // avm1dragging is in process, dispatch the mouse-up on this.
268
267
  // mouseDragEntity instead of the current collision
269
- upRootNode = this._mouseDragCollision.rootNode;
270
- upContainerNode = this._mouseDragCollision.containerNode;
268
+ upRootNode = pointerData.dragCollision.rootNode;
269
+ upContainerNode = pointerData.dragCollision.containerNode;
271
270
  }
272
- else if (this._mouseDragging && this._mouseDragCollision
273
- && this._mouseDragCollision.rootNode != dispatcher) {
271
+ else if (pointerData.dragCollision && pointerData.dragCollision.rootNode != dispatcher) {
274
272
  // no avm1dragging is in process, but current collision
275
273
  // is not the same as collision that appeared on mouse-down,
276
274
  // need to dispatch a MOUSE_UP_OUTSIDE after mouse up
277
275
  }
278
- else if (this._mouseDragging && this._mouseDragCollision
279
- && this._mouseDragCollision.rootNode == dispatcher) {
276
+ else if (pointerData.dragCollision && pointerData.dragCollision.rootNode == dispatcher) {
280
277
  // no avm1dragging is in process,
281
278
  // current collision is the same as collision that appeared on
282
279
  // mouse-down, need to dispatch a MOUSE_CLICK event after mouse up
283
- upRootNode = this._mouseDragCollision.rootNode;
284
- upContainerNode = this._mouseDragCollision.containerNode;
280
+ upRootNode = pointerData.dragCollision.rootNode;
281
+ upContainerNode = pointerData.dragCollision.containerNode;
285
282
  }
286
283
  if (upRootNode)
287
284
  this.dispatchEvent(event, upRootNode);
@@ -291,14 +288,13 @@ var MouseManager = /** @class */ (function () {
291
288
  this._stage.dispatchEvent(event);
292
289
  if (upContainerNode) {
293
290
  if (!this._isAVM1Dragging)
294
- this.setupAndDispatchEvent(pointerData.click, pointerData, this._mouseDragCollision);
295
- this.setupAndDispatchEvent(this._dragStop, pointerData, this._mouseDragCollision);
291
+ this.setupAndDispatchEvent(pointerData.click, pointerData, pointerData.dragCollision);
292
+ this.setupAndDispatchEvent(this._dragStop, pointerData, pointerData.dragCollision);
296
293
  }
297
- else if (this._mouseDragging && this._mouseDragCollision) {
298
- this.setupAndDispatchEvent(pointerData.upOutside, pointerData, this._mouseDragCollision);
294
+ else if (pointerData.dragCollision) {
295
+ this.setupAndDispatchEvent(pointerData.upOutside, pointerData, pointerData.dragCollision);
299
296
  }
300
- this._mouseDragCollision = null;
301
- this._mouseDragging = false;
297
+ pointerData.dragCollision = null;
302
298
  this._isAVM1Dragging = false;
303
299
  //make sure to clear old touch references when no longer needed
304
300
  if (pointerData.id != 0)
@@ -311,8 +307,8 @@ var MouseManager = /** @class */ (function () {
311
307
  // fire to picker
312
308
  if (dispatcher)
313
309
  this.dispatchEvent(event, dispatcher);
314
- if (this._mouseDragCollision)
315
- this.setupAndDispatchEvent(this._dragMove, pointerData, this._mouseDragCollision);
310
+ if (pointerData.dragCollision)
311
+ this.setupAndDispatchEvent(this._dragMove, pointerData, pointerData.dragCollision);
316
312
  // if bubbling is exist, fire to stage late
317
313
  if (this._eventBubbling)
318
314
  this._stage.dispatchEvent(event);
@@ -326,7 +322,7 @@ var MouseManager = /** @class */ (function () {
326
322
  pointerData.rollOut.commonAncestor = null;
327
323
  pointerData.rollOver.commonAncestor = null;
328
324
  var collisionNode = collision === null || collision === void 0 ? void 0 : collision.rootNode;
329
- var prevCollisionNode = (_b = pointerData.prevCollision) === null || _b === void 0 ? void 0 : _b.rootNode;
325
+ var prevCollisionNode = (_a = pointerData.prevCollision) === null || _a === void 0 ? void 0 : _a.rootNode;
330
326
  if (collisionNode != prevCollisionNode) {
331
327
  // If colliding object has changed, queue OVER and OUT events.
332
328
  // If the mouse is dragged (mouse-down is hold), use DRAG_OVER and DRAG_OUT as well as MOUSE_OVER MOUSE_OUT
@@ -335,8 +331,7 @@ var MouseManager = /** @class */ (function () {
335
331
  // Store the info if the collision is a enabled Button (_collisionIsEnabledButton)
336
332
  if (prevCollisionNode) {
337
333
  this.setupAndDispatchEvent(pointerData.out, pointerData, pointerData.prevCollision);
338
- if (this._mouseDragging && this._mouseDragCollision
339
- && this._mouseDragCollision.rootNode == prevCollisionNode)
334
+ if (((_b = pointerData.dragCollision) === null || _b === void 0 ? void 0 : _b.rootNode) == prevCollisionNode)
340
335
  this.setupAndDispatchEvent(this._dragOut, pointerData, pointerData.prevCollision);
341
336
  }
342
337
  if (!prevCollisionNode && collisionNode) {
@@ -377,7 +372,7 @@ var MouseManager = /** @class */ (function () {
377
372
  pointerData.collisionIsEnabledButton = collisionNode ? collisionNode.buttonEnabled : false;
378
373
  if (collisionNode) {
379
374
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
380
- if (this._mouseDragging)
375
+ if (pointerData.dragCollision)
381
376
  this.setupAndDispatchEvent(this._dragOver, pointerData, collision);
382
377
  }
383
378
  pointerData.prevCollision = collision;
@@ -390,13 +385,13 @@ var MouseManager = /** @class */ (function () {
390
385
  if (pointerData.collisionIsEnabledButton != isActiveButton && isActiveButton) {
391
386
  if (pointerData.isMouse)
392
387
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
393
- else if (this._mouseDragCollision && this._mouseDragCollision.rootNode == collisionNode)
388
+ else if (((_c = pointerData.dragCollision) === null || _c === void 0 ? void 0 : _c.rootNode) == collisionNode)
394
389
  this.setupAndDispatchEvent(this._dragOver, pointerData, collision);
395
390
  }
396
391
  pointerData.collisionIsEnabledButton = isActiveButton;
397
392
  }
398
393
  // set cursor if not dragging mouse ???
399
- if (!this._mouseDragging) {
394
+ if (!pointerData.dragCollision) {
400
395
  this.cursorType = collisionNode ? collisionNode.container.getMouseCursor() : 'auto';
401
396
  }
402
397
  this._updateDirty = false;
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- console.debug('AwayJS - Scene - 0.13.275');
1
+ console.debug('AwayJS - Scene - 0.13.277');
2
2
 
3
3
  export { IDisplayObjectAdapter } from './lib/adapters/IDisplayObjectAdapter';
4
4
  export { IMovieClipAdapter } from './lib/adapters/IMovieClipAdapter';
@@ -27,8 +27,6 @@ export class MouseManager {
27
27
 
28
28
  private _updateDirty: boolean;
29
29
 
30
- private _mouseDragCollision: PickingCollision; // entity hit on mouse-down
31
- private _mouseDragging: boolean; // true while mosue is dragged
32
30
  private _focusNode: ContainerNode; // entity currently in focus
33
31
 
34
32
  public allowKeyInput: boolean=true;
@@ -84,12 +82,12 @@ export class MouseManager {
84
82
 
85
83
  private _isAVM1Dragging: Boolean = false;
86
84
 
87
- public startDragObject(collision?: PickingCollision) {
88
- this._isAVM1Dragging = true;
85
+ public startDragObject(collision?: PickingCollision, isAVM1Dragging: boolean = false) {
86
+ this._isAVM1Dragging = isAVM1Dragging;
89
87
 
90
88
  // we MUST overrider collision target if present, because draggable !== drag emitter
91
89
  if (collision)
92
- this._mouseDragCollision = collision;
90
+ this._pointerDataArray[0].dragCollision = collision;
93
91
  }
94
92
 
95
93
  public stopDragObject() {
@@ -138,7 +136,6 @@ export class MouseManager {
138
136
  this.onKeyUp = this.onKeyUp.bind(this);
139
137
 
140
138
  this._showCursor = true;
141
- this._mouseDragging = false;
142
139
 
143
140
  //register stage
144
141
  const container = this._stage.container;
@@ -318,8 +315,6 @@ export class MouseManager {
318
315
  this.setUpEvent(event, pointerData, collision);
319
316
 
320
317
  if (event.type == pointerData.down.type) {
321
- this._mouseDragging = true;
322
-
323
318
  // no event-bubbling. dispatch on stage first
324
319
  if (!this._eventBubbling)
325
320
  this._stage.dispatchEvent(event);
@@ -332,16 +327,16 @@ export class MouseManager {
332
327
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
333
328
 
334
329
  if (pointerData.id == 0)
335
- this._mouseDragCollision = collision;
330
+ pointerData.dragCollision = collision;
336
331
 
337
332
  if (dispatcher)
338
333
  this.dispatchEvent(event, dispatcher);
339
334
  else if (this._eventBubbling)
340
335
  this._stage.dispatchEvent(event);
341
336
 
342
- if (this._mouseDragCollision) {
343
- this.setFocus(this._mouseDragCollision?.rootNode);
344
- this.setupAndDispatchEvent(this._dragStart, pointerData, this._mouseDragCollision);
337
+ if (pointerData.dragCollision) {
338
+ this.setFocus(pointerData.dragCollision.rootNode);
339
+ this.setupAndDispatchEvent(this._dragStart, pointerData, pointerData.dragCollision);
345
340
  }
346
341
 
347
342
  } else if (event.type == pointerData.up.type) {
@@ -355,23 +350,21 @@ export class MouseManager {
355
350
 
356
351
  let upContainerNode: ContainerNode = null;
357
352
  let upRootNode: ContainerNode = null;
358
- if (this._isAVM1Dragging && this._mouseDragCollision) {
353
+ if (this._isAVM1Dragging && pointerData.dragCollision) {
359
354
  // avm1dragging is in process, dispatch the mouse-up on this.
360
355
  // mouseDragEntity instead of the current collision
361
- upRootNode = this._mouseDragCollision.rootNode;
362
- upContainerNode = this._mouseDragCollision.containerNode;
363
- } else if (this._mouseDragging && this._mouseDragCollision
364
- && this._mouseDragCollision.rootNode != dispatcher) {
356
+ upRootNode = pointerData.dragCollision.rootNode;
357
+ upContainerNode = pointerData.dragCollision.containerNode;
358
+ } else if (pointerData.dragCollision && pointerData.dragCollision.rootNode != dispatcher) {
365
359
  // no avm1dragging is in process, but current collision
366
360
  // is not the same as collision that appeared on mouse-down,
367
361
  // need to dispatch a MOUSE_UP_OUTSIDE after mouse up
368
- } else if (this._mouseDragging && this._mouseDragCollision
369
- && this._mouseDragCollision.rootNode == dispatcher) {
362
+ } else if (pointerData.dragCollision && pointerData.dragCollision.rootNode == dispatcher) {
370
363
  // no avm1dragging is in process,
371
364
  // current collision is the same as collision that appeared on
372
365
  // mouse-down, need to dispatch a MOUSE_CLICK event after mouse up
373
- upRootNode = this._mouseDragCollision.rootNode;
374
- upContainerNode = this._mouseDragCollision.containerNode;
366
+ upRootNode = pointerData.dragCollision.rootNode;
367
+ upContainerNode = pointerData.dragCollision.containerNode;
375
368
  }
376
369
 
377
370
  if (upRootNode)
@@ -383,14 +376,13 @@ export class MouseManager {
383
376
 
384
377
  if (upContainerNode) {
385
378
  if (!this._isAVM1Dragging)
386
- this.setupAndDispatchEvent(pointerData.click, pointerData, this._mouseDragCollision);
387
- this.setupAndDispatchEvent(this._dragStop, pointerData, this._mouseDragCollision);
388
- } else if (this._mouseDragging && this._mouseDragCollision) {
389
- this.setupAndDispatchEvent(pointerData.upOutside, pointerData, this._mouseDragCollision);
379
+ this.setupAndDispatchEvent(pointerData.click, pointerData, pointerData.dragCollision);
380
+ this.setupAndDispatchEvent(this._dragStop, pointerData, pointerData.dragCollision);
381
+ } else if (pointerData.dragCollision) {
382
+ this.setupAndDispatchEvent(pointerData.upOutside, pointerData, pointerData.dragCollision);
390
383
  }
391
384
 
392
- this._mouseDragCollision = null;
393
- this._mouseDragging = false;
385
+ pointerData.dragCollision = null;
394
386
  this._isAVM1Dragging = false;
395
387
 
396
388
  //make sure to clear old touch references when no longer needed
@@ -407,8 +399,8 @@ export class MouseManager {
407
399
  if (dispatcher)
408
400
  this.dispatchEvent(event, dispatcher);
409
401
 
410
- if (this._mouseDragCollision)
411
- this.setupAndDispatchEvent(this._dragMove, pointerData, this._mouseDragCollision);
402
+ if (pointerData.dragCollision)
403
+ this.setupAndDispatchEvent(this._dragMove, pointerData, pointerData.dragCollision);
412
404
 
413
405
  // if bubbling is exist, fire to stage late
414
406
  if (this._eventBubbling)
@@ -440,8 +432,7 @@ export class MouseManager {
440
432
  if (prevCollisionNode) {
441
433
  this.setupAndDispatchEvent(pointerData.out, pointerData, pointerData.prevCollision);
442
434
 
443
- if (this._mouseDragging && this._mouseDragCollision
444
- && this._mouseDragCollision.rootNode == prevCollisionNode)
435
+ if (pointerData.dragCollision?.rootNode == prevCollisionNode)
445
436
  this.setupAndDispatchEvent(this._dragOut, pointerData, pointerData.prevCollision);
446
437
  }
447
438
 
@@ -488,7 +479,7 @@ export class MouseManager {
488
479
  if (collisionNode) {
489
480
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
490
481
 
491
- if (this._mouseDragging)
482
+ if (pointerData.dragCollision)
492
483
  this.setupAndDispatchEvent(this._dragOver, pointerData, collision);
493
484
  }
494
485
 
@@ -502,7 +493,7 @@ export class MouseManager {
502
493
  if (pointerData.collisionIsEnabledButton != isActiveButton && isActiveButton) {
503
494
  if (pointerData.isMouse)
504
495
  this.setupAndDispatchEvent(pointerData.over, pointerData, collision);
505
- else if (this._mouseDragCollision && this._mouseDragCollision.rootNode == collisionNode)
496
+ else if (pointerData.dragCollision?.rootNode == collisionNode)
506
497
  this.setupAndDispatchEvent(this._dragOver, pointerData, collision);
507
498
  }
508
499
 
@@ -510,7 +501,7 @@ export class MouseManager {
510
501
  }
511
502
 
512
503
  // set cursor if not dragging mouse ???
513
- if (!this._mouseDragging) {
504
+ if (!pointerData.dragCollision) {
514
505
  this.cursorType = collisionNode ? <any>collisionNode.container.getMouseCursor() : 'auto';
515
506
  }
516
507
 
@@ -937,6 +928,8 @@ class PointerData {
937
928
 
938
929
  prevCollision: PickingCollision;
939
930
 
931
+ dragCollision: PickingCollision;
932
+
940
933
  collisionIsEnabledButton: boolean = false;
941
934
 
942
935
  queuedEvents: Array<PointerEvent> = new Array<PointerEvent>();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awayjs/scene",
3
- "version": "0.13.275",
3
+ "version": "0.13.277",
4
4
  "description": "AwayJS scene classes",
5
5
  "main": "bundle/awayjs-scene.umd.js",
6
6
  "module": "dist/index.js",