@awayjs/scene 0.13.246 → 0.13.248

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 (57) hide show
  1. package/bundle/awayjs-scene.umd.js +103 -223
  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 +30 -8
  13. package/dist/lib/display/DisplayObject.d.ts.map +1 -1
  14. package/dist/lib/display/DisplayObject.js +40 -10
  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 +0 -1
  22. package/dist/lib/display/MorphSprite.d.ts.map +1 -1
  23. package/dist/lib/display/MorphSprite.js +1 -19
  24. package/dist/lib/display/MovieClip.d.ts.map +1 -1
  25. package/dist/lib/display/MovieClip.js +2 -3
  26. package/dist/lib/display/Skybox.d.ts +2 -2
  27. package/dist/lib/display/Skybox.d.ts.map +1 -1
  28. package/dist/lib/display/Skybox.js +2 -2
  29. package/dist/lib/display/Sprite.d.ts +2 -20
  30. package/dist/lib/display/Sprite.d.ts.map +1 -1
  31. package/dist/lib/display/Sprite.js +24 -66
  32. package/dist/lib/display/TextField.d.ts +2 -17
  33. package/dist/lib/display/TextField.d.ts.map +1 -1
  34. package/dist/lib/display/TextField.js +13 -72
  35. package/dist/lib/display/TextSprite.d.ts +1 -2
  36. package/dist/lib/display/TextSprite.d.ts.map +1 -1
  37. package/dist/lib/display/TextSprite.js +2 -2
  38. package/dist/lib/events/MouseEvent.d.ts +3 -3
  39. package/dist/lib/events/MouseEvent.d.ts.map +1 -1
  40. package/dist/lib/events/MouseEvent.js +3 -3
  41. package/dist/lib/managers/MouseManager.d.ts.map +1 -1
  42. package/dist/lib/managers/MouseManager.js +7 -7
  43. package/index.ts +1 -1
  44. package/lib/display/Billboard.ts +3 -2
  45. package/lib/display/Camera.ts +0 -4
  46. package/lib/display/DisplayObject.ts +46 -19
  47. package/lib/display/DisplayObjectContainer.ts +6 -38
  48. package/lib/display/LineSegment.ts +3 -3
  49. package/lib/display/MorphSprite.ts +2 -26
  50. package/lib/display/MovieClip.ts +2 -2
  51. package/lib/display/Skybox.ts +3 -3
  52. package/lib/display/Sprite.ts +20 -74
  53. package/lib/display/TextField.ts +19 -83
  54. package/lib/display/TextSprite.ts +3 -4
  55. package/lib/events/MouseEvent.ts +6 -6
  56. package/lib/managers/MouseManager.ts +8 -9
  57. package/package.json +1 -1
