@awayjs/scene 0.13.245 → 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 (70) hide show
  1. package/bundle/awayjs-scene.umd.js +98 -124
  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.d.ts +0 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/base/Timeline.d.ts +4 -6
  9. package/dist/lib/base/Timeline.d.ts.map +1 -1
  10. package/dist/lib/base/Timeline.js +7 -19
  11. package/dist/lib/display/Billboard.d.ts +2 -2
  12. package/dist/lib/display/Billboard.d.ts.map +1 -1
  13. package/dist/lib/display/Billboard.js +2 -2
  14. package/dist/lib/display/Camera.d.ts +0 -1
  15. package/dist/lib/display/Camera.d.ts.map +1 -1
  16. package/dist/lib/display/Camera.js +0 -3
  17. package/dist/lib/display/DisplayObject.d.ts +31 -7
  18. package/dist/lib/display/DisplayObject.d.ts.map +1 -1
  19. package/dist/lib/display/DisplayObject.js +41 -7
  20. package/dist/lib/display/DisplayObjectContainer.d.ts +2 -24
  21. package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
  22. package/dist/lib/display/DisplayObjectContainer.js +5 -37
  23. package/dist/lib/display/LineSegment.d.ts +2 -2
  24. package/dist/lib/display/LineSegment.d.ts.map +1 -1
  25. package/dist/lib/display/LineSegment.js +2 -2
  26. package/dist/lib/display/MorphSprite.d.ts.map +1 -1
  27. package/dist/lib/display/MorphSprite.js +1 -3
  28. package/dist/lib/display/MovieClip.d.ts +2 -2
  29. package/dist/lib/display/MovieClip.d.ts.map +1 -1
  30. package/dist/lib/display/MovieClip.js +2 -5
  31. package/dist/lib/display/Skybox.d.ts +3 -2
  32. package/dist/lib/display/Skybox.d.ts.map +1 -1
  33. package/dist/lib/display/Skybox.js +3 -2
  34. package/dist/lib/display/Sprite.d.ts +2 -3
  35. package/dist/lib/display/Sprite.d.ts.map +1 -1
  36. package/dist/lib/display/Sprite.js +4 -12
  37. package/dist/lib/display/TextField.d.ts +2 -3
  38. package/dist/lib/display/TextField.d.ts.map +1 -1
  39. package/dist/lib/display/TextField.js +11 -18
  40. package/dist/lib/events/MouseEvent.d.ts +3 -3
  41. package/dist/lib/events/MouseEvent.d.ts.map +1 -1
  42. package/dist/lib/events/MouseEvent.js +3 -3
  43. package/dist/lib/factories/DefaultSceneGraphFactory.d.ts +7 -4
  44. package/dist/lib/factories/DefaultSceneGraphFactory.d.ts.map +1 -1
  45. package/dist/lib/factories/DefaultSceneGraphFactory.js +10 -4
  46. package/dist/lib/factories/ISceneGraphFactory.d.ts +7 -8
  47. package/dist/lib/factories/ISceneGraphFactory.d.ts.map +1 -1
  48. package/dist/lib/managers/MouseManager.d.ts.map +1 -1
  49. package/dist/lib/managers/MouseManager.js +7 -7
  50. package/index.ts +1 -2
  51. package/lib/base/Timeline.ts +9 -21
  52. package/lib/display/Billboard.ts +3 -2
  53. package/lib/display/Camera.ts +0 -4
  54. package/lib/display/DisplayObject.ts +48 -12
  55. package/lib/display/DisplayObjectContainer.ts +6 -38
  56. package/lib/display/LineSegment.ts +3 -3
  57. package/lib/display/MorphSprite.ts +2 -5
  58. package/lib/display/MovieClip.ts +4 -4
  59. package/lib/display/Skybox.ts +5 -3
  60. package/lib/display/Sprite.ts +5 -16
  61. package/lib/display/TextField.ts +12 -21
  62. package/lib/events/MouseEvent.ts +5 -5
  63. package/lib/factories/DefaultSceneGraphFactory.ts +12 -8
  64. package/lib/factories/ISceneGraphFactory.ts +9 -9
  65. package/lib/managers/MouseManager.ts +8 -9
  66. package/package.json +1 -1
  67. package/dist/lib/base/ISymbolDecoder.d.ts +0 -8
  68. package/dist/lib/base/ISymbolDecoder.d.ts.map +0 -1
  69. package/dist/lib/base/ISymbolDecoder.js +0 -0
  70. package/lib/base/ISymbolDecoder.ts +0 -11
