@awayjs/scene 0.13.246 → 0.13.247

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.
Files changed (49) hide show
  1. package/bundle/awayjs-scene.umd.js +78 -96
  2. package/bundle/awayjs-scene.umd.js.map +1 -1
  3. package/bundle/awayjs-scene.umd.min.js.map +1 -1
  4. package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/lib/display/Billboard.d.ts +2 -2
  7. package/dist/lib/display/Billboard.d.ts.map +1 -1
  8. package/dist/lib/display/Billboard.js +2 -2
  9. package/dist/lib/display/Camera.d.ts +0 -1
  10. package/dist/lib/display/Camera.d.ts.map +1 -1
  11. package/dist/lib/display/Camera.js +0 -3
  12. package/dist/lib/display/DisplayObject.d.ts +31 -7
  13. package/dist/lib/display/DisplayObject.d.ts.map +1 -1
  14. package/dist/lib/display/DisplayObject.js +41 -7
  15. package/dist/lib/display/DisplayObjectContainer.d.ts +2 -24
  16. package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
  17. package/dist/lib/display/DisplayObjectContainer.js +5 -37
  18. package/dist/lib/display/LineSegment.d.ts +2 -2
  19. package/dist/lib/display/LineSegment.d.ts.map +1 -1
  20. package/dist/lib/display/LineSegment.js +2 -2
  21. package/dist/lib/display/MorphSprite.d.ts.map +1 -1
  22. package/dist/lib/display/MorphSprite.js +1 -3
  23. package/dist/lib/display/Skybox.d.ts +2 -2
  24. package/dist/lib/display/Skybox.d.ts.map +1 -1
  25. package/dist/lib/display/Skybox.js +2 -2
  26. package/dist/lib/display/Sprite.d.ts +2 -3
  27. package/dist/lib/display/Sprite.d.ts.map +1 -1
  28. package/dist/lib/display/Sprite.js +4 -12
  29. package/dist/lib/display/TextField.d.ts +2 -3
  30. package/dist/lib/display/TextField.d.ts.map +1 -1
  31. package/dist/lib/display/TextField.js +11 -18
  32. package/dist/lib/events/MouseEvent.d.ts +3 -3
  33. package/dist/lib/events/MouseEvent.d.ts.map +1 -1
  34. package/dist/lib/events/MouseEvent.js +3 -3
  35. package/dist/lib/managers/MouseManager.d.ts.map +1 -1
  36. package/dist/lib/managers/MouseManager.js +7 -7
  37. package/index.ts +1 -1
  38. package/lib/display/Billboard.ts +3 -2
  39. package/lib/display/Camera.ts +0 -4
  40. package/lib/display/DisplayObject.ts +48 -12
  41. package/lib/display/DisplayObjectContainer.ts +6 -38
  42. package/lib/display/LineSegment.ts +3 -3
  43. package/lib/display/MorphSprite.ts +2 -5
  44. package/lib/display/Skybox.ts +3 -3
  45. package/lib/display/Sprite.ts +5 -16
  46. package/lib/display/TextField.ts +12 -21
  47. package/lib/events/MouseEvent.ts +5 -5
  48. package/lib/managers/MouseManager.ts +8 -9
  49. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { AssetEvent, Vector3D } from '@awayjs/core';
2
- import { IEntityTraverser, PartitionBase, EntityNode } from '@awayjs/view';
2
+ import { IEntityTraverser, PartitionBase, EntityNode, IPartitionEntity } from '@awayjs/view';
3
3
  import { IMaterial } from '@awayjs/renderer';
4
4
  import { Graphics } from '@awayjs/graphics';
5
5
  import { DisplayObjectContainer } from './DisplayObjectContainer';
@@ -11,7 +11,6 @@ import { PrefabBase } from '../prefabs/PrefabBase';
11
11
  * of the graphics to be assigned different materials.
12
12
  */