@@ -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,8 +204,6 @@ const MNEMOS = [
204
204
  * options
205
205
  */
206
206
  export class TextField extends DisplayObjectContainer {
207
- private _isEntity: boolean = false;
208
- private _onGraphicsInvalidateDelegate: (event: AssetEvent) => void;
209
207
  private _onClipboardPasteDelegate: (event: ClipboardEvent) => void;
210
208
 
211
209
  private static _textFields: Array<TextField> = [];
@@ -423,7 +421,8 @@ export class TextField extends DisplayObjectContainer {
423
421
  this.setSelection(0, 0);
424
422
 
425
423
  this._glyphsDirty = true;
426
- this._invalidateEntity();
424
+
425
+ this.invalidate();
427
426
  }
428
427
 
429
428
  private enableInput(enable: boolean = true) {
@@ -912,24 +911,6 @@ export class TextField extends DisplayObjectContainer {
912
911
 
913
912
  }
914
913
 
915
- /**
916
- * //TODO
917
- *
918
- * @private
919
- */
920
- 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
-
930
- this.invalidate();
931
- }
932
-
933
914
  /**
934
915
  *
935
916
  * @returns {string}
@@ -1200,13 +1181,10 @@ export class TextField extends DisplayObjectContainer {
1200
1181
  this._iTextWoLineBreaks = processedText.replace(/(\r\n|\n|\\n|\r)/gm,'');
1201
1182
  this._textDirty = true;
1202
1183
  //console.log("set text", value, "on" , this);
1203
- if (this._autoSize != TextFieldAutoSize.NONE)
1204
- this.invalidate();
1205
- else
1206
- this._invalidateEntity();
1207
1184
 
1208
1185
  this.newTextFormat = this._textFormats[this._textFormats.length - 1];
1209
1186
 
1187
+ this.invalidate();
1210
1188
  }
1211
1189
 
1212
1190
  /**
@@ -1594,11 +1572,7 @@ export class TextField extends DisplayObjectContainer {
1594
1572
  this._textDirty = true;
1595
1573
 
1596
1574
  //console.log("set text", value, "on" , this);
1597
- if (this._autoSize != TextFieldAutoSize.NONE)
1598
- this.invalidate();
1599
- else
1600
- this._invalidateEntity();
1601
-
1575
+ this.invalidate();
1602
1576
  }
1603
1577
 
1604
1578
  public setLabelData(labelData: any) {
@@ -1611,11 +1585,7 @@ export class TextField extends DisplayObjectContainer {
1611
1585
  this._positionsDirty = false;
1612
1586
  this._glyphsDirty = true;
1613
1587
 
1614
- if (this._autoSize != TextFieldAutoSize.NONE)
1615
- this.invalidate();
1616
- else
1617
- this._invalidateEntity();
1618
-
1588
+ this.invalidate();
1619
1589
  }
1620
1590
 
1621
1591
  public get newTextFormat(): TextFormat {
@@ -1654,31 +1624,7 @@ export class TextField extends DisplayObjectContainer {
1654
1624
  this._textDirty = true;
1655
1625
  //this.reConstruct();
1656
1626
 
1657
- if (this._autoSize != TextFieldAutoSize.NONE)
1658
- this.invalidate();
1659
- else
1660
- this._invalidateEntity();
1661
- }
1662
-
1663
- /**
1664
- *
1665
- * @param renderer
1666
- *
1667
- * @internal
1668
- */
1669
- public _acceptTraverser(traverser: IEntityTraverser): void {
1670
- if (!this.maskMode) {
1671
- //if(!this.cursorBlinking && this._isInFocus && this.cursorShape && this._type==TextFieldType.INPUT){
1672
- // traverser[this.cursorShape.elements.traverseName](this.cursorShape);
1673
- //}
1674
- this._graphics._acceptTraverser(traverser);
1675
- //if(this.showSelection && this._isInFocus && this.bgShapeSelect){
1676
- // traverser[this.bgShapeSelect.elements.traverseName](this.bgShapeSelect);
1677
- //}
1678
- //if(this.bgShape){// && this.background){
1679
- // traverser[this.bgShape.elements.traverseName](this.bgShape);
1680
- //}
1681
- }
1627
+ this.invalidate();
1682
1628
  }
1683
1629
 
1684
1630
  /**
@@ -1768,7 +1714,7 @@ export class TextField extends DisplayObjectContainer {
1768
1714
 
1769
1715
  this._glyphsDirty = true;
1770
1716
 
1771
- this._invalidateEntity();
1717
+ this.invalidate();
1772
1718
  }
1773
1719
 
1774
1720
  private getTextColorForTextFormat(format: TextFormat) {
@@ -1843,14 +1789,12 @@ export class TextField extends DisplayObjectContainer {
1843
1789
  }
1844
1790
 
1845
1791
  public set type(value: TextFieldType) {
1846
- if (this._type == value) {
1792
+ if (this._type == value)
1847
1793
  return;
1848
- }
1794
+
1849
1795
  this._type = value;
1850
1796
  this._textDirty = true;
1851
1797
 
1852
- this._invalidateEntity();
1853
-
1854
1798
  if (value == TextFieldType.INPUT) {
1855
1799
  //this._selectable=true;
1856
1800
  this.enableInput(true);
@@ -1859,6 +1803,8 @@ export class TextField extends DisplayObjectContainer {
1859
1803
  this.enableInput(false);
1860
1804
  this.removeEventListener(KeyboardEvent.KEYDOWN, this.onKeyDelegate);
1861
1805
  }
1806
+
1807
+ this.invalidate();
1862
1808
  }
1863
1809
 
1864
1810
  /**
@@ -1960,7 +1906,6 @@ export class TextField extends DisplayObjectContainer {
1960
1906
  this.stopSelectionByMouseDelegate = (event: any) => this.stopSelectionByMouse(event);
1961
1907
  this.updateSelectionByMouseDelegate = (event: any) => this.updateSelectionByMouse(event);
1962
1908
 
1963
- this._onGraphicsInvalidateDelegate = (event: AssetEvent) => this._onGraphicsInvalidate(event);
1964
1909
  this._onClipboardPasteDelegate = (event: ClipboardEvent) => this.onClipboardPaste(event);
1965
1910
 
1966
1911
  this.cursorIntervalID = -1;
@@ -1994,7 +1939,6 @@ export class TextField extends DisplayObjectContainer {
1994
1939
  this._textFormats = [];
1995
1940
 
1996
1941
  this._graphics = Graphics.getGraphics(); //unique graphics object for each TextField
1997
- this._graphics.addEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
1998
1942
 
1999
1943
  this.mouseEnabled = this._selectable;
2000
1944
  }
@@ -2003,8 +1947,8 @@ export class TextField extends DisplayObjectContainer {
2003
1947
  //override for textfield
2004
1948
  }
2005
1949
 
2006
- public isEntity(): boolean {
2007
- return true;
1950
+ public getEntity(): IPartitionEntity {
1951
+ return this._graphics;
2008
1952
  }
2009
1953
 
2010
1954
  public clear(): void {
@@ -2754,8 +2698,6 @@ export class TextField extends DisplayObjectContainer {
2754
2698
  }
2755
2699
 
2756
2700
  }
2757
- this.updateMaskMode();
2758
-
2759
2701
  }
2760
2702
 
2761
2703
  public staticMatrix: any;
@@ -3087,10 +3029,8 @@ export class TextField extends DisplayObjectContainer {
3087
3029
 
3088
3030
  this._iText += newText;
3089
3031
  this._textDirty = true;
3090
- if (this._autoSize != TextFieldAutoSize.NONE)
3091
- this.invalidate();
3092
- else
3093
- this._invalidateEntity();
3032
+
3033
+ this.invalidate();
3094
3034
  }
3095
3035
 
3096
3036
  /**
@@ -3100,10 +3040,8 @@ export class TextField extends DisplayObjectContainer {
3100
3040
  public closeParagraph(): void {
3101
3041
  this._iText += '\n';
3102
3042
  this._textDirty = true;
3103
- if (this._autoSize != TextFieldAutoSize.NONE)
3104
- this.invalidate();
3105
- else
3106
- this._invalidateEntity();
3043
+
3044
+ this.invalidate();
3107
3045
  }
3108
3046
 
3109
3047
  /**
@@ -4003,6 +3941,4 @@ export class TextField extends DisplayObjectContainer {
4003
3941
  }
4004
3942
  }
4005
3943
 
4006
- }
4007
-
4008
- PartitionBase.registerAbstraction(EntityNode, TextField);
3944
+ }
@@ -1,7 +1,7 @@
1
1
  import { Sprite } from './Sprite';
2
2
  import { TextField } from './TextField';
3
3
  import { TesselatedFontTable } from '../text/TesselatedFontTable';
4
- import { HierarchicalProperty, IEntityTraverser } from '@awayjs/view';
4
+ import { HierarchicalProperty } from '@awayjs/view';
5
5
 
6
6
  /**
7
7
  * TextSprite is used for masked text.
@@ -10,7 +10,8 @@ import { HierarchicalProperty, IEntityTraverser } from '@awayjs/view';
10
10
  export class TextSprite extends Sprite {
11
11
  public parentTextField: TextField;
12
12
 
13
- public _acceptTraverser(traverser: IEntityTraverser): void {
13
+ public _iInternalUpdate(): void {
14
+ super._iInternalUpdate();
14
15
  const tf: TextField = this.parentTextField;
15
16
  //tf.reConstruct(true);
16
17
 
@@ -18,7 +19,5 @@ export class TextSprite extends Sprite {
18
19
  this.transform.colorTransform.color = (tf.textColor != null) ? tf.textColor : tf._textFormat.color;
19
20
  this._invalidateHierarchicalProperty(HierarchicalProperty.COLOR_TRANSFORM);
20
21
  }
21
-
22
- this._graphics._acceptTraverser(traverser);
23
22
  }
24
23
  }
@@ -1,6 +1,6 @@
1
1
  import { Point, Vector3D, EventBase } from '@awayjs/core';
2
2
 
3
- import { EntityNode, ContainerNode, INode, ITraversable, View, IPartitionContainer } from '@awayjs/view';
3
+ import { ContainerNode, INode, ITraversable, View, IPartitionContainer } from '@awayjs/view';
4
4
 
5
5
  import { IMaterial } from '@awayjs/renderer';
6
6
  import FrameScriptManager from '../managers/FrameScriptManager';
@@ -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.248",
4
4
  "description": "AwayJS scene classes",
5
5
  "main": "bundle/awayjs-scene.umd.js",
6
6
  "module": "dist/index.js",