@@ -283,13 +283,13 @@ var MouseManager = /** @class */ (function () {
283
283
  this._stage.dispatchEvent(event);
284
284
  // @todo: at this point the object under the mouse might have been changed,
285
285
  // so we need to recheck the collision ?
286
- var upEntityNode = null;
286
+ var upContainerNode = null;
287
287
  var upRootNode = null;
288
288
  if (this._isAVM1Dragging && this._mouseDragCollision) {
289
289
  // avm1dragging is in process, dispatch the mouse-up on this.
290
290
  // mouseDragEntity instead of the current collision
291
291
  upRootNode = this._mouseDragCollision.rootNode;
292
- upEntityNode = this._mouseDragCollision.entityNode;
292
+ upContainerNode = this._mouseDragCollision.containerNode;
293
293
  }
294
294
  else if (this._mouseDragging && this._mouseDragCollision
295
295
  && this._mouseDragCollision.rootNode != dispatcher) {
@@ -308,11 +308,11 @@ var MouseManager = /** @class */ (function () {
308
308
  // but current collision is not the same as collision that appeared on mouse-down,
309
309
  // need to dispatch a MOUSE_UP_OUTSIDE on _mouseDragEntity
310
310
  upRootNode = this._mouseDragCollision.rootNode;
311
- upEntityNode = this._mouseDragCollision.entityNode;
311
+ upContainerNode = this._mouseDragCollision.containerNode;
312
312
  }
313
313
  if (this._mouseDragging && dispatcher)
314
314
  this.setupAndDispatchEvent(this._mouseOver, event, collision);
315
- if (this._isTouch && upEntityNode)
315
+ if (this._isTouch && upContainerNode)
316
316
  this.setupAndDispatchEvent(this._mouseOut, this._mouseMoveEvent, this._mouseDragCollision);
317
317
  if (upRootNode) {
318
318
  //console.log("onRelease", upRootNode)
@@ -322,7 +322,7 @@ var MouseManager = /** @class */ (function () {
322
322
  this.dispatchEvent(event, dispatcher);
323
323
  else if (this._eventBubbling)
324
324
  this._stage.dispatchEvent(event);
325
- if (upEntityNode)
325
+ if (upContainerNode)
326
326
  this.setupAndDispatchEvent(this._dragStop, event, this._mouseDragCollision);
327
327
  this._mouseDragCollision = null;
328
328
  this._mouseDragging = false;
@@ -600,7 +600,7 @@ var MouseManager = /** @class */ (function () {
600
600
  //console.log("event", event, collisionNode, collisionNode);
601
601
  // 3D properties.
602
602
  if (collision) {
603
- event.entityNode = collision.entityNode;
603
+ event.containerNode = collision.containerNode;
604
604
  event.rootNode = collision.rootNode;
605
605
  // Object.
606
606
  event.traversable = collision.traversable;
@@ -615,7 +615,7 @@ var MouseManager = /** @class */ (function () {
615
615
  }
616
616
  else {
617
617
  // Set all to null.
618
- event.entityNode = null;
618
+ event.containerNode = null;
619
619
  event.rootNode = null;
620
620
  event.traversable = null;
621
621
  event.uv = null;
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- console.debug('AwayJS - Scene - 0.13.245');
1
+ console.debug('AwayJS - Scene - 0.13.247');
2
2
 
3
3
  export { IDisplayObjectAdapter } from './lib/adapters/IDisplayObjectAdapter';
4
4
  export { IMovieClipAdapter } from './lib/adapters/IMovieClipAdapter';
@@ -6,7 +6,6 @@ export { IFilter } from './lib/adapters/IFilter';
6
6
 
7
7
  export { IBitmapDrawable } from './lib/base/IBitmapDrawable';
8
8
  export { IFrameScript } from './lib/base/IFrameScript';
9
- export { ISymbolDecoder } from './lib/base/ISymbolDecoder';
10
9
  export { Timeline } from './lib/base/Timeline';
11
10
  export { TimelineActionType } from './lib/base/TimelineActionType';
12
11
 
@@ -1,19 +1,20 @@
1
1
  import { WaveAudio, ColorTransform, IAsset, Matrix3D } from '@awayjs/core';
2
+ import { BlendMode } from '@awayjs/stage';
3
+ import { HierarchicalProperty } from '@awayjs/view';
2
4
  import { Graphics } from '@awayjs/graphics';
5
+
3
6
  import { IDisplayObjectAdapter } from '../adapters/IDisplayObjectAdapter';
7
+ import { IFilter } from '../adapters/IFilter';
4
8
  import { IMovieClipAdapter } from '../adapters/IMovieClipAdapter';
5
9
  import { MovieClip } from '../display/MovieClip';
6
10
  import { Sprite } from '../display/Sprite';
7
11
  import { MorphSprite } from '../display/MorphSprite';
8
12
  import { DisplayObject } from '../display/DisplayObject';
9
13
  import { DisplayObjectContainer } from '../display/DisplayObjectContainer';
14
+ import { ISceneGraphFactory } from '../factories/ISceneGraphFactory';
10
15
  import { IFrameLabel } from './IFrameLabel';
11
16
  import { TimelineActionType as AType } from './TimelineActionType';
12
- import { IFilter } from '../adapters/IFilter';
13
- import { BlendMode } from '@awayjs/stage';
14
- import { ISymbolDecoder } from './ISymbolDecoder';
15
17
  import { IFrameScript } from './IFrameScript';
16
- import { HierarchicalProperty } from '@awayjs/view';
17
18
 
18
19
  const BLEND_MODES = [
19
20
  '', BlendMode.NORMAL, BlendMode.LAYER,
@@ -50,7 +51,6 @@ export class Timeline {
50
51
  [AType.START_AUDIO]: Timeline.start_audio
51
52
  };
52
53
 
53
- private _symbolDecoder: ISymbolDecoder;
54
54
  private _blocked: boolean;
55
55
 
56
56
  public _update_indices: number[] = [];
@@ -120,7 +120,7 @@ export class Timeline {
120
120
  **/
121
121
  private _initalMcID: number;
122
122
 
123
- constructor() {
123
+ constructor(readonly factory: ISceneGraphFactory) {
124
124
 
125
125
  this._initalMcID = -1;
126
126
  this.numKeyFrames = 0;
@@ -137,14 +137,6 @@ export class Timeline {
137
137
  this.keyframe_to_frameidx = {};
138
138
  }
139
139
 
140
- public get symbolDecoder(): ISymbolDecoder {
141
- return this._symbolDecoder;
142
- }
143
-
144
- public set symbolDecoder(value: ISymbolDecoder) {
145
- this._symbolDecoder = value;
146
- }
147
-
148
140
  public resetScripts() {
149
141
  this._framescripts = {};
150
142
  this._framescripts_translated = {};
@@ -155,10 +147,6 @@ export class Timeline {
155
147
  */
156
148
  public init(): void {
157
149
 
158
- if (!this._symbolDecoder) {
159
- console.warn('[Timeline] - init - no _symbolDecoder is set');
160
- }
161
-
162
150
  if ((this.frame_command_indices == null) || (this.frame_recipe == null) || (this.keyframe_durations == null)) {
163
151
  return;
164
152
  }
@@ -245,7 +233,7 @@ export class Timeline {
245
233
  if (checkForTranslation && !this._framescripts_translated[frame_idx]) {
246
234
  // todo: cleanup so we can retrieve className of target_mc without hacks
247
235
  const name = (<any>target_mc).className ? (<any>target_mc).className : target_mc.name;
248
- this._framescripts[frame_idx] = this.symbolDecoder.prepareFrameScriptsForAVM1(
236
+ this._framescripts[frame_idx] = this.factory.createFrameScripts(
249
237
  this._framescripts[frame_idx],
250
238
  frame_idx,
251
239
  name,
@@ -266,7 +254,7 @@ export class Timeline {
266
254
  }
267
255
 
268
256
  public getChildInstance(symbolID: number, sessionID: number) {
269
- return this.symbolDecoder.createChildInstanceForTimeline(this, symbolID, sessionID);
257
+ return this.factory.createChildInstanceForTimeline(this, symbolID, sessionID);
270
258
  }
271
259
 
272
260
  public extractHitArea(target_mc: MovieClip): DisplayObjectContainer {
@@ -480,7 +468,7 @@ export class Timeline {
480
468
  idx, this.add_child_stream);
481
469
  continue;
482
470
  }
483
- const childAsset: IAsset = this._symbolDecoder.createChildInstanceForTimeline(this,
471
+ const childAsset: IAsset = this.factory.createChildInstanceForTimeline(this,
484
472
  this.add_child_stream[idx + 2], this.add_child_stream[idx]);
485
473
  (<IMovieClipAdapter>target_mc.adapter).addTimelineChildAtDepth(<DisplayObject>childAsset,
486
474
  this.add_child_stream[idx + 1]);
@@ -4,6 +4,7 @@ import {
4
4
  PickEntity,
5
5
  _Pick_PickableBase,
6
6
  EntityNode,
7
+ IPartitionEntity,
7
8
  } from '@awayjs/view';
8
9
  import {
9
10
  RenderableEvent,
@@ -195,8 +196,8 @@ export class Billboard extends DisplayObjectContainer {
195
196
  //override for billboard
196
197
  }
197
198
 
198
- public isEntity(): boolean {
199
- return true;
199
+ public getEntity(): IPartitionEntity {
200
+ return this;
200
201
  }
201
202
 
202
203
  /**
@@ -19,10 +19,6 @@ export class Camera extends DisplayObjectContainer {
19
19
  this.z = -1000;
20
20
  }
21
21
 
22
- public isEntity(): boolean {
23
- return true;
24
- }
25
-
26
22
  //@override
27
23
  public get assetType(): string {
28
24
  return Camera.assetType;
@@ -24,7 +24,9 @@ import {
24
24
  ContainerEvent,
25
25
  AlignmentMode,
26
26
  OrientationMode,
27
- BasicPartition
27
+ BasicPartition,
28
+ IPartitionContainer,
29
+ ContainerNode
28
30
  } from '@awayjs/view';
29
31
 
30
32
  import {
@@ -177,8 +179,9 @@ import { Settings } from '../Settings';
177
179
  * display is not rendering. This is the case when the
178
180
  * content is either minimized or obscured. </p>
179
181
  */
180
- export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartitionEntity {
182
+ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartitionContainer {
181
183
 
184
+ private _mouseChildren: boolean = true;
182
185
  public _material: IMaterial;
183
186
  public _style: Style;
184
187
  private _loader: Loader;
@@ -1236,7 +1239,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1236
1239
  this.invalidate();
1237
1240
  }
1238
1241
 
1239
- public getScrollRectPrimitive(): DisplayObject {
1242
+ public getScrollRectPrimitive(): IPartitionContainer {
1240
1243
  if (this._scrollRectPrimitiveDirty) {
1241
1244
  this._scrollRectPrimitiveDirty = false;
1242
1245
 
@@ -1257,7 +1260,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1257
1260
  return this._scrollRectPrimitive;
1258
1261
  }
1259
1262
 
1260
- public getBoundsPrimitive(picker: BoundsPicker): DisplayObject {
1263
+ public getBoundsPrimitive(picker: BoundsPicker): IPartitionContainer {
1261
1264
  if (this._boundsPrimitive == null) {
1262
1265
  switch (this._defaultBoundingVolume) {
1263
1266
  case BoundingVolumeType.BOX:
@@ -1449,6 +1452,40 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1449
1452
  this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1450
1453
  }
1451
1454
 
1455
+ /**
1456
+ * Determines whether or not the children of the object are mouse, or user
1457
+ * input device, enabled. If an object is enabled, a user can interact with
1458
+ * it by using a mouse or user input device. The default is
1459
+ * <code>true</code>.
1460
+ *
1461
+ * <p>This property is useful when you create a button with an instance of
1462
+ * the Sprite class(instead of using the SimpleButton class). When you use a
1463
+ * Sprite instance to create a button, you can choose to decorate the button
1464
+ * by using the <code>addChild()</code> method to add additional Sprite
1465
+ * instances. This process can cause unexpected behavior with mouse events
1466
+ * because the Sprite instances you add as children can become the target
1467
+ * object of a mouse event when you expect the parent instance to be the
1468
+ * target object. To ensure that the parent instance serves as the target
1469
+ * objects for mouse events, you can set the <code>mouseChildren</code>
1470
+ * property of the parent instance to <code>false</code>.</p>
1471
+ *
1472
+ * <p> No event is dispatched by setting this property. You must use the
1473
+ * <code>addEventListener()</code> method to create interactive
1474
+ * functionality.</p>
1475
+ */
1476
+ public get mouseChildren(): boolean {
1477
+ return this._mouseChildren;
1478
+ }
1479
+
1480
+ public set mouseChildren(value: boolean) {
1481
+ if (this._mouseChildren == value)
1482
+ return;
1483
+
1484
+ this._mouseChildren = value;
1485
+
1486
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MOUSE_ENABLED);
1487
+ }
1488
+
1452
1489
  /**
1453
1490
  * Indicates the <i>x</i> coordinate of the DisplayObject instance relative
1454
1491
  * to the local coordinates of the parent DisplayObjectContainer. If the
@@ -1572,10 +1609,12 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1572
1609
  //default to do nothing
1573
1610
  }
1574
1611
 
1575
- public isEntity(): boolean {
1576
- return false;
1612
+ public getEntity(): IPartitionEntity {
1613
+ return;
1577
1614
  }
1578
1615
 
1616
+ public _initNode(node: ContainerNode): void {}
1617
+
1579
1618
  /**
1580
1619
  *
1581
1620
  */
@@ -1593,6 +1632,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1593
1632
  if (this._registrationMatrix3D)
1594
1633
  displayObject._registrationMatrix3D = this._registrationMatrix3D.clone();
1595
1634
 
1635
+ displayObject.mouseChildren = this._mouseChildren;
1596
1636
  displayObject.material = this._material;
1597
1637
  displayObject.style = this._style;
1598
1638
  displayObject.pickObject = this._pickObject;
@@ -1726,12 +1766,8 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1726
1766
  this.dispatchEvent(new HeirarchicalEvent(HeirarchicalEvent.INVALIDATE_PROPERTY, propDirty));
1727
1767
  }
1728
1768
 
1729
- public _invalidateEntity(): void {
1730
- this.dispatchEvent(new ContainerEvent(ContainerEvent.INVALIDATE_ENTITY, this));
1731
- }
1732
-
1733
- public _clearEntity(): void {
1734
- this.dispatchEvent(new ContainerEvent(ContainerEvent.CLEAR_ENTITY, this));
1769
+ public _updateEntity(): void {
1770
+ this.dispatchEvent(new ContainerEvent(ContainerEvent.UPDATE_ENTITY, this));
1735
1771
  }
1736
1772
 
1737
1773
  /**
@@ -1,6 +1,6 @@
1
1
  import { Point, ArgumentError, RangeError } from '@awayjs/core';
2
2
  import { IAnimator, IRenderContainer } from '@awayjs/renderer';
3
- import { PartitionBase, EntityNode, HierarchicalProperty, ContainerEvent } from '@awayjs/view';
3
+ import { PartitionBase, EntityNode, HierarchicalProperty, ContainerEvent, ContainerNode } from '@awayjs/view';
4
4
  import { DisplayObject } from './DisplayObject';
5
5
 
6
6
  /**
@@ -30,7 +30,6 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
30
30
  private static NO_CHILD_ERROR = new ArgumentError('Child parameter is not a child of the caller');
31
31
 
32
32
  private _animator: IAnimator;
33
- private _mouseChildren: boolean = true;
34
33
  protected _children: Array<DisplayObject> = new Array<DisplayObject>();
35
34
 
36
35
  public doingSwap: boolean = false;
@@ -42,40 +41,6 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
42
41
  return DisplayObjectContainer.assetType;
43
42
  }
44
43
 
45
- /**
46
- * Determines whether or not the children of the object are mouse, or user
47
- * input device, enabled. If an object is enabled, a user can interact with
48
- * it by using a mouse or user input device. The default is
49
- * <code>true</code>.
50
- *
51
- * <p>This property is useful when you create a button with an instance of
52
- * the Sprite class(instead of using the SimpleButton class). When you use a
53
- * Sprite instance to create a button, you can choose to decorate the button
54
- * by using the <code>addChild()</code> method to add additional Sprite
55
- * instances. This process can cause unexpected behavior with mouse events
56
- * because the Sprite instances you add as children can become the target
57
- * object of a mouse event when you expect the parent instance to be the
58
- * target object. To ensure that the parent instance serves as the target
59
- * objects for mouse events, you can set the <code>mouseChildren</code>
60
- * property of the parent instance to <code>false</code>.</p>
61
- *
62
- * <p> No event is dispatched by setting this property. You must use the
63
- * <code>addEventListener()</code> method to create interactive
64
- * functionality.</p>
65
- */
66
- public get mouseChildren(): boolean {
67
- return this._mouseChildren;
68
- }
69
-
70
- public set mouseChildren(value: boolean) {
71
- if (this._mouseChildren == value)
72
- return;
73
-
74
- this._mouseChildren = value;
75
-
76
- this._invalidateHierarchicalProperty(HierarchicalProperty.MOUSE_ENABLED);
77
- }
78
-
79
44
  /**
80
45
  * Defines the animator of the display object. Default value is <code>null</code>.
81
46
  */
@@ -231,8 +196,6 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
231
196
  public copyTo(newInstance: DisplayObjectContainer): void {
232
197
  super.copyTo(newInstance);
233
198
 
234
- newInstance.mouseChildren = this._mouseChildren;
235
-
236
199
  if (this._animator)
237
200
  newInstance.animator = this._animator.clone();
238
201
 
@@ -546,6 +509,11 @@ export class DisplayObjectContainer extends DisplayObject implements IRenderCont
546
509
 
547
510
  }
548
511
 
512
+ public _initNode(node: ContainerNode): void {
513
+ for (let i: number = 0; i < this._children.length; ++i)
514
+ node.addChildAt(this._children[i], i);
515
+ }
516
+
549
517
  /**
550
518
  * @private
551
519
  *
@@ -1,7 +1,7 @@
1
1
  import { Vector3D, Matrix3D, Box, Sphere } from '@awayjs/core';
2
2
 
3
3
  import { PickingCollision, PartitionBase, _Pick_PickableBase,
4
- PickEntity, IEntityTraverser, EntityNode } from '@awayjs/view';
4
+ PickEntity, IEntityTraverser, EntityNode, IPartitionEntity } from '@awayjs/view';
5
5
 
6
6
  import { RenderableEvent, IMaterial } from '@awayjs/renderer';
7
7
 
@@ -89,8 +89,8 @@ export class LineSegment extends DisplayObject {
89
89
  this._halfThickness = thickness * 0.5;
90
90
  }
91
91
 
92
- public isEntity(): boolean {
93
- return true;
92
+ public getEntity(): IPartitionEntity {
93
+ return this;
94
94
  }
95
95
 
96
96
  public _acceptTraverser(traverser: IEntityTraverser): void {
@@ -1,6 +1,6 @@
1
1
  import { Matrix, ColorUtils, AssetEvent } from '@awayjs/core';
2
2
 
3
- import { PartitionBase, EntityNode } from '@awayjs/view';
3
+ import { PartitionBase, EntityNode, IPartitionEntity } from '@awayjs/view';
4
4
 
5
5
  import {
6
6
  GraphicsPathCommand,
@@ -57,13 +57,10 @@ export class MorphSprite extends Sprite {
57
57
  // this.graphics.dispose();
58
58
  }
59
59
 
60
- if (!this._graphics) {
60
+ if (!this._graphics)
61
61
  this._graphics = Graphics.getGraphics();
62
- }
63
62
 
64
63
  this._graphics.copyFrom(value);
65
-
66
- this._onGraphicsInvalidate(null);
67
64
  }
68
65
 
69
66
  public get assetType(): string {
@@ -39,10 +39,10 @@ export class MovieClip extends Sprite {
39
39
 
40
40
  public static assetType: string = '[asset MovieClip]';
41
41
 
42
- public static getNewMovieClip(timeline: Timeline = null): MovieClip {
42
+ public static getNewMovieClip(timeline: Timeline): MovieClip {
43
43
  if (MovieClip._movieClips.length) {
44
44
  const movieClip: MovieClip = MovieClip._movieClips.pop();
45
- movieClip.timeline = timeline || new Timeline();
45
+ movieClip.timeline = timeline;
46
46
  movieClip.graphics = Graphics.getGraphics();
47
47
  return movieClip;
48
48
  }
@@ -154,7 +154,7 @@ export class MovieClip extends Sprite {
154
154
  return 0;
155
155
  }
156
156
 
157
- constructor(timeline: Timeline = null, spriteMode = false) {
157
+ constructor(timeline: Timeline, spriteMode = false) {
158
158
  super();
159
159
 
160
160
  this._soundVolume = 1;
@@ -200,7 +200,7 @@ export class MovieClip extends Sprite {
200
200
  this.currentFrameIndex = 1;
201
201
  };
202
202
 
203
- this._timeline = timeline || new Timeline();
203
+ this._timeline = timeline;
204
204
 
205
205
  if (spriteMode) {
206
206
  this.transformToSprite();
@@ -2,7 +2,7 @@ import { AssetEvent } from '@awayjs/core';
2
2
 
3
3
  import { BlendMode, ImageCube } from '@awayjs/stage';
4
4
 
5
- import { PickingCollision, PartitionBase, BoundingVolumeType, INode } from '@awayjs/view';
5
+ import { PickingCollision, PartitionBase, BoundingVolumeType, INode, IPartitionEntity } from '@awayjs/view';
6
6
 
7
7
  import { IAnimationSet, IMaterial, ITexture, RenderableEvent,
8
8
  MaterialEvent, Style, StyleEvent, IRenderContainer, ImageTextureCube, DefaultRenderer } from '@awayjs/renderer';
@@ -37,6 +37,8 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
37
37
 
38
38
  public alphaThreshold: number = 0;
39
39
 
40
+ public alphaBlending: boolean = true;
41
+
40
42
  /**
41
43
  *
42
44
  */
@@ -130,8 +132,8 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
130
132
  }
131
133
  }
132
134
 
133
- public isEntity(): boolean {
134
- return true;
135
+ public getEntity(): IPartitionEntity {
136
+ return this;
135
137
  }
136
138
 
137
139
  public get assetType(): string {
@@ -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
  /**