13
13
  export class Sprite extends DisplayObjectContainer {
14
- private _isEntity: boolean = false;
15
14
 
16
15
  public _iSourcePrefab: PrefabBase;
17
16
 
@@ -63,9 +62,8 @@ export class Sprite extends DisplayObjectContainer {
63
62
  }
64
63
 
65
64
  protected _setGraphics(value: Graphics): void {
66
- if (this._graphics == value) {
65
+ if (this._graphics == value)
67
66
  return;
68
- }
69
67
 
70
68
  if (this._graphics) {
71
69
  this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
@@ -79,7 +77,7 @@ export class Sprite extends DisplayObjectContainer {
79
77
 
80
78
  this._graphics.usages++;
81
79
 
82
- this._onGraphicsInvalidate(null);
80
+ this.invalidate();
83
81
  }
84
82
 
85
83
  /**
@@ -115,8 +113,8 @@ export class Sprite extends DisplayObjectContainer {
115
113
  // }
116
114
  }
117
115
 
118
- public isEntity(): boolean {
119
- return (this._graphics && this._graphics.count > 0);
116
+ public getEntity(): IPartitionEntity {
117
+ return (this._graphics.count > 0) ? this : null;
120
118
  }
121
119
 
122
120
  /**
@@ -183,15 +181,6 @@ export class Sprite extends DisplayObjectContainer {
183
181
  * @private
184
182
  */
185
183
  protected _onGraphicsInvalidate(_event: AssetEvent): void {
186
- const isEntity: boolean = this.isEntity();
187
-
188
- if (this._isEntity != isEntity) {
189
- if (!isEntity)
190
- this._clearEntity();
191
-
192
- this._isEntity = isEntity;
193
- }
194
-
195
184
  this.invalidate();
196
185
  }
197
186
 
@@ -2,7 +2,7 @@ import { ColorUtils, Matrix, Rectangle, Point, Vector3D, AssetEvent } from '@awa
2
2
 
3
3
  import { ImageSampler, Float2Attributes } from '@awayjs/stage';
4
4
 
5
- import { IEntityTraverser, PartitionBase, EntityNode } from '@awayjs/view';
5
+ import { IEntityTraverser, PartitionBase, EntityNode, IPartitionEntity, PickEntity } from '@awayjs/view';
6
6
 
7
7
  import { Style, TriangleElements } from '@awayjs/renderer';
8
8
 
@@ -204,7 +204,6 @@ const MNEMOS = [
204
204
  * options
205
205
  */
206
206
  export class TextField extends DisplayObjectContainer {
207
- private _isEntity: boolean = false;
208
207
  private _onGraphicsInvalidateDelegate: (event: AssetEvent) => void;
209
208
  private _onClipboardPasteDelegate: (event: ClipboardEvent) => void;
210
209
 
@@ -423,7 +422,7 @@ export class TextField extends DisplayObjectContainer {
423
422
  this.setSelection(0, 0);
424
423
 
425
424
  this._glyphsDirty = true;
426
- this._invalidateEntity();
425
+ this._updateEntity();
427
426
  }
428
427
 
429
428
  private enableInput(enable: boolean = true) {
@@ -918,14 +917,6 @@ export class TextField extends DisplayObjectContainer {
918
917
  * @private
919
918
  */
920
919
  private _onGraphicsInvalidate(event: AssetEvent): void {
921
- const isEntity: boolean = this.isEntity();
922
-
923
- if (this._isEntity != isEntity) {
924
- if (!isEntity)
925
- this._clearEntity();
926
-
927
- this._isEntity = isEntity;
928
- }
929
920
 
930
921
  this.invalidate();
931
922
  }
@@ -1203,7 +1194,7 @@ export class TextField extends DisplayObjectContainer {
1203
1194
  if (this._autoSize != TextFieldAutoSize.NONE)
1204
1195
  this.invalidate();
1205
1196
  else
1206
- this._invalidateEntity();
1197
+ this._updateEntity();
1207
1198
 
1208
1199
  this.newTextFormat = this._textFormats[this._textFormats.length - 1];
1209
1200
 
@@ -1597,7 +1588,7 @@ export class TextField extends DisplayObjectContainer {
1597
1588
  if (this._autoSize != TextFieldAutoSize.NONE)
1598
1589
  this.invalidate();
1599
1590
  else
1600
- this._invalidateEntity();
1591
+ this._updateEntity();
1601
1592
 
1602
1593
  }
1603
1594
 
@@ -1614,7 +1605,7 @@ export class TextField extends DisplayObjectContainer {
1614
1605
  if (this._autoSize != TextFieldAutoSize.NONE)
1615
1606
  this.invalidate();
1616
1607
  else
1617
- this._invalidateEntity();
1608
+ this._updateEntity();
1618
1609
 
1619
1610
  }
1620
1611
 
@@ -1657,7 +1648,7 @@ export class TextField extends DisplayObjectContainer {
1657
1648
  if (this._autoSize != TextFieldAutoSize.NONE)
1658
1649
  this.invalidate();
1659
1650
  else
1660
- this._invalidateEntity();
1651
+ this._updateEntity();
1661
1652
  }
1662
1653
 
1663
1654
  /**
@@ -1768,7 +1759,7 @@ export class TextField extends DisplayObjectContainer {
1768
1759
 
1769
1760
  this._glyphsDirty = true;
1770
1761
 
1771
- this._invalidateEntity();
1762
+ this._updateEntity();
1772
1763
  }
1773
1764
 
1774
1765
  private getTextColorForTextFormat(format: TextFormat) {
@@ -1849,7 +1840,7 @@ export class TextField extends DisplayObjectContainer {
1849
1840
  this._type = value;
1850
1841
  this._textDirty = true;
1851
1842
 
1852
- this._invalidateEntity();
1843
+ this._updateEntity();
1853
1844
 
1854
1845
  if (value == TextFieldType.INPUT) {
1855
1846
  //this._selectable=true;
@@ -2003,8 +1994,8 @@ export class TextField extends DisplayObjectContainer {
2003
1994
  //override for textfield
2004
1995
  }
2005
1996
 
2006
- public isEntity(): boolean {
2007
- return true;
1997
+ public getEntity(): IPartitionEntity {
1998
+ return this;
2008
1999
  }
2009
2000
 
2010
2001
  public clear(): void {
@@ -3090,7 +3081,7 @@ export class TextField extends DisplayObjectContainer {
3090
3081
  if (this._autoSize != TextFieldAutoSize.NONE)
3091
3082
  this.invalidate();
3092
3083
  else
3093
- this._invalidateEntity();
3084
+ this._updateEntity();
3094
3085
  }
3095
3086
 
3096
3087
  /**
@@ -3103,7 +3094,7 @@ export class TextField extends DisplayObjectContainer {
3103
3094
  if (this._autoSize != TextFieldAutoSize.NONE)
3104
3095
  this.invalidate();
3105
3096
  else
3106
- this._invalidateEntity();
3097
+ this._updateEntity();
3107
3098
  }
3108
3099
 
3109
3100
  /**
@@ -121,9 +121,9 @@ export class MouseEvent extends EventBase {
121
121
  public view: View;
122
122
 
123
123
  /**
124
- * The entity inside which the event took place.
124
+ * The container inside which the event took place.
125
125
  */
126
- public entityNode: EntityNode;
126
+ public containerNode: ContainerNode;
127
127
 
128
128
  /**
129
129
  * The entity of the picker inside which the event took place.
@@ -241,7 +241,7 @@ export class MouseEvent extends EventBase {
241
241
  result.screenY = this.screenY;
242
242
 
243
243
  result.view = this.view;
244
- result.entityNode = this.entityNode;
244
+ result.containerNode = this.containerNode;
245
245
  result.rootNode = this.rootNode;
246
246
  result.traversable = this.traversable;
247
247
  result.material = this.material;
@@ -265,14 +265,14 @@ export class MouseEvent extends EventBase {
265
265
  * The position in scene space where the event took place
266
266
  */
267
267
  public get scenePosition(): Vector3D {
268
- return this.entityNode.parent.getMatrix3D().transformVector(this.position);
268
+ return this.containerNode.getMatrix3D().transformVector(this.position);
269
269
  }
270
270
 
271
271
  /**
272
272
  * The normal in scene space where the event took place
273
273
  */
274
274
  public get sceneNormal(): Vector3D {
275
- const sceneNormal: Vector3D = this.entityNode.parent.getMatrix3D().deltaTransformVector(this.normal);
275
+ const sceneNormal: Vector3D = this.containerNode.getMatrix3D().deltaTransformVector(this.normal);
276
276
  sceneNormal.normalize();
277
277
 
278
278
  return sceneNormal;
@@ -1,12 +1,11 @@
1
1
  import { Vector3D } from '@awayjs/core';
2
2
  import { Stage } from '@awayjs/stage';
3
3
 
4
- import { PickingCollision, RaycastPicker, ContainerNode, IPartitionContainer, EntityNode } from '@awayjs/view';
4
+ import { PickingCollision, RaycastPicker, ContainerNode } from '@awayjs/view';
5
5
  import { FocusEvent } from '../events/FocusEvent';
6
6
 
7
7
  import { KeyboardEvent } from '../events/KeyboardEvent';
8
8
  import { MouseEvent as AwayMouseEvent } from '../events/MouseEvent';
9
- import { FrameScriptManager } from './FrameScriptManager';
10
9
 
11
10
  import { IInputRecorder } from './IInputRecorder';
12
11
 
@@ -348,13 +347,13 @@ export class MouseManager {
348
347
  // @todo: at this point the object under the mouse might have been changed,
349
348
  // so we need to recheck the collision ?
350
349
 
351
- let upEntityNode: EntityNode = null;
350
+ let upContainerNode: ContainerNode = null;
352
351
  let upRootNode: ContainerNode = null;
353
352
  if (this._isAVM1Dragging && this._mouseDragCollision) {
354
353
  // avm1dragging is in process, dispatch the mouse-up on this.
355
354
  // mouseDragEntity instead of the current collision
356
355
  upRootNode = this._mouseDragCollision.rootNode;
357
- upEntityNode = this._mouseDragCollision.entityNode;
356
+ upContainerNode = this._mouseDragCollision.containerNode;
358
357
  } else if (this._mouseDragging && this._mouseDragCollision
359
358
  && this._mouseDragCollision.rootNode != dispatcher) {
360
359
  // no avm1dragging is in process, but current collision
@@ -371,13 +370,13 @@ export class MouseManager {
371
370
  // but current collision is not the same as collision that appeared on mouse-down,
372
371
  // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
373
372
  upRootNode = this._mouseDragCollision.rootNode;
374
- upEntityNode = this._mouseDragCollision.entityNode;
373
+ upContainerNode = this._mouseDragCollision.containerNode;
375
374
  }
376
375
 
377
376
  if (this._mouseDragging && dispatcher)
378
377
  this.setupAndDispatchEvent(this._mouseOver, event, collision);
379
378
 
380
- if (this._isTouch && upEntityNode)
379
+ if (this._isTouch && upContainerNode)
381
380
  this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._mouseDragCollision);
382
381
 
383
382
  if (upRootNode) {
@@ -388,7 +387,7 @@ export class MouseManager {
388
387
  else if (this._eventBubbling)
389
388
  this._stage.dispatchEvent(event);
390
389
 
391
- if (upEntityNode)
390
+ if (upContainerNode)
392
391
  this.setupAndDispatchEvent(this._dragStop, event, this._mouseDragCollision);
393
392
 
394
393
  this._mouseDragCollision = null;
@@ -688,7 +687,7 @@ export class MouseManager {
688
687
 
689
688
  // 3D properties.
690
689
  if (collision) {
691
- event.entityNode = collision.entityNode;
690
+ event.containerNode = collision.containerNode;
692
691
 
693
692
  event.rootNode = collision.rootNode;
694
693
  // Object.
@@ -703,7 +702,7 @@ export class MouseManager {
703
702
  event.elementIndex = collision.elementIndex;
704
703
  } else {
705
704
  // Set all to null.
706
- event.entityNode = null;
705
+ event.containerNode = null;
707
706
  event.rootNode = null;
708
707
  event.traversable = null;
709
708
  event.uv = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awayjs/scene",
3
- "version": "0.13.246",
3
+ "version": "0.13.247",
4
4
  "description": "AwayJS scene classes",
5
5
  "main": "bundle/awayjs-scene.umd.js",
6
6
  "module": "dist/index.js",