@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.
- package/bundle/awayjs-scene.umd.js +103 -223
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/display/Billboard.d.ts +2 -2
- package/dist/lib/display/Billboard.d.ts.map +1 -1
- package/dist/lib/display/Billboard.js +2 -2
- package/dist/lib/display/Camera.d.ts +0 -1
- package/dist/lib/display/Camera.d.ts.map +1 -1
- package/dist/lib/display/Camera.js +0 -3
- package/dist/lib/display/DisplayObject.d.ts +30 -8
- package/dist/lib/display/DisplayObject.d.ts.map +1 -1
- package/dist/lib/display/DisplayObject.js +40 -10
- package/dist/lib/display/DisplayObjectContainer.d.ts +2 -24
- package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
- package/dist/lib/display/DisplayObjectContainer.js +5 -37
- package/dist/lib/display/LineSegment.d.ts +2 -2
- package/dist/lib/display/LineSegment.d.ts.map +1 -1
- package/dist/lib/display/LineSegment.js +2 -2
- package/dist/lib/display/MorphSprite.d.ts +0 -1
- package/dist/lib/display/MorphSprite.d.ts.map +1 -1
- package/dist/lib/display/MorphSprite.js +1 -19
- package/dist/lib/display/MovieClip.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.js +2 -3
- package/dist/lib/display/Skybox.d.ts +2 -2
- package/dist/lib/display/Skybox.d.ts.map +1 -1
- package/dist/lib/display/Skybox.js +2 -2
- package/dist/lib/display/Sprite.d.ts +2 -20
- package/dist/lib/display/Sprite.d.ts.map +1 -1
- package/dist/lib/display/Sprite.js +24 -66
- package/dist/lib/display/TextField.d.ts +2 -17
- package/dist/lib/display/TextField.d.ts.map +1 -1
- package/dist/lib/display/TextField.js +13 -72
- package/dist/lib/display/TextSprite.d.ts +1 -2
- package/dist/lib/display/TextSprite.d.ts.map +1 -1
- package/dist/lib/display/TextSprite.js +2 -2
- package/dist/lib/events/MouseEvent.d.ts +3 -3
- package/dist/lib/events/MouseEvent.d.ts.map +1 -1
- package/dist/lib/events/MouseEvent.js +3 -3
- package/dist/lib/managers/MouseManager.d.ts.map +1 -1
- package/dist/lib/managers/MouseManager.js +7 -7
- package/index.ts +1 -1
- package/lib/display/Billboard.ts +3 -2
- package/lib/display/Camera.ts +0 -4
- package/lib/display/DisplayObject.ts +46 -19
- package/lib/display/DisplayObjectContainer.ts +6 -38
- package/lib/display/LineSegment.ts +3 -3
- package/lib/display/MorphSprite.ts +2 -26
- package/lib/display/MovieClip.ts +2 -2
- package/lib/display/Skybox.ts +3 -3
- package/lib/display/Sprite.ts +20 -74
- package/lib/display/TextField.ts +19 -83
- package/lib/display/TextSprite.ts +3 -4
- package/lib/events/MouseEvent.ts +6 -6
- package/lib/managers/MouseManager.ts +8 -9
- package/package.json +1 -1
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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 &&
|
|
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 (
|
|
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.
|
|
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.
|
|
618
|
+
event.containerNode = null;
|
|
619
619
|
event.rootNode = null;
|
|
620
620
|
event.traversable = null;
|
|
621
621
|
event.uv = null;
|
package/index.ts
CHANGED
package/lib/display/Billboard.ts
CHANGED
|
@@ -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
|
|
199
|
-
return
|
|
199
|
+
public getEntity(): IPartitionEntity {
|
|
200
|
+
return this;
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
/**
|
package/lib/display/Camera.ts
CHANGED
|
@@ -16,15 +16,15 @@ import {
|
|
|
16
16
|
BoundingBox,
|
|
17
17
|
BoundingSphere,
|
|
18
18
|
BoundingVolumeType,
|
|
19
|
-
IEntityTraverser,
|
|
20
19
|
IPartitionEntity,
|
|
21
20
|
BoundsPicker,
|
|
22
21
|
HeirarchicalEvent,
|
|
23
22
|
HierarchicalProperty,
|
|
24
|
-
ContainerEvent,
|
|
25
23
|
AlignmentMode,
|
|
26
24
|
OrientationMode,
|
|
27
|
-
BasicPartition
|
|
25
|
+
BasicPartition,
|
|
26
|
+
IPartitionContainer,
|
|
27
|
+
ContainerNode
|
|
28
28
|
} from '@awayjs/view';
|
|
29
29
|
|
|
30
30
|
import {
|
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
import { DisplayObjectContainer } from './DisplayObjectContainer';
|
|
39
39
|
import { ControllerBase } from '../controllers/ControllerBase';
|
|
40
40
|
import { IBitmapDrawable } from '../base/IBitmapDrawable';
|
|
41
|
-
import { FocusEvent } from '../events/FocusEvent';
|
|
42
41
|
|
|
43
42
|
import { PrimitiveCubePrefab } from '../prefabs/PrimitiveCubePrefab';
|
|
44
43
|
import { PrimitiveSpherePrefab } from '../prefabs/PrimitiveSpherePrefab';
|
|
@@ -177,8 +176,9 @@ import { Settings } from '../Settings';
|
|
|
177
176
|
* display is not rendering. This is the case when the
|
|
178
177
|
* content is either minimized or obscured. </p>
|
|
179
178
|
*/
|
|
180
|
-
export class DisplayObject extends AssetBase implements IBitmapDrawable,
|
|
179
|
+
export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartitionContainer {
|
|
181
180
|
|
|
181
|
+
private _mouseChildren: boolean = true;
|
|
182
182
|
public _material: IMaterial;
|
|
183
183
|
public _style: Style;
|
|
184
184
|
private _loader: Loader;
|
|
@@ -1236,7 +1236,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1236
1236
|
this.invalidate();
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
|
-
public getScrollRectPrimitive():
|
|
1239
|
+
public getScrollRectPrimitive(): IPartitionContainer {
|
|
1240
1240
|
if (this._scrollRectPrimitiveDirty) {
|
|
1241
1241
|
this._scrollRectPrimitiveDirty = false;
|
|
1242
1242
|
|
|
@@ -1257,7 +1257,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1257
1257
|
return this._scrollRectPrimitive;
|
|
1258
1258
|
}
|
|
1259
1259
|
|
|
1260
|
-
public getBoundsPrimitive(picker: BoundsPicker):
|
|
1260
|
+
public getBoundsPrimitive(picker: BoundsPicker): IPartitionContainer {
|
|
1261
1261
|
if (this._boundsPrimitive == null) {
|
|
1262
1262
|
switch (this._defaultBoundingVolume) {
|
|
1263
1263
|
case BoundingVolumeType.BOX:
|
|
@@ -1449,6 +1449,40 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1449
1449
|
this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
|
+
/**
|
|
1453
|
+
* Determines whether or not the children of the object are mouse, or user
|
|
1454
|
+
* input device, enabled. If an object is enabled, a user can interact with
|
|
1455
|
+
* it by using a mouse or user input device. The default is
|
|
1456
|
+
* <code>true</code>.
|
|
1457
|
+
*
|
|
1458
|
+
* <p>This property is useful when you create a button with an instance of
|
|
1459
|
+
* the Sprite class(instead of using the SimpleButton class). When you use a
|
|
1460
|
+
* Sprite instance to create a button, you can choose to decorate the button
|
|
1461
|
+
* by using the <code>addChild()</code> method to add additional Sprite
|
|
1462
|
+
* instances. This process can cause unexpected behavior with mouse events
|
|
1463
|
+
* because the Sprite instances you add as children can become the target
|
|
1464
|
+
* object of a mouse event when you expect the parent instance to be the
|
|
1465
|
+
* target object. To ensure that the parent instance serves as the target
|
|
1466
|
+
* objects for mouse events, you can set the <code>mouseChildren</code>
|
|
1467
|
+
* property of the parent instance to <code>false</code>.</p>
|
|
1468
|
+
*
|
|
1469
|
+
* <p> No event is dispatched by setting this property. You must use the
|
|
1470
|
+
* <code>addEventListener()</code> method to create interactive
|
|
1471
|
+
* functionality.</p>
|
|
1472
|
+
*/
|
|
1473
|
+
public get mouseChildren(): boolean {
|
|
1474
|
+
return this._mouseChildren;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
public set mouseChildren(value: boolean) {
|
|
1478
|
+
if (this._mouseChildren == value)
|
|
1479
|
+
return;
|
|
1480
|
+
|
|
1481
|
+
this._mouseChildren = value;
|
|
1482
|
+
|
|
1483
|
+
this._invalidateHierarchicalProperty(HierarchicalProperty.MOUSE_ENABLED);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1452
1486
|
/**
|
|
1453
1487
|
* Indicates the <i>x</i> coordinate of the DisplayObject instance relative
|
|
1454
1488
|
* to the local coordinates of the parent DisplayObjectContainer. If the
|
|
@@ -1572,10 +1606,12 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1572
1606
|
//default to do nothing
|
|
1573
1607
|
}
|
|
1574
1608
|
|
|
1575
|
-
public
|
|
1576
|
-
return
|
|
1609
|
+
public getEntity(): IPartitionEntity {
|
|
1610
|
+
return;
|
|
1577
1611
|
}
|
|
1578
1612
|
|
|
1613
|
+
public _initNode(node: ContainerNode): void {}
|
|
1614
|
+
|
|
1579
1615
|
/**
|
|
1580
1616
|
*
|
|
1581
1617
|
*/
|
|
@@ -1593,6 +1629,7 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1593
1629
|
if (this._registrationMatrix3D)
|
|
1594
1630
|
displayObject._registrationMatrix3D = this._registrationMatrix3D.clone();
|
|
1595
1631
|
|
|
1632
|
+
displayObject.mouseChildren = this._mouseChildren;
|
|
1596
1633
|
displayObject.material = this._material;
|
|
1597
1634
|
displayObject.style = this._style;
|
|
1598
1635
|
displayObject.pickObject = this._pickObject;
|
|
@@ -1726,14 +1763,6 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1726
1763
|
this.dispatchEvent(new HeirarchicalEvent(HeirarchicalEvent.INVALIDATE_PROPERTY, propDirty));
|
|
1727
1764
|
}
|
|
1728
1765
|
|
|
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));
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
1766
|
/**
|
|
1738
1767
|
*
|
|
1739
1768
|
*/
|
|
@@ -1749,8 +1778,6 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
|
|
|
1749
1778
|
return this._maskId;
|
|
1750
1779
|
}
|
|
1751
1780
|
|
|
1752
|
-
public _acceptTraverser(_traverser: IEntityTraverser): void {}
|
|
1753
|
-
|
|
1754
1781
|
protected _setScaleX(val: number): void {
|
|
1755
1782
|
if (this.scaleX == val)
|
|
1756
1783
|
return;
|
|
@@ -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
|
|
93
|
-
return
|
|
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,
|
|
@@ -44,28 +44,6 @@ export class MorphSprite extends Sprite {
|
|
|
44
44
|
private _ratio: ui16;
|
|
45
45
|
private _frameCaches: NumberMap<GraphicsPath[]> = {};
|
|
46
46
|
|
|
47
|
-
protected _setGraphics(value: Graphics): void {
|
|
48
|
-
if (this._graphics == value) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (this._graphics) {
|
|
53
|
-
this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
|
|
54
|
-
this._graphics.usages--;
|
|
55
|
-
|
|
56
|
-
//if (!this._graphics.usages)
|
|
57
|
-
// this.graphics.dispose();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!this._graphics) {
|
|
61
|
-
this._graphics = Graphics.getGraphics();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this._graphics.copyFrom(value);
|
|
65
|
-
|
|
66
|
-
this._onGraphicsInvalidate(null);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
47
|
public get assetType(): string {
|
|
70
48
|
return MorphSprite.assetType;
|
|
71
49
|
}
|
|
@@ -369,6 +347,4 @@ export class MorphSprite extends Sprite {
|
|
|
369
347
|
|
|
370
348
|
return newInstance;
|
|
371
349
|
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
PartitionBase.registerAbstraction(EntityNode, MorphSprite);
|
|
350
|
+
}
|
package/lib/display/MovieClip.ts
CHANGED
|
@@ -43,7 +43,6 @@ export class MovieClip extends Sprite {
|
|
|
43
43
|
if (MovieClip._movieClips.length) {
|
|
44
44
|
const movieClip: MovieClip = MovieClip._movieClips.pop();
|
|
45
45
|
movieClip.timeline = timeline;
|
|
46
|
-
movieClip.graphics = Graphics.getGraphics();
|
|
47
46
|
return movieClip;
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -580,7 +579,8 @@ export class MovieClip extends Sprite {
|
|
|
580
579
|
for (let i: number = this.numChildren - 1; i >= 0; i--)
|
|
581
580
|
this.removeChildAt(i);
|
|
582
581
|
|
|
583
|
-
this.
|
|
582
|
+
if (this._graphics)
|
|
583
|
+
this._graphics.clear();
|
|
584
584
|
|
|
585
585
|
if (fireScripts) {
|
|
586
586
|
const numFrames: number = this._timeline.keyframe_indices.length;
|
package/lib/display/Skybox.ts
CHANGED
|
@@ -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';
|
|
@@ -132,8 +132,8 @@ export class Skybox extends DisplayObjectContainer implements IMaterial {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
public
|
|
136
|
-
return
|
|
135
|
+
public getEntity(): IPartitionEntity {
|
|
136
|
+
return this;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
public get assetType(): string {
|
package/lib/display/Sprite.ts
CHANGED
|
@@ -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
|
|
|
@@ -22,7 +21,7 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
22
21
|
public static getNewSprite(graphics: Graphics = null, material: IMaterial = null): Sprite {
|
|
23
22
|
if (Sprite._sprites.length) {
|
|
24
23
|
const sprite: Sprite = Sprite._sprites.pop();
|
|
25
|
-
sprite.graphics = graphics
|
|
24
|
+
sprite.graphics = graphics;
|
|
26
25
|
sprite.material = material;
|
|
27
26
|
return sprite;
|
|
28
27
|
}
|
|
@@ -36,7 +35,6 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
36
35
|
|
|
37
36
|
private _center: Vector3D;
|
|
38
37
|
public _graphics: Graphics;
|
|
39
|
-
protected _onGraphicsInvalidateDelegate: (event: AssetEvent) => void;
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
*
|
|
@@ -50,25 +48,20 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
50
48
|
* drawing commands can occur.
|
|
51
49
|
*/
|
|
52
50
|
public get graphics(): Graphics {
|
|
53
|
-
if
|
|
54
|
-
|
|
51
|
+
//create new graphics object if none exists
|
|
52
|
+
if (!this._graphics) {
|
|
53
|
+
this.graphics = Graphics.getGraphics();
|
|
54
|
+
this.invalidate();
|
|
55
|
+
}
|
|
56
|
+
|
|
55
57
|
return this._graphics;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
public set graphics(value: Graphics) {
|
|
59
|
-
if (
|
|
60
|
-
throw new Error('Cannot have graphics set to null');
|
|
61
|
-
|
|
62
|
-
this._setGraphics(value);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
protected _setGraphics(value: Graphics): void {
|
|
66
|
-
if (this._graphics == value) {
|
|
61
|
+
if (this._graphics == value)
|
|
67
62
|
return;
|
|
68
|
-
}
|
|
69
63
|
|
|
70
64
|
if (this._graphics) {
|
|
71
|
-
this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
|
|
72
65
|
this._graphics.usages--;
|
|
73
66
|
|
|
74
67
|
//if (!this._graphics.usages)
|
|
@@ -77,9 +70,10 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
77
70
|
|
|
78
71
|
this._graphics = value;
|
|
79
72
|
|
|
80
|
-
this._graphics
|
|
73
|
+
if (this._graphics)
|
|
74
|
+
this._graphics.usages++;
|
|
81
75
|
|
|
82
|
-
this.
|
|
76
|
+
this.invalidate();
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
/**
|
|
@@ -90,33 +84,15 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
90
84
|
constructor(graphics: Graphics = null, material: IMaterial = null) {
|
|
91
85
|
super();
|
|
92
86
|
|
|
93
|
-
this.
|
|
94
|
-
|
|
95
|
-
this.graphics = graphics || Graphics.getGraphics();
|
|
87
|
+
this.graphics = graphics;
|
|
96
88
|
this.material = material;
|
|
97
89
|
|
|
98
90
|
// this.dropBitmapCache = this.dropBitmapCache.bind(this);
|
|
99
91
|
// this.generateBitmapCache = this.generateBitmapCache.bind(this);
|
|
100
92
|
}
|
|
101
93
|
|
|
102
|
-
public
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (parent)
|
|
106
|
-
this._graphics.addEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
|
|
107
|
-
else
|
|
108
|
-
this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
|
|
109
|
-
|
|
110
|
-
// if (this._requestCacheAsBitmap) {
|
|
111
|
-
|
|
112
|
-
// this.set_cacheAsBitmapInternal(true);
|
|
113
|
-
|
|
114
|
-
// console.log('Restore cache');
|
|
115
|
-
// }
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public isEntity(): boolean {
|
|
119
|
-
return (this._graphics && this._graphics.count > 0);
|
|
94
|
+
public getEntity(): IPartitionEntity {
|
|
95
|
+
return this._graphics;
|
|
120
96
|
}
|
|
121
97
|
|
|
122
98
|
/**
|
|
@@ -164,7 +140,8 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
164
140
|
|
|
165
141
|
sprite._iSourcePrefab = this._iSourcePrefab;
|
|
166
142
|
|
|
167
|
-
this._graphics
|
|
143
|
+
if (this._graphics)
|
|
144
|
+
this._graphics.copyTo(sprite.graphics, cloneShapes);
|
|
168
145
|
}
|
|
169
146
|
|
|
170
147
|
/**
|
|
@@ -173,37 +150,8 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
173
150
|
public _iInternalUpdate(): void {
|
|
174
151
|
super._iInternalUpdate();
|
|
175
152
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* //TODO
|
|
182
|
-
*
|
|
183
|
-
* @private
|
|
184
|
-
*/
|
|
185
|
-
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
|
-
this.invalidate();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
*
|
|
200
|
-
* @param renderer
|
|
201
|
-
*
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
public _acceptTraverser(traverser: IEntityTraverser): void {
|
|
205
|
-
super._acceptTraverser(traverser);
|
|
206
|
-
this.graphics._acceptTraverser(traverser);
|
|
153
|
+
if (this._iSourcePrefab)
|
|
154
|
+
this._iSourcePrefab._iValidate();
|
|
207
155
|
}
|
|
208
156
|
|
|
209
157
|
/**
|
|
@@ -213,6 +161,4 @@ export class Sprite extends DisplayObjectContainer {
|
|
|
213
161
|
this._graphics.applyTransformation(this.transform.matrix3D);
|
|
214
162
|
this.transform.clearMatrix3D();
|
|
215
163
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
PartitionBase.registerAbstraction(EntityNode, Sprite);
|
|
164
|
+
}
|