@awayjs/scene 0.13.322 → 0.13.323

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 (265) hide show
  1. package/.eslintrc +100 -100
  2. package/README.md +61 -61
  3. package/bundle/awayjs-scene.umd.js +2 -2
  4. package/bundle/awayjs-scene.umd.js.map +1 -1
  5. package/copyVersionToIndex.js +23 -23
  6. package/dist/index.d.ts +76 -76
  7. package/dist/index.js +67 -67
  8. package/dist/lib/Scene.d.ts +85 -85
  9. package/dist/lib/Scene.js +285 -285
  10. package/dist/lib/Settings.d.ts +16 -16
  11. package/dist/lib/Settings.js +60 -60
  12. package/dist/lib/adapters/IDisplayObjectAdapter.d.ts +13 -13
  13. package/dist/lib/adapters/IDisplayObjectAdapter.js +1 -1
  14. package/dist/lib/adapters/IFilter.d.ts +24 -24
  15. package/dist/lib/adapters/IFilter.js +1 -1
  16. package/dist/lib/adapters/IMovieClipAdapter.d.ts +15 -14
  17. package/dist/lib/adapters/IMovieClipAdapter.d.ts.map +1 -1
  18. package/dist/lib/adapters/IMovieClipAdapter.js +1 -1
  19. package/dist/lib/adapters/ITextfieldAdapter.d.ts +4 -4
  20. package/dist/lib/adapters/ITextfieldAdapter.js +1 -1
  21. package/dist/lib/base/IBitmapDrawable.d.ts +11 -11
  22. package/dist/lib/base/IBitmapDrawable.js +1 -1
  23. package/dist/lib/base/IFrameLabel.d.ts +4 -4
  24. package/dist/lib/base/IFrameLabel.js +1 -1
  25. package/dist/lib/base/IFrameScript.d.ts +5 -5
  26. package/dist/lib/base/IFrameScript.js +1 -1
  27. package/dist/lib/base/MouseButtons.d.ts +26 -26
  28. package/dist/lib/base/MouseButtons.js +1 -1
  29. package/dist/lib/base/Timeline.d.ts +147 -147
  30. package/dist/lib/base/Timeline.js +525 -525
  31. package/dist/lib/base/TimelineActionType.d.ts +18 -18
  32. package/dist/lib/base/TimelineActionType.js +1 -1
  33. package/dist/lib/controllers/ControllerBase.d.ts +14 -14
  34. package/dist/lib/controllers/ControllerBase.js +60 -60
  35. package/dist/lib/controllers/FirstPersonController.d.ts +78 -78
  36. package/dist/lib/controllers/FirstPersonController.js +228 -228
  37. package/dist/lib/controllers/FollowController.d.ts +12 -12
  38. package/dist/lib/controllers/FollowController.js +27 -27
  39. package/dist/lib/controllers/HoverController.d.ts +105 -105
  40. package/dist/lib/controllers/HoverController.js +302 -302
  41. package/dist/lib/controllers/LookAtController.d.ts +14 -14
  42. package/dist/lib/controllers/LookAtController.js +68 -68
  43. package/dist/lib/controllers/SpringController.d.ts +38 -38
  44. package/dist/lib/controllers/SpringController.js +59 -59
  45. package/dist/lib/display/Billboard.d.ts +132 -132
  46. package/dist/lib/display/Billboard.js +397 -397
  47. package/dist/lib/display/Camera.d.ts +31 -31
  48. package/dist/lib/display/Camera.js +72 -72
  49. package/dist/lib/display/DisplayObject.d.ts +921 -921
  50. package/dist/lib/display/DisplayObject.js +1595 -1595
  51. package/dist/lib/display/DisplayObjectContainer.d.ts +325 -325
  52. package/dist/lib/display/DisplayObjectContainer.js +486 -486
  53. package/dist/lib/display/LineSegment.d.ts +69 -69
  54. package/dist/lib/display/LineSegment.js +203 -203
  55. package/dist/lib/display/LoaderContainer.d.ts +504 -504
  56. package/dist/lib/display/LoaderContainer.js +603 -603
  57. package/dist/lib/display/MorphSprite.d.ts +20 -20
  58. package/dist/lib/display/MorphSprite.js +246 -246
  59. package/dist/lib/display/MovieClip.d.ts +149 -149
  60. package/dist/lib/display/MovieClip.js +733 -733
  61. package/dist/lib/display/SimpleButton.d.ts +158 -158
  62. package/dist/lib/display/SimpleButton.js +228 -228
  63. package/dist/lib/display/Skybox.d.ts +144 -144
  64. package/dist/lib/display/Skybox.js +288 -288
  65. package/dist/lib/display/Sprite.d.ts +65 -65
  66. package/dist/lib/display/Sprite.d.ts.map +1 -1
  67. package/dist/lib/display/Sprite.js +134 -132
  68. package/dist/lib/display/TextField.d.ts +1104 -1104
  69. package/dist/lib/display/TextField.js +3018 -3018
  70. package/dist/lib/display/TextSprite.d.ts +16 -16
  71. package/dist/lib/display/TextSprite.js +36 -36
  72. package/dist/lib/elements/SkyboxElements.d.ts +29 -29
  73. package/dist/lib/elements/SkyboxElements.js +127 -127
  74. package/dist/lib/errors/CastError.d.ts +4 -4
  75. package/dist/lib/errors/CastError.js +10 -10
  76. package/dist/lib/events/CameraEvent.d.ts +16 -16
  77. package/dist/lib/events/CameraEvent.js +30 -30
  78. package/dist/lib/events/FocusEvent.d.ts +42 -42
  79. package/dist/lib/events/FocusEvent.js +43 -43
  80. package/dist/lib/events/KeyboardEvent.d.ts +21 -21
  81. package/dist/lib/events/KeyboardEvent.js +43 -43
  82. package/dist/lib/events/MouseEvent.d.ts +91 -91
  83. package/dist/lib/events/MouseEvent.js +122 -122
  84. package/dist/lib/events/PointerEvent.d.ts +93 -93
  85. package/dist/lib/events/PointerEvent.js +73 -73
  86. package/dist/lib/events/ResizeEvent.d.ts +15 -15
  87. package/dist/lib/events/ResizeEvent.js +38 -38
  88. package/dist/lib/events/TextfieldEvent.d.ts +19 -19
  89. package/dist/lib/events/TextfieldEvent.js +28 -28
  90. package/dist/lib/events/TouchEvent.d.ts +54 -54
  91. package/dist/lib/events/TouchEvent.js +89 -89
  92. package/dist/lib/factories/DefaultSceneGraphFactory.d.ts +27 -27
  93. package/dist/lib/factories/DefaultSceneGraphFactory.js +55 -55
  94. package/dist/lib/factories/ISceneGraphFactory.d.ts +20 -20
  95. package/dist/lib/factories/ISceneGraphFactory.js +1 -1
  96. package/dist/lib/image/SceneImage2D.d.ts +219 -219
  97. package/dist/lib/image/SceneImage2D.js +606 -606
  98. package/dist/lib/managers/DefaultFontManager.d.ts +14 -14
  99. package/dist/lib/managers/DefaultFontManager.js +101 -101
  100. package/dist/lib/managers/DeviceFontManager.d.ts +8 -8
  101. package/dist/lib/managers/DeviceFontManager.js +44 -44
  102. package/dist/lib/managers/FrameScriptManager.d.ts +37 -37
  103. package/dist/lib/managers/FrameScriptManager.js +386 -386
  104. package/dist/lib/managers/IInputRecorder.d.ts +3 -3
  105. package/dist/lib/managers/IInputRecorder.js +1 -1
  106. package/dist/lib/managers/MouseManager.d.ts +74 -74
  107. package/dist/lib/managers/MouseManager.js +803 -803
  108. package/dist/lib/prefabs/PrefabBase.d.ts +19 -19
  109. package/dist/lib/prefabs/PrefabBase.js +42 -42
  110. package/dist/lib/prefabs/PrimitiveCapsulePrefab.d.ts +56 -56
  111. package/dist/lib/prefabs/PrimitiveCapsulePrefab.js +269 -269
  112. package/dist/lib/prefabs/PrimitiveConePrefab.d.ts +21 -21
  113. package/dist/lib/prefabs/PrimitiveConePrefab.js +43 -43
  114. package/dist/lib/prefabs/PrimitiveCubePrefab.d.ts +74 -74
  115. package/dist/lib/prefabs/PrimitiveCubePrefab.js +545 -545
  116. package/dist/lib/prefabs/PrimitiveCylinderPrefab.d.ts +79 -79
  117. package/dist/lib/prefabs/PrimitiveCylinderPrefab.js +584 -584
  118. package/dist/lib/prefabs/PrimitivePlanePrefab.d.ts +65 -65
  119. package/dist/lib/prefabs/PrimitivePlanePrefab.js +300 -300
  120. package/dist/lib/prefabs/PrimitivePolygonPrefab.d.ts +29 -29
  121. package/dist/lib/prefabs/PrimitivePolygonPrefab.js +64 -64
  122. package/dist/lib/prefabs/PrimitivePrefabBase.d.ts +67 -67
  123. package/dist/lib/prefabs/PrimitivePrefabBase.js +158 -158
  124. package/dist/lib/prefabs/PrimitiveSpherePrefab.d.ts +48 -48
  125. package/dist/lib/prefabs/PrimitiveSpherePrefab.js +294 -294
  126. package/dist/lib/prefabs/PrimitiveTorusPrefab.d.ts +55 -55
  127. package/dist/lib/prefabs/PrimitiveTorusPrefab.js +260 -260
  128. package/dist/lib/text/AntiAliasType.d.ts +24 -24
  129. package/dist/lib/text/AntiAliasType.js +28 -28
  130. package/dist/lib/text/BitmapFontChar.d.ts +39 -39
  131. package/dist/lib/text/BitmapFontChar.js +42 -42
  132. package/dist/lib/text/BitmapFontTable.d.ts +73 -73
  133. package/dist/lib/text/BitmapFontTable.js +183 -183
  134. package/dist/lib/text/FNTGenerator.d.ts +10 -10
  135. package/dist/lib/text/FNTGenerator.js +74 -74
  136. package/dist/lib/text/FNTGeneratorCanvas.d.ts +22 -22
  137. package/dist/lib/text/FNTGeneratorCanvas.js +202 -202
  138. package/dist/lib/text/FNTGeneratrorBase.d.ts +7 -7
  139. package/dist/lib/text/FNTGeneratrorBase.js +7 -7
  140. package/dist/lib/text/Font.d.ts +38 -38
  141. package/dist/lib/text/Font.js +109 -109
  142. package/dist/lib/text/FontLookUpMode.d.ts +5 -5
  143. package/dist/lib/text/FontLookUpMode.js +7 -7
  144. package/dist/lib/text/FontStyleName.d.ts +6 -6
  145. package/dist/lib/text/FontStyleName.js +7 -7
  146. package/dist/lib/text/GridFitType.d.ts +31 -31
  147. package/dist/lib/text/GridFitType.js +35 -35
  148. package/dist/lib/text/HTMLTextProcessor.d.ts +8 -8
  149. package/dist/lib/text/HTMLTextProcessor.js +426 -426
  150. package/dist/lib/text/IFontTable.d.ts +16 -16
  151. package/dist/lib/text/IFontTable.js +1 -1
  152. package/dist/lib/text/TesselatedFontChar.d.ts +58 -58
  153. package/dist/lib/text/TesselatedFontChar.js +66 -66
  154. package/dist/lib/text/TesselatedFontTable.d.ts +88 -88
  155. package/dist/lib/text/TesselatedFontTable.js +963 -963
  156. package/dist/lib/text/TextFieldAutoSize.d.ts +28 -28
  157. package/dist/lib/text/TextFieldAutoSize.js +32 -32
  158. package/dist/lib/text/TextFieldType.d.ts +20 -20
  159. package/dist/lib/text/TextFieldType.js +24 -24
  160. package/dist/lib/text/TextFormat.d.ts +273 -273
  161. package/dist/lib/text/TextFormat.d.ts.map +1 -1
  162. package/dist/lib/text/TextFormat.js +449 -442
  163. package/dist/lib/text/TextFormatAlign.d.ts +26 -26
  164. package/dist/lib/text/TextFormatAlign.js +30 -30
  165. package/dist/lib/text/TextInteractionMode.d.ts +21 -21
  166. package/dist/lib/text/TextInteractionMode.js +25 -25
  167. package/dist/lib/text/TextLineMetrics.d.ts +61 -61
  168. package/dist/lib/text/TextLineMetrics.js +42 -42
  169. package/dist/lib/text/TextShape.d.ts +22 -22
  170. package/dist/lib/text/TextShape.js +75 -75
  171. package/dist/lib/tools/Merge.d.ts +81 -81
  172. package/dist/lib/tools/Merge.js +266 -266
  173. package/dist/lib/utils/Cast.d.ts +20 -20
  174. package/dist/lib/utils/Cast.js +271 -271
  175. package/index.ts +92 -92
  176. package/lib/Scene.ts +339 -339
  177. package/lib/Settings.ts +83 -83
  178. package/lib/adapters/IDisplayObjectAdapter.ts +23 -23
  179. package/lib/adapters/IFilter.ts +25 -25
  180. package/lib/adapters/IMovieClipAdapter.ts +26 -24
  181. package/lib/adapters/ITextfieldAdapter.ts +6 -6
  182. package/lib/base/IBitmapDrawable.ts +13 -13
  183. package/lib/base/IFrameLabel.ts +3 -3
  184. package/lib/base/IFrameScript.ts +4 -4
  185. package/lib/base/MouseButtons.ts +31 -31
  186. package/lib/base/Timeline.ts +715 -715
  187. package/lib/base/TimelineActionType.ts +18 -18
  188. package/lib/controllers/ControllerBase.ts +66 -66
  189. package/lib/controllers/FirstPersonController.ts +241 -241
  190. package/lib/controllers/FollowController.ts +22 -22
  191. package/lib/controllers/HoverController.ts +304 -304
  192. package/lib/controllers/LookAtController.ts +75 -75
  193. package/lib/controllers/SpringController.ts +91 -91
  194. package/lib/display/Billboard.ts +468 -468
  195. package/lib/display/Camera.ts +75 -75
  196. package/lib/display/DisplayObject.ts +1829 -1829
  197. package/lib/display/DisplayObjectContainer.ts +546 -546
  198. package/lib/display/LineSegment.ts +229 -229
  199. package/lib/display/LoaderContainer.ts +651 -651
  200. package/lib/display/MorphSprite.ts +339 -339
  201. package/lib/display/MovieClip.ts +870 -870
  202. package/lib/display/SimpleButton.ts +224 -224
  203. package/lib/display/Skybox.ts +352 -352
  204. package/lib/display/Sprite.ts +154 -150
  205. package/lib/display/TextField.ts +3875 -3875
  206. package/lib/display/TextSprite.ts +34 -34
  207. package/lib/elements/SkyboxElements.ts +141 -141
  208. package/lib/errors/CastError.ts +6 -6
  209. package/lib/events/CameraEvent.ts +29 -29
  210. package/lib/events/FocusEvent.ts +69 -69
  211. package/lib/events/KeyboardEvent.ts +40 -40
  212. package/lib/events/MouseEvent.ts +144 -144
  213. package/lib/events/PointerEvent.ts +145 -145
  214. package/lib/events/ResizeEvent.ts +31 -31
  215. package/lib/events/TextfieldEvent.ts +28 -28
  216. package/lib/events/TouchEvent.ts +103 -103
  217. package/lib/factories/DefaultSceneGraphFactory.ts +58 -58
  218. package/lib/factories/ISceneGraphFactory.ts +28 -28
  219. package/lib/image/SceneImage2D.ts +907 -907
  220. package/lib/managers/DefaultFontManager.ts +124 -124
  221. package/lib/managers/DeviceFontManager.ts +55 -55
  222. package/lib/managers/FrameScriptManager.ts +440 -440
  223. package/lib/managers/IInputRecorder.ts +2 -2
  224. package/lib/managers/MouseManager.ts +942 -942
  225. package/lib/prefabs/PrefabBase.ts +47 -47
  226. package/lib/prefabs/PrimitiveCapsulePrefab.ts +286 -286
  227. package/lib/prefabs/PrimitiveConePrefab.ts +37 -37
  228. package/lib/prefabs/PrimitiveCubePrefab.ts +630 -630
  229. package/lib/prefabs/PrimitiveCylinderPrefab.ts +657 -657
  230. package/lib/prefabs/PrimitivePlanePrefab.ts +352 -352
  231. package/lib/prefabs/PrimitivePolygonPrefab.ts +53 -53
  232. package/lib/prefabs/PrimitivePrefabBase.ts +177 -177
  233. package/lib/prefabs/PrimitiveSpherePrefab.ts +336 -336
  234. package/lib/prefabs/PrimitiveTorusPrefab.ts +282 -282
  235. package/lib/text/AntiAliasType.ts +24 -24
  236. package/lib/text/BitmapFontChar.ts +53 -53
  237. package/lib/text/BitmapFontTable.ts +213 -213
  238. package/lib/text/FNTGenerator.ts +100 -100
  239. package/lib/text/FNTGeneratorCanvas.ts +283 -283
  240. package/lib/text/FNTGeneratrorBase.ts +10 -10
  241. package/lib/text/Font.ts +114 -114
  242. package/lib/text/FontLookUpMode.ts +5 -5
  243. package/lib/text/FontStyleName.ts +6 -6
  244. package/lib/text/GridFitType.ts +32 -32
  245. package/lib/text/HTMLTextProcessor.ts +421 -421
  246. package/lib/text/IFontTable.ts +17 -17
  247. package/lib/text/TesselatedFontChar.ts +80 -80
  248. package/lib/text/TesselatedFontTable.ts +1181 -1181
  249. package/lib/text/TextFieldAutoSize.ts +30 -30
  250. package/lib/text/TextFieldType.ts +21 -21
  251. package/lib/text/TextFormat.ts +603 -603
  252. package/lib/text/TextFormatAlign.ts +28 -28
  253. package/lib/text/TextInteractionMode.ts +21 -21
  254. package/lib/text/TextLineMetrics.ts +74 -74
  255. package/lib/text/TextShape.ts +91 -91
  256. package/lib/tools/Merge.ts +311 -311
  257. package/lib/utils/Cast.ts +304 -304
  258. package/package.json +74 -74
  259. package/rollup.config.js +33 -33
  260. package/scripts/build.sh +2 -2
  261. package/scripts/gendocs.sh +14 -14
  262. package/scripts/genexamples.sh +14 -14
  263. package/scripts/genfull.sh +14 -14
  264. package/system.config.js +51 -51
  265. package/tsconfig.json +18 -18
@@ -1,1595 +1,1595 @@
1
- import { __extends } from "tslib";
2
- import { Transform, TransformEvent, Matrix3D, Vector3D, AssetBase, } from '@awayjs/core';
3
- import { BlendMode } from '@awayjs/stage';
4
- import { BoundingVolumeType, HierarchicalProperty, AlignmentMode, OrientationMode, } from '@awayjs/view';
5
- import { StyleEvent, ElementsType, } from '@awayjs/renderer';
6
- import { PrimitiveCubePrefab } from '../prefabs/PrimitiveCubePrefab';
7
- import { PrimitiveSpherePrefab } from '../prefabs/PrimitiveSpherePrefab';
8
- import { Sprite } from './Sprite';
9
- import { Settings } from '../Settings';
10
- /**
11
- * The DisplayObject class is the base class for all objects that can be
12
- * placed on the display list. The display list manages all objects displayed
13
- * in flash. Use the DisplayObjectContainer class to arrange the
14
- * display objects in the display list. DisplayObjectContainer objects can
15
- * have child display objects, while other display objects, such as Shape and
16
- * TextField objects, are "leaf" nodes that have only parents and siblings, no
17
- * children.
18
- *
19
- * <p>The DisplayObject class supports fbasic functionality like the <i>x</i>
20
- * and <i>y</i> position of an object, as well as more advanced properties of
21
- * the object such as its transformation matrix. </p>
22
- *
23
- * <p>DisplayObject is an abstract base class; therefore, you cannot call
24
- * DisplayObject directly. Invoking <code>new DisplayObject()</code> throws an
25
- * <code>ArgumentError</code> exception. </p>
26
- *
27
- * <p>All display objects inherit from the DisplayObject class.</p>
28
- *
29
- * <p>The DisplayObject class itself does not include any APIs for rendering
30
- * content onscreen. For that reason, if you want create a custom subclass of
31
- * the DisplayObject class, you will want to extend one of its subclasses that
32
- * do have APIs for rendering content onscreen, such as the Shape, Sprite,
33
- * Bitmap, SimpleButton, TextField, or MovieClip class.</p>
34
- *
35
- * <p>The DisplayObject class contains several broadcast events. Normally, the
36
- * target of any particular event is a specific DisplayObject instance. For
37
- * example, the target of an <code>added</code> event is the specific
38
- * DisplayObject instance that was added to the display list. Having a single
39
- * target restricts the placement of event listeners to that target and in
40
- * some cases the target's ancestors on the display list. With broadcast
41
- * events, however, the target is not a specific DisplayObject instance, but
42
- * rather all DisplayObject instances, including those that are not on the
43
- * display list. This means that you can add a listener to any DisplayObject
44
- * instance to listen for broadcast events. In addition to the broadcast
45
- * events listed in the DisplayObject class's Events table, the DisplayObject
46
- * class also inherits two broadcast events from the EventDispatcher class:
47
- * <code>activate</code> and <code>deactivate</code>.</p>
48
- *
49
- * <p>Some properties previously used in the ActionScript 1.0 and 2.0
50
- * MovieClip, TextField, and Button classes(such as <code>_alpha</code>,
51
- * <code>_height</code>, <code>_pName</code>, <code>_width</code>,
52
- * <code>_x</code>, <code>_y</code>, and others) have equivalents in the
53
- * ActionScript 3.0 DisplayObject class that are renamed so that they no
54
- * longer begin with the underscore(_) character.</p>
55
- *
56
- * <p>For more information, see the "Display Programming" chapter of the
57
- * <i>ActionScript 3.0 Developer's Guide</i>.</p>
58
- *
59
- * @event added Dispatched when a display object is added to the
60
- * display list. The following methods trigger this
61
- * event:
62
- * <code>DisplayObjectContainer.addChild()</code>,
63
- * <code>DisplayObjectContainer.addChildAt()</code>.
64
- * @event addedToScene Dispatched when a display object is added to the on
65
- * scene display list, either directly or through the
66
- * addition of a sub tree in which the display object
67
- * is contained. The following methods trigger this
68
- * event:
69
- * <code>DisplayObjectContainer.addChild()</code>,
70
- * <code>DisplayObjectContainer.addChildAt()</code>.
71
- * @event enterFrame [broadcast event] Dispatched when the playhead is
72
- * entering a new frame. If the playhead is not
73
- * moving, or if there is only one frame, this event
74
- * is dispatched continuously in conjunction with the
75
- * frame rate. This event is a broadcast event, which
76
- * means that it is dispatched by all display objects
77
- * with a listener registered for this event.
78
- * @event exitFrame [broadcast event] Dispatched when the playhead is
79
- * exiting the current frame. All frame scripts have
80
- * been run. If the playhead is not moving, or if
81
- * there is only one frame, this event is dispatched
82
- * continuously in conjunction with the frame rate.
83
- * This event is a broadcast event, which means that
84
- * it is dispatched by all display objects with a
85
- * listener registered for this event.
86
- * @event frameConstructed [broadcast event] Dispatched after the constructors
87
- * of frame display objects have run but before frame
88
- * scripts have run. If the playhead is not moving, or
89
- * if there is only one frame, this event is
90
- * dispatched continuously in conjunction with the
91
- * frame rate. This event is a broadcast event, which
92
- * means that it is dispatched by all display objects
93
- * with a listener registered for this event.
94
- * @event removed Dispatched when a display object is about to be
95
- * removed from the display list. Two methods of the
96
- * DisplayObjectContainer class generate this event:
97
- * <code>removeChild()</code> and
98
- * <code>removeChildAt()</code>.
99
- *
100
- * <p>The following methods of a
101
- * DisplayObjectContainer object also generate this
102
- * event if an object must be removed to make room for
103
- * the new object: <code>addChild()</code>,
104
- * <code>addChildAt()</code>, and
105
- * <code>setChildIndex()</code>. </p>
106
- * @event removedFromScene Dispatched when a display object is about to be
107
- * removed from the display list, either directly or
108
- * through the removal of a sub tree in which the
109
- * display object is contained. Two methods of the
110
- * DisplayObjectContainer class generate this event:
111
- * <code>removeChild()</code> and
112
- * <code>removeChildAt()</code>.
113
- *
114
- * <p>The following methods of a
115
- * DisplayObjectContainer object also generate this
116
- * event if an object must be removed to make room for
117
- * the new object: <code>addChild()</code>,
118
- * <code>addChildAt()</code>, and
119
- * <code>setChildIndex()</code>. </p>
120
- * @event render [broadcast event] Dispatched when the display list
121
- * is about to be updated and rendered. This event
122
- * provides the last opportunity for objects listening
123
- * for this event to make changes before the display
124
- * list is rendered. You must call the
125
- * <code>invalidate()</code> method of the Scene
126
- * object each time you want a <code>render</code>
127
- * event to be dispatched. <code>Render</code> events
128
- * are dispatched to an object only if there is mutual
129
- * trust between it and the object that called
130
- * <code>Scene.invalidate()</code>. This event is a
131
- * broadcast event, which means that it is dispatched
132
- * by all display objects with a listener registered
133
- * for this event.
134
- *
135
- * <p><b>Note: </b>This event is not dispatched if the
136
- * display is not rendering. This is the case when the
137
- * content is either minimized or obscured. </p>
138
- */
139
- var DisplayObject = /** @class */ (function (_super) {
140
- __extends(DisplayObject, _super);
141
- /**
142
- * Creates a new <code>DisplayObject</code> instance.
143
- */
144
- function DisplayObject() {
145
- var _this = _super.call(this) || this;
146
- _this._renderObjects = {};
147
- _this._containerNodes = {};
148
- _this._mouseChildren = true;
149
- _this._sessionID = -1;
150
- _this._avmDepthID = -1;
151
- _this._alignmentMode = AlignmentMode.REGISTRATION_POINT;
152
- _this._visible = true;
153
- _this._maskId = -1;
154
- _this._mouseEnabled = true;
155
- _this._maskMode = false;
156
- _this.isSlice9ScaledMC = false;
157
- _this.isSlice9ScaledSprite = false;
158
- _this.isAVMScene = false;
159
- // this is needed for AVM1 - todo: maybe do this on adapters ?
160
- _this.placeObjectTag = null;
161
- /**
162
- * A value from the BlendMode class that specifies which blend mode to use. A
163
- * bitmap can be drawn internally in two ways. If you have a blend mode
164
- * enabled or an external clipping mask, the bitmap is drawn by adding a
165
- * bitmap-filled square shape to the vector render. If you attempt to set
166
- * this property to an invalid value, Flash runtimes set the value to
167
- * <code>BlendMode.NORMAL</code>.
168
- *
169
- * <p>The <code>blendMode</code> property affects each pixel of the display
170
- * object. Each pixel is composed of three constituent colors(red, green,
171
- * and blue), and each constituent color has a value between 0x00 and 0xFF.
172
- * Flash Player or Adobe AIR compares each constituent color of one pixel in
173
- * the movie clip with the corresponding color of the pixel in the
174
- * background. For example, if <code>blendMode</code> is set to
175
- * <code>BlendMode.LIGHTEN</code>, Flash Player or Adobe AIR compares the red
176
- * value of the display object with the red value of the background, and uses
177
- * the lighter of the two as the value for the red component of the displayed
178
- * color.</p>
179
- *
180
- * <p>The following table describes the <code>blendMode</code> settings. The
181
- * BlendMode class defines string values you can use. The illustrations in
182
- * the table show <code>blendMode</code> values applied to a circular display
183
- * object(2) superimposed on another display object(1).</p>
184
- */
185
- _this._blendMode = BlendMode.NORMAL;
186
- /**
187
- *
188
- */
189
- _this.castsShadows = true;
190
- /**
191
- * An indexed array that contains each filter object currently associated
192
- * with the display object. The flash.filters package contains several
193
- * classes that define specific filters you can use.
194
- *
195
- * <p>Filters can be applied in Flash Professional at design time, or at run
196
- * time by using ActionScript code. To apply a filter by using ActionScript,
197
- * you must make a temporary copy of the entire <code>filters</code> array,
198
- * modify the temporary array, then assign the value of the temporary array
199
- * back to the <code>filters</code> array. You cannot directly add a new
200
- * filter object to the <code>filters</code> array.</p>
201
- *
202
- * <p>To add a filter by using ActionScript, perform the following steps
203
- * (assume that the target display object is named
204
- * <code>myDisplayObject</code>):</p>
205
- *
206
- * <ol>
207
- * <li>Create a new filter object by using the constructor method of your
208
- * chosen filter class.</li>
209
- * <li>Assign the value of the <code>myDisplayObject.filters</code> array
210
- * to a temporary array, such as one named <code>myFilters</code>.</li>
211
- * <li>Add the new filter object to the <code>myFilters</code> temporary
212
- * array.</li>
213
- * <li>Assign the value of the temporary array to the
214
- * <code>myDisplayObject.filters</code> array.</li>
215
- * </ol>
216
- *
217
- * <p>If the <code>filters</code> array is undefined, you do not need to use
218
- * a temporary array. Instead, you can directly assign an array literal that
219
- * contains one or more filter objects that you create. The first example in
220
- * the Examples section adds a drop shadow filter by using code that handles
221
- * both defined and undefined <code>filters</code> arrays.</p>
222
- *
223
- * <p>To modify an existing filter object, you must use the technique of
224
- * modifying a copy of the <code>filters</code> array:</p>
225
- *
226
- * <ol>
227
- * <li>Assign the value of the <code>filters</code> array to a temporary
228
- * array, such as one named <code>myFilters</code>.</li>
229
- * <li>Modify the property by using the temporary array,
230
- * <code>myFilters</code>. For example, to set the quality property of the
231
- * first filter in the array, you could use the following code:
232
- * <code>myFilters[0].quality = 1;</code></li>
233
- * <li>Assign the value of the temporary array to the <code>filters</code>
234
- * array.</li>
235
- * </ol>
236
- *
237
- * <p>At load time, if a display object has an associated filter, it is
238
- * marked to cache itself as a transparent bitmap. From this point forward,
239
- * as long as the display object has a valid filter list, the player caches
240
- * the display object as a bitmap. This source bitmap is used as a source
241
- * image for the filter effects. Each display object usually has two bitmaps:
242
- * one with the original unfiltered source display object and another for the
243
- * final image after filtering. The final image is used when rendering. As
244
- * long as the display object does not change, the final image does not need
245
- * updating.</p>
246
- *
247
- * <p>The flash.filters package includes classes for filters. For example, to
248
- * create a DropShadow filter, you would write:</p>
249
- *
250
- * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
251
- * and the shader output type is not compatible with
252
- * this operation(the shader must specify a
253
- * <code>pixel4</code> output).
254
- * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
255
- * and the shader doesn't specify any image input or
256
- * the first input is not an <code>image4</code> input.
257
- * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
258
- * and the shader specifies an image input that isn't
259
- * provided.
260
- * @throws ArgumentError When <code>filters</code> includes a ShaderFilter, a
261
- * ByteArray or Vector.<Number> instance as a shader
262
- * input, and the <code>width</code> and
263
- * <code>height</code> properties aren't specified for
264
- * the ShaderInput object, or the specified values
265
- * don't match the amount of data in the input data.
266
- * See the <code>ShaderInput.input</code> property for
267
- * more information.
268
- */
269
- _this._filters = null;
270
- /**
271
- *
272
- */
273
- _this.orientationMode = OrientationMode.DEFAULT;
274
- /**
275
- *
276
- */
277
- _this.zOffset = 0;
278
- _this.hasDispatchedAddedToStage = false;
279
- _this.cursorType = '';
280
- _this._isInFocus = false;
281
- _this._tabEnabled = false;
282
- _this._tabIndex = -1;
283
- _this._avmDepthID = -1;
284
- //global debug bounding boxes:
285
- //this._boundsVisible=true;
286
- _this._onInvalidatePropertiesDelegate = function (event) { return _this._onInvalidateProperties(event); };
287
- _this._onInvalidateImagesDelegate = function (event) { return _this._onInvalidateImages(event); };
288
- //creation of associated transform object
289
- _this._transform = new Transform(null);
290
- //setup transform listeners
291
- _this._transform.addEventListener(TransformEvent.INVALIDATE_MATRIX3D, function (_event) { return _this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM); });
292
- _this._transform.addEventListener(TransformEvent.INVALIDATE_COLOR_TRANSFORM, function (_event) { return _this._invalidateHierarchicalProperty(HierarchicalProperty.COLOR_TRANSFORM); });
293
- //bounding volume dictonary
294
- //default bounds type
295
- _this._defaultBoundingVolume = _this._getDefaultBoundingVolume();
296
- return _this;
297
- }
298
- DisplayObject.prototype.getScriptPrecedence = function () {
299
- if (!this._parent) {
300
- return [];
301
- }
302
- var result = this._parent.getScriptPrecedence();
303
- if (this.placeObjectTag) {
304
- result.push(this.placeObjectTag.actionBlocksPrecedence);
305
- }
306
- return result;
307
- };
308
- DisplayObject.prototype.getMouseCursor = function () {
309
- return 'initial';
310
- };
311
- Object.defineProperty(DisplayObject.prototype, "tabEnabled", {
312
- get: function () {
313
- return this._tabEnabled;
314
- },
315
- set: function (value) {
316
- this._tabEnabled = value;
317
- },
318
- enumerable: false,
319
- configurable: true
320
- });
321
- Object.defineProperty(DisplayObject.prototype, "tabIndex", {
322
- get: function () {
323
- return this._tabIndex;
324
- },
325
- set: function (value) {
326
- this._tabIndex = value;
327
- },
328
- enumerable: false,
329
- configurable: true
330
- });
331
- Object.defineProperty(DisplayObject.prototype, "isInFocus", {
332
- get: function () {
333
- return this._isInFocus;
334
- },
335
- set: function (value) {
336
- this._isInFocus = value;
337
- },
338
- enumerable: false,
339
- configurable: true
340
- });
341
- DisplayObject.prototype.setFocus = function (value, fromMouseDown, sendSoftKeyEvent) {
342
- if (fromMouseDown === void 0) { fromMouseDown = false; }
343
- if (sendSoftKeyEvent === void 0) { sendSoftKeyEvent = true; }
344
- if (this._isInFocus == value)
345
- return;
346
- this._isInFocus = value;
347
- };
348
- Object.defineProperty(DisplayObject.prototype, "alignmentMode", {
349
- /**
350
- *
351
- */
352
- get: function () {
353
- return this._alignmentMode;
354
- },
355
- set: function (value) {
356
- if (this._alignmentMode == value)
357
- return;
358
- this._alignmentMode = value;
359
- this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
360
- },
361
- enumerable: false,
362
- configurable: true
363
- });
364
- Object.defineProperty(DisplayObject.prototype, "alpha", {
365
- /**
366
- * Indicates the alpha transparency value of the object specified. Valid
367
- * values are 0(fully transparent) to 1(fully opaque). The default value is
368
- * 1. Display objects with <code>alpha</code> set to 0 <i>are</i> active,
369
- * even though they are invisible.
370
- */
371
- get: function () {
372
- return this._transform.colorTransform.alphaMultiplier;
373
- },
374
- set: function (value) {
375
- this._transform.colorTransform.alphaMultiplier = value;
376
- this._transform.invalidateColorTransform();
377
- },
378
- enumerable: false,
379
- configurable: true
380
- });
381
- Object.defineProperty(DisplayObject.prototype, "blendMode", {
382
- get: function () {
383
- if (!Settings.USE_UNSAFE_BLENDS) {
384
- return '';
385
- }
386
- if (Settings.REMAP_BLEND_MODE) {
387
- return Settings.BLEND_MODE_REMAP_TABLE[this._blendMode] || this._blendMode;
388
- }
389
- return this._blendMode;
390
- },
391
- set: function (v) {
392
- if (this._blendMode === v) {
393
- return;
394
- }
395
- this._blendMode = v;
396
- if (v === BlendMode.OVERLAY) {
397
- this._transform.invalidateColorTransform();
398
- }
399
- this.invalidate();
400
- },
401
- enumerable: false,
402
- configurable: true
403
- });
404
- Object.defineProperty(DisplayObject.prototype, "defaultBoundingVolume", {
405
- /**
406
- *
407
- */
408
- get: function () {
409
- return this._defaultBoundingVolume;
410
- },
411
- set: function (value) {
412
- if (this._defaultBoundingVolume == value)
413
- return;
414
- this._defaultBoundingVolume = value;
415
- if (this._boundsPrimitive) {
416
- this._boundsPrimitive.dispose();
417
- this._boundsPrimitive = null;
418
- }
419
- this.invalidate();
420
- },
421
- enumerable: false,
422
- configurable: true
423
- });
424
- Object.defineProperty(DisplayObject.prototype, "cacheAsBitmap", {
425
- get: function () {
426
- return this._bitmapCache;
427
- },
428
- set: function (v) {
429
- if (v === this._bitmapCache) {
430
- return;
431
- }
432
- if (!Settings.USE_UNSAFE_CACHE_AS_BITMAP) {
433
- return;
434
- }
435
- v && console.warn('[@scene/DisplayObject] Unsafe cacheAsBitmap is enabled!' +
436
- 'You can disable it by `Settings.USE_UNSAFE_CACHE_AS_BITMAP = false`', this.id);
437
- this._bitmapCache = v;
438
- },
439
- enumerable: false,
440
- configurable: true
441
- });
442
- Object.defineProperty(DisplayObject.prototype, "eulers", {
443
- /**
444
- * Defines the rotation of the 3d object as a <code>Vector3D</code>
445
- * object containing euler angles for rotation around x, y and z axis.
446
- */
447
- get: function () {
448
- if (!this._eulers)
449
- this._eulers = new Vector3D();
450
- this._eulers.x = this.rotationX;
451
- this._eulers.y = this.rotationY;
452
- this._eulers.z = this.rotationZ;
453
- return this._eulers;
454
- },
455
- set: function (value) {
456
- // previously this was using the setters for rotationX etc
457
- // but because this will convert from radians to degree, i changed it to update directly
458
- this._transform.rotation.x = value.x;
459
- this._transform.rotation.y = value.y;
460
- this._transform.rotation.z = value.z;
461
- this._transform.invalidateMatrix3D();
462
- },
463
- enumerable: false,
464
- configurable: true
465
- });
466
- Object.defineProperty(DisplayObject.prototype, "filters", {
467
- get: function () {
468
- return this._filters;
469
- },
470
- set: function (v) {
471
- if (!Settings.USE_UNSAFE_FILTERS) {
472
- return;
473
- }
474
- this._filters = v;
475
- this._invalidateStyle();
476
- },
477
- enumerable: false,
478
- configurable: true
479
- });
480
- DisplayObject.prototype.updateFilters = function (_newFilters) {
481
- console.warn('[scene/DisplayObject] - updateFilters is just a stub');
482
- };
483
- Object.defineProperty(DisplayObject.prototype, "index", {
484
- /**
485
- * Indicates the instance container index of the DisplayObject. The object can be
486
- * identified in the child list of its parent display object container by
487
- * calling the <code>getChildByIndex()</code> method of the display object
488
- * container.
489
- *
490
- * <p>If the DisplayObject has no parent container, index defaults to 0.</p>
491
- */
492
- get: function () {
493
- if (this._parent)
494
- return this._parent.getChildIndex(this);
495
- return 0;
496
- },
497
- enumerable: false,
498
- configurable: true
499
- });
500
- Object.defineProperty(DisplayObject.prototype, "loader", {
501
- /**
502
- * Returns a LoaderInfo object containing information about loading the file
503
- * to which this display object belongs. The <code>loaderInfo</code> property
504
- * is defined only for the root display object of a SWF file or for a loaded
505
- * Bitmap(not for a Bitmap that is drawn with ActionScript). To find the
506
- * <code>loaderInfo</code> object associated with the SWF file that contains
507
- * a display object named <code>myDisplayObject</code>, use
508
- * <code>myDisplayObject.root.loaderInfo</code>.
509
- *
510
- * <p>A large SWF file can monitor its download by calling
511
- * <code>this.root.loaderInfo.addEventListener(Event.COMPLETE,
512
- * func)</code>.</p>
513
- */
514
- get: function () {
515
- return this._loader;
516
- },
517
- enumerable: false,
518
- configurable: true
519
- });
520
- Object.defineProperty(DisplayObject.prototype, "mask", {
521
- /**
522
- * The calling display object is masked by the specified <code>mask</code>
523
- * object. To ensure that masking works when the Stage is scaled, the
524
- * <code>mask</code> display object must be in an active part of the display
525
- * list. The <code>mask</code> object itself is not drawn. Set
526
- * <code>mask</code> to <code>null</code> to remove the mask.
527
- *
528
- * <p>To be able to scale a mask object, it must be on the display list. To
529
- * be able to drag a mask Sprite object(by calling its
530
- * <code>startDrag()</code> method), it must be on the display list. To call
531
- * the <code>startDrag()</code> method for a mask sprite based on a
532
- * <code>mouseDown</code> event being dispatched by the sprite, set the
533
- * sprite's <code>buttonMode</code> property to <code>true</code>.</p>
534
- *
535
- * <p>When display objects are cached by setting the
536
- * <code>cacheAsBitmap</code> property to <code>true</code> an the
537
- * <code>cacheAsBitmapMatrix</code> property to a Matrix object, both the
538
- * mask and the display object being masked must be part of the same cached
539
- * bitmap. Thus, if the display object is cached, then the mask must be a
540
- * child of the display object. If an ancestor of the display object on the
541
- * display list is cached, then the mask must be a child of that ancestor or
542
- * one of its descendents. If more than one ancestor of the masked object is
543
- * cached, then the mask must be a descendent of the cached container closest
544
- * to the masked object in the display list.</p>
545
- *
546
- * <p><b>Note:</b> A single <code>mask</code> object cannot be used to mask
547
- * more than one calling display object. When the <code>mask</code> is
548
- * assigned to a second display object, it is removed as the mask of the
549
- * first object, and that object's <code>mask</code> property becomes
550
- * <code>null</code>.</p>
551
- */
552
- get: function () {
553
- return this._mask;
554
- },
555
- set: function (value) {
556
- if (this._mask === value)
557
- return;
558
- // remove older script mask
559
- if (this._mask)
560
- this._mask.maskMode = false;
561
- this._mask = value;
562
- if (value)
563
- value.maskMode = true;
564
- this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
565
- },
566
- enumerable: false,
567
- configurable: true
568
- });
569
- Object.defineProperty(DisplayObject.prototype, "maskMode", {
570
- get: function () {
571
- return this._maskMode;
572
- },
573
- set: function (value) {
574
- if (this._maskMode == value)
575
- return;
576
- this._maskMode = value;
577
- this._maskId = value ? this.id : -1;
578
- this._updateMaskMode();
579
- },
580
- enumerable: false,
581
- configurable: true
582
- });
583
- Object.defineProperty(DisplayObject.prototype, "pickObject", {
584
- get: function () {
585
- return this._pickObject;
586
- },
587
- set: function (value) {
588
- if (this._pickObject == value)
589
- return;
590
- this._pickObject = (value == this)
591
- ? null
592
- : value.pickObjectFromTimeline ? value.clone() : value;
593
- if (this._pickObject) {
594
- this._pickObject.mouseChildren = false;
595
- this._pickObject.mouseEnabled = false;
596
- }
597
- },
598
- enumerable: false,
599
- configurable: true
600
- });
601
- Object.defineProperty(DisplayObject.prototype, "mouseEnabled", {
602
- /**
603
- * Specifies whether this object receives mouse, or other user input,
604
- * messages. The default value is <code>true</code>, which means that by
605
- * default any InteractiveObject instance that is on the display list
606
- * receives mouse events or other user input events. If
607
- * <code>mouseEnabled</code> is set to <code>false</code>, the instance does
608
- * not receive any mouse events(or other user input events like keyboard
609
- * events). Any children of this instance on the display list are not
610
- * affected. To change the <code>mouseEnabled</code> behavior for all
611
- * children of an object on the display list, use
612
- * <code>flash.display.DisplayObjectContainer.mouseChildren</code>.
613
- *
614
- * <p> No event is dispatched by setting this property. You must use the
615
- * <code>addEventListener()</code> method to create interactive
616
- * functionality.</p>
617
- */
618
- get: function () {
619
- return this._mouseEnabled;
620
- },
621
- set: function (value) {
622
- if (this._mouseEnabled == value)
623
- return;
624
- this._mouseEnabled = value;
625
- },
626
- enumerable: false,
627
- configurable: true
628
- });
629
- Object.defineProperty(DisplayObject.prototype, "mouseX", {
630
- /**
631
- * Indicates the x coordinate of the mouse or user input device position, in
632
- * pixels.
633
- *
634
- * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned x
635
- * coordinate will reflect the non-rotated object.</p>
636
- */
637
- get: function () {
638
- return this._mouseX;
639
- },
640
- enumerable: false,
641
- configurable: true
642
- });
643
- Object.defineProperty(DisplayObject.prototype, "mouseY", {
644
- /**
645
- * Indicates the y coordinate of the mouse or user input device position, in
646
- * pixels.
647
- *
648
- * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned y
649
- * coordinate will reflect the non-rotated object.</p>
650
- */
651
- get: function () {
652
- return this._mouseY;
653
- },
654
- enumerable: false,
655
- configurable: true
656
- });
657
- Object.defineProperty(DisplayObject.prototype, "name", {
658
- /**
659
- * Indicates the instance name of the DisplayObject. The object can be
660
- * identified in the child list of its parent display object container by
661
- * calling the <code>getChildByName()</code> method of the display object
662
- * container.
663
- *
664
- * @throws IllegalOperationError If you are attempting to set this property
665
- * on an object that was placed on the timeline
666
- * in the Flash authoring tool.
667
- */
668
- get: function () {
669
- return this._pName ? this._pName : '';
670
- },
671
- set: function (value) {
672
- this._pName = value;
673
- },
674
- enumerable: false,
675
- configurable: true
676
- });
677
- Object.defineProperty(DisplayObject.prototype, "parent", {
678
- /**
679
- * Indicates the DisplayObjectContainer object that contains this display
680
- * object. Use the <code>parent</code> property to specify a relative path to
681
- * display objects that are above the current display object in the display
682
- * list hierarchy.
683
- *
684
- * <p>You can use <code>parent</code> to move up multiple levels in the
685
- * display list as in the following:</p>
686
- *
687
- * @throws SecurityError The parent display object belongs to a security
688
- * sandbox to which you do not have access. You can
689
- * avoid this situation by having the parent movie call
690
- * the <code>Security.allowDomain()</code> method.
691
- */
692
- get: function () {
693
- return this._parent;
694
- },
695
- enumerable: false,
696
- configurable: true
697
- });
698
- Object.defineProperty(DisplayObject.prototype, "registrationPoint", {
699
- /**
700
- * Defines the local point around which the object rotates.
701
- */
702
- get: function () {
703
- if (this._registrationMatrix3D)
704
- return new Vector3D(-this._registrationMatrix3D._rawData[12] * this.scaleX, -this._registrationMatrix3D._rawData[13] * this.scaleY, -this._registrationMatrix3D._rawData[14] * this.scaleZ);
705
- return null;
706
- },
707
- set: function (value) {
708
- if (!value) {
709
- if (!this._registrationMatrix3D)
710
- return;
711
- this._registrationMatrix3D._rawData[12] = 0;
712
- this._registrationMatrix3D._rawData[13] = 0;
713
- this._registrationMatrix3D._rawData[14] = 0;
714
- if (this._registrationMatrix3D.isIdentity())
715
- this._registrationMatrix3D = null;
716
- }
717
- else {
718
- if (!this._registrationMatrix3D)
719
- this._registrationMatrix3D = new Matrix3D();
720
- this._registrationMatrix3D._rawData[12] = -value.x / this._transform.scale.x;
721
- this._registrationMatrix3D._rawData[13] = -value.y / this._transform.scale.y;
722
- this._registrationMatrix3D._rawData[14] = -value.z / this._transform.scale.z;
723
- }
724
- this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
725
- },
726
- enumerable: false,
727
- configurable: true
728
- });
729
- Object.defineProperty(DisplayObject.prototype, "registrationScale", {
730
- /**
731
- * Defines the local scale.
732
- */
733
- get: function () {
734
- if (this._registrationMatrix3D)
735
- return new Vector3D(this._registrationMatrix3D._rawData[0], this._registrationMatrix3D._rawData[5], this._registrationMatrix3D._rawData[10]);
736
- return null;
737
- },
738
- set: function (value) {
739
- if (!value) {
740
- if (!this._registrationMatrix3D)
741
- return;
742
- this._registrationMatrix3D._rawData[0] = 1;
743
- this._registrationMatrix3D._rawData[5] = 1;
744
- this._registrationMatrix3D._rawData[10] = 1;
745
- if (this._registrationMatrix3D.isIdentity())
746
- this._registrationMatrix3D = null;
747
- }
748
- else {
749
- if (!this._registrationMatrix3D)
750
- this._registrationMatrix3D = new Matrix3D();
751
- this._registrationMatrix3D._rawData[0] = value.x;
752
- this._registrationMatrix3D._rawData[5] = value.y;
753
- this._registrationMatrix3D._rawData[10] = value.z;
754
- }
755
- this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
756
- },
757
- enumerable: false,
758
- configurable: true
759
- });
760
- Object.defineProperty(DisplayObject.prototype, "root", {
761
- /**
762
- * For a display object in a loaded SWF file, the <code>root</code> property
763
- * is the top-most display object in the portion of the display list's tree
764
- * structure represented by that SWF file. For a Bitmap object representing a
765
- * loaded image file, the <code>root</code> property is the Bitmap object
766
- * itself. For the instance of the main class of the first SWF file loaded,
767
- * the <code>root</code> property is the display object itself. The
768
- * <code>root</code> property of the Scene object is the Scene object itself.
769
- * The <code>root</code> property is set to <code>null</code> for any display
770
- * object that has not been added to the display list, unless it has been
771
- * added to a display object container that is off the display list but that
772
- * is a child of the top-most display object in a loaded SWF file.
773
- *
774
- * <p>For example, if you create a new Sprite object by calling the
775
- * <code>Sprite()</code> constructor method, its <code>root</code> property
776
- * is <code>null</code> until you add it to the display list(or to a display
777
- * object container that is off the display list but that is a child of the
778
- * top-most display object in a SWF file).</p>
779
- *
780
- * <p>For a loaded SWF file, even though the Loader object used to load the
781
- * file may not be on the display list, the top-most display object in the
782
- * SWF file has its <code>root</code> property set to itself. The Loader
783
- * object does not have its <code>root</code> property set until it is added
784
- * as a child of a display object for which the <code>root</code> property is
785
- * set.</p>
786
- */
787
- get: function () {
788
- return this._root;
789
- },
790
- enumerable: false,
791
- configurable: true
792
- });
793
- Object.defineProperty(DisplayObject.prototype, "rotationX", {
794
- /**
795
- * Indicates the x-axis rotation of the DisplayObject instance, in degrees,
796
- * from its original orientation relative to the 3D parent container. Values
797
- * from 0 to 180 represent clockwise rotation; values from 0 to -180
798
- * represent counterclockwise rotation. Values outside this range are added
799
- * to or subtracted from 360 to obtain a value within the range.
800
- */
801
- get: function () {
802
- return this._transform.rotation.x;
803
- },
804
- set: function (val) {
805
- if (this.rotationX == val)
806
- return;
807
- this._transform.rotation.x = val;
808
- this._transform.invalidateMatrix3D();
809
- },
810
- enumerable: false,
811
- configurable: true
812
- });
813
- Object.defineProperty(DisplayObject.prototype, "rotationY", {
814
- /**
815
- * Indicates the y-axis rotation of the DisplayObject instance, in degrees,
816
- * from its original orientation relative to the 3D parent container. Values
817
- * from 0 to 180 represent clockwise rotation; values from 0 to -180
818
- * represent counterclockwise rotation. Values outside this range are added
819
- * to or subtracted from 360 to obtain a value within the range.
820
- */
821
- get: function () {
822
- return this._transform.rotation.y;
823
- },
824
- set: function (val) {
825
- if (this.rotationY == val)
826
- return;
827
- this._transform.rotation.y = val;
828
- this._transform.invalidateMatrix3D();
829
- },
830
- enumerable: false,
831
- configurable: true
832
- });
833
- Object.defineProperty(DisplayObject.prototype, "rotationZ", {
834
- /**
835
- * Indicates the z-axis rotation of the DisplayObject instance, in degrees,
836
- * from its original orientation relative to the 3D parent container. Values
837
- * from 0 to 180 represent clockwise rotation; values from 0 to -180
838
- * represent counterclockwise rotation. Values outside this range are added
839
- * to or subtracted from 360 to obtain a value within the range.
840
- */
841
- get: function () {
842
- return this._transform.rotation.z;
843
- },
844
- set: function (val) {
845
- if (this.rotationZ == val)
846
- return;
847
- this._transform.rotation.z = val;
848
- this._transform.invalidateMatrix3D();
849
- },
850
- enumerable: false,
851
- configurable: true
852
- });
853
- Object.defineProperty(DisplayObject.prototype, "scale9Grid", {
854
- /**
855
- * The current scaling grid that is in effect. If set to <code>null</code>,
856
- * the entire display object is scaled normally when any scale transformation
857
- * is applied.
858
- *
859
- * <p>When you define the <code>scale9Grid</code> property, the display
860
- * object is divided into a grid with nine regions based on the
861
- * <code>scale9Grid</code> rectangle, which defines the center region of the
862
- * grid. The eight other regions of the grid are the following areas: </p>
863
- *
864
- * <ul>
865
- * <li>The upper-left corner outside of the rectangle</li>
866
- * <li>The area above the rectangle </li>
867
- * <li>The upper-right corner outside of the rectangle</li>
868
- * <li>The area to the left of the rectangle</li>
869
- * <li>The area to the right of the rectangle</li>
870
- * <li>The lower-left corner outside of the rectangle</li>
871
- * <li>The area below the rectangle</li>
872
- * <li>The lower-right corner outside of the rectangle</li>
873
- * </ul>
874
- *
875
- * <p>You can think of the eight regions outside of the center(defined by
876
- * the rectangle) as being like a picture frame that has special rules
877
- * applied to it when scaled.</p>
878
- *
879
- * <p>When the <code>scale9Grid</code> property is set and a display object
880
- * is scaled, all text and gradients are scaled normally; however, for other
881
- * types of objects the following rules apply:</p>
882
- *
883
- * <ul>
884
- * <li>Content in the center region is scaled normally. </li>
885
- * <li>Content in the corners is not scaled. </li>
886
- * <li>Content in the top and bottom regions is scaled horizontally only.
887
- * Content in the left and right regions is scaled vertically only.</li>
888
- * <li>All fills(including bitmaps, video, and gradients) are stretched to
889
- * fit their shapes.</li>
890
- * </ul>
891
- *
892
- * <p>If a display object is rotated, all subsequent scaling is normal(and
893
- * the <code>scale9Grid</code> property is ignored).</p>
894
- *
895
- * <p>For example, consider the following display object and a rectangle that
896
- * is applied as the display object's <code>scale9Grid</code>:</p>
897
- *
898
- * <p>A common use for setting <code>scale9Grid</code> is to set up a display
899
- * object to be used as a component, in which edge regions retain the same
900
- * width when the component is scaled.</p>
901
- *
902
- * @throws ArgumentError If you pass an invalid argument to the method.
903
- */
904
- get: function () {
905
- return this._scale9Grid;
906
- },
907
- set: function (value) {
908
- this._scale9Grid = value;
909
- this._invalidateHierarchicalProperty(HierarchicalProperty.SCALE9);
910
- },
911
- enumerable: false,
912
- configurable: true
913
- });
914
- Object.defineProperty(DisplayObject.prototype, "scaleX", {
915
- /**
916
- * Indicates the horizontal scale(percentage) of the object as applied from
917
- * the registration point. The default registration point is(0,0). 1.0
918
- * equals 100% scale.
919
- *
920
- * <p>Scaling the local coordinate system changes the <code>x</code> and
921
- * <code>y</code> property values, which are defined in whole pixels. </p>
922
- */
923
- get: function () {
924
- return this._transform.scale.x;
925
- },
926
- set: function (val) {
927
- //this._updateAbsoluteDimension();
928
- this._setScaleX(val);
929
- },
930
- enumerable: false,
931
- configurable: true
932
- });
933
- Object.defineProperty(DisplayObject.prototype, "scaleY", {
934
- /**
935
- * Indicates the vertical scale(percentage) of an object as applied from the
936
- * registration point of the object. The default registration point is(0,0).
937
- * 1.0 is 100% scale.
938
- *
939
- * <p>Scaling the local coordinate system changes the <code>x</code> and
940
- * <code>y</code> property values, which are defined in whole pixels. </p>
941
- */
942
- get: function () {
943
- return this._transform.scale.y;
944
- },
945
- set: function (val) {
946
- //this._updateAbsoluteDimension();
947
- this._setScaleY(val);
948
- },
949
- enumerable: false,
950
- configurable: true
951
- });
952
- Object.defineProperty(DisplayObject.prototype, "scaleZ", {
953
- /**
954
- * Indicates the depth scale(percentage) of an object as applied from the
955
- * registration point of the object. The default registration point is(0,0).
956
- * 1.0 is 100% scale.
957
- *
958
- * <p>Scaling the local coordinate system changes the <code>x</code>,
959
- * <code>y</code> and <code>z</code> property values, which are defined in
960
- * whole pixels. </p>
961
- */
962
- get: function () {
963
- return this._transform.scale.z;
964
- },
965
- set: function (val) {
966
- //this._updateAbsoluteDimension();
967
- this._setScaleZ(val);
968
- },
969
- enumerable: false,
970
- configurable: true
971
- });
972
- Object.defineProperty(DisplayObject.prototype, "skewX", {
973
- /**
974
- * Indicates the horizontal skew(angle) of the object as applied from
975
- * the registration point. The default registration point is(0,0).
976
- */
977
- get: function () {
978
- return this._transform.skew.x;
979
- },
980
- set: function (val) {
981
- if (this.skewX == val)
982
- return;
983
- this._transform.skew.x = val;
984
- this._transform.invalidateMatrix3D();
985
- },
986
- enumerable: false,
987
- configurable: true
988
- });
989
- Object.defineProperty(DisplayObject.prototype, "skewY", {
990
- /**
991
- * Indicates the vertical skew(angle) of an object as applied from the
992
- * registration point of the object. The default registration point is(0,0).
993
- */
994
- get: function () {
995
- return this._transform.skew.y;
996
- },
997
- set: function (val) {
998
- if (this.skewY == val)
999
- return;
1000
- this._transform.skew.y = val;
1001
- this._transform.invalidateMatrix3D();
1002
- },
1003
- enumerable: false,
1004
- configurable: true
1005
- });
1006
- Object.defineProperty(DisplayObject.prototype, "skewZ", {
1007
- /**
1008
- * Indicates the depth skew(angle) of an object as applied from the
1009
- * registration point of the object. The default registration point is(0,0).
1010
- */
1011
- get: function () {
1012
- return this._transform.skew.z;
1013
- },
1014
- set: function (val) {
1015
- if (this.skewZ == val)
1016
- return;
1017
- this._transform.skew.z = val;
1018
- this._transform.invalidateMatrix3D();
1019
- },
1020
- enumerable: false,
1021
- configurable: true
1022
- });
1023
- Object.defineProperty(DisplayObject.prototype, "scrollRect", {
1024
- /**
1025
- * The scroll rectangle bounds of the display object. The display object is
1026
- * cropped to the size defined by the rectangle, and it scrolls within the
1027
- * rectangle when you change the <code>x</code> and <code>y</code> properties
1028
- * of the <code>scrollRect</code> object.
1029
- *
1030
- * <p>The properties of the <code>scrollRect</code> Rectangle object use the
1031
- * display object's coordinate space and are scaled just like the overall
1032
- * display object. The corner bounds of the cropped window on the scrolling
1033
- * display object are the origin of the display object(0,0) and the point
1034
- * defined by the width and height of the rectangle. They are not centered
1035
- * around the origin, but use the origin to define the upper-left corner of
1036
- * the area. A scrolled display object always scrolls in whole pixel
1037
- * increments. </p>
1038
- *
1039
- * <p>You can scroll an object left and right by setting the <code>x</code>
1040
- * property of the <code>scrollRect</code> Rectangle object. You can scroll
1041
- * an object up and down by setting the <code>y</code> property of the
1042
- * <code>scrollRect</code> Rectangle object. If the display object is rotated
1043
- * 90° and you scroll it left and right, the display object actually scrolls
1044
- * up and down.</p>
1045
- */
1046
- get: function () {
1047
- var _a;
1048
- return (_a = this._scrollRect) === null || _a === void 0 ? void 0 : _a.clone();
1049
- },
1050
- set: function (value) {
1051
- var invalidatePos = true;
1052
- if (!!this._scrollRect != !!value) {
1053
- //invalidate masks only if scrollRect is being enabled or disabled
1054
- this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1055
- this._scrollRect = value === null || value === void 0 ? void 0 : value.clone();
1056
- }
1057
- else if (this._scrollRect && !this._scrollRect.equals(value)) {
1058
- this._scrollRect.copyFrom(value);
1059
- }
1060
- else {
1061
- //invalidate position only if scrollRect changes
1062
- invalidatePos = false;
1063
- }
1064
- if (invalidatePos) {
1065
- this._transform.invalidatePosition();
1066
- if (value) {
1067
- if (!this._scrollRectPrimitive) {
1068
- //create ScrollRectPrimitive
1069
- this._scrollRectPrimitive = new Sprite();
1070
- this._scrollRectPrimitive.maskMode = true;
1071
- }
1072
- //update ScrollRectPrimitive
1073
- this._scrollRectPrimitive.graphics.clear();
1074
- this._scrollRectPrimitive.graphics.beginFill(0x0000ff, 1);
1075
- this._scrollRectPrimitive.graphics.drawRect(value.x, value.y, value.width, value.height);
1076
- this._scrollRectPrimitive.graphics.endFill();
1077
- }
1078
- else if (this._scrollRectPrimitive) {
1079
- //remove ScrollRectPrimitive
1080
- this._scrollRectPrimitive = null;
1081
- }
1082
- }
1083
- },
1084
- enumerable: false,
1085
- configurable: true
1086
- });
1087
- Object.defineProperty(DisplayObject.prototype, "material", {
1088
- /**
1089
- *
1090
- */
1091
- get: function () {
1092
- return this._material;
1093
- },
1094
- set: function (value) {
1095
- if (this._material == value)
1096
- return;
1097
- this._material = value;
1098
- this._invalidateMaterial();
1099
- },
1100
- enumerable: false,
1101
- configurable: true
1102
- });
1103
- Object.defineProperty(DisplayObject.prototype, "style", {
1104
- /**
1105
- *
1106
- */
1107
- get: function () {
1108
- return this._style;
1109
- },
1110
- set: function (value) {
1111
- if (this._style == value)
1112
- return;
1113
- if (this._style) {
1114
- this._style.removeEventListener(StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
1115
- this._style.removeEventListener(StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
1116
- }
1117
- this._style = value;
1118
- if (this._style) {
1119
- this._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
1120
- this._style.addEventListener(StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
1121
- }
1122
- this._invalidateStyle();
1123
- },
1124
- enumerable: false,
1125
- configurable: true
1126
- });
1127
- Object.defineProperty(DisplayObject.prototype, "boundsVisible", {
1128
- /**
1129
- *
1130
- */
1131
- get: function () {
1132
- return this._boundsVisible;
1133
- },
1134
- set: function (value) {
1135
- if (value == this._boundsVisible)
1136
- return;
1137
- this._boundsVisible = value;
1138
- // if (this._boundsVisible && !this.partition)
1139
- // this.partition = BasicPartition.getRootPartition(this);
1140
- this.invalidate();
1141
- },
1142
- enumerable: false,
1143
- configurable: true
1144
- });
1145
- DisplayObject.prototype.getScrollRectPrimitive = function () {
1146
- return this._scrollRectPrimitive;
1147
- };
1148
- DisplayObject.prototype.getBoundsPrimitive = function (picker) {
1149
- if (this._boundsPrimitive == null) {
1150
- switch (this._defaultBoundingVolume) {
1151
- case BoundingVolumeType.BOX:
1152
- case BoundingVolumeType.BOX_BOUNDS:
1153
- case BoundingVolumeType.BOX_BOUNDS_FAST:
1154
- case BoundingVolumeType.BOX_FAST:
1155
- this._boundsPrefab = new PrimitiveCubePrefab(null, ElementsType.LINE);
1156
- this._boundsPrimitive = this._boundsPrefab.getNewObject();
1157
- break;
1158
- case BoundingVolumeType.SPHERE:
1159
- case BoundingVolumeType.SPHERE_BOUNDS:
1160
- case BoundingVolumeType.SPHERE_BOUNDS_FAST:
1161
- case BoundingVolumeType.SPHERE_FAST:
1162
- this._boundsPrefab = new PrimitiveSpherePrefab(null, ElementsType.LINE);
1163
- this._boundsPrimitive = this._boundsPrefab.getNewObject();
1164
- break;
1165
- default:
1166
- }
1167
- this._boundsPrefabDirty = true;
1168
- }
1169
- if (this._boundsPrefabDirty)
1170
- this._updateBoundsPrefab(picker);
1171
- return this._boundsPrimitive;
1172
- };
1173
- Object.defineProperty(DisplayObject.prototype, "transform", {
1174
- /**
1175
- * An object with properties pertaining to a display object's matrix, color
1176
- * transform, and pixel bounds. The specific properties - matrix,
1177
- * colorTransform, and three read-only properties
1178
- * (<code>concatenatedMatrix</code>, <code>concatenatedColorTransform</code>,
1179
- * and <code>pixelBounds</code>) - are described in the entry for the
1180
- * Transform class.
1181
- *
1182
- * <p>Each of the transform object's properties is itself an object. This
1183
- * concept is important because the only way to set new values for the matrix
1184
- * or colorTransform objects is to create a new object and copy that object
1185
- * into the transform.matrix or transform.colorTransform property.</p>
1186
- *
1187
- * <p>For example, to increase the <code>tx</code> value of a display
1188
- * object's matrix, you must make a copy of the entire matrix object, then
1189
- * copy the new object into the matrix property of the transform object:</p>
1190
- * <pre xml:space="preserve"><code> public myMatrix:Matrix =
1191
- * myDisplayObject.transform.matrix; myMatrix.tx += 10;
1192
- * myDisplayObject.transform.matrix = myMatrix; </code></pre>
1193
- *
1194
- * <p>You cannot directly set the <code>tx</code> property. The following
1195
- * code has no effect on <code>myDisplayObject</code>: </p>
1196
- * <pre xml:space="preserve"><code> myDisplayObject.transform.matrix.tx +=
1197
- * 10; </code></pre>
1198
- *
1199
- * <p>You can also copy an entire transform object and assign it to another
1200
- * display object's transform property. For example, the following code
1201
- * copies the entire transform object from <code>myOldDisplayObj</code> to
1202
- * <code>myNewDisplayObj</code>:</p>
1203
- * <code>myNewDisplayObj.transform = myOldDisplayObj.transform;</code>
1204
- *
1205
- * <p>The resulting display object, <code>myNewDisplayObj</code>, now has the
1206
- * same values for its matrix, color transform, and pixel bounds as the old
1207
- * display object, <code>myOldDisplayObj</code>.</p>
1208
- *
1209
- * <p>Note that AIR for TV devices use hardware acceleration, if it is
1210
- * available, for color transforms.</p>
1211
- */
1212
- get: function () {
1213
- return this._transform;
1214
- },
1215
- enumerable: false,
1216
- configurable: true
1217
- });
1218
- Object.defineProperty(DisplayObject.prototype, "visible", {
1219
- /**
1220
- * Whether or not the display object is visible. Display objects that are not
1221
- * visible are disabled. For example, if <code>visible=false</code> for an
1222
- * InteractiveObject instance, it cannot be clicked.
1223
- */
1224
- get: function () {
1225
- return this._visible;
1226
- },
1227
- set: function (value) {
1228
- if (this._visible == value)
1229
- return;
1230
- this._visible = value;
1231
- this._invalidateHierarchicalProperty(HierarchicalProperty.VISIBLE);
1232
- },
1233
- enumerable: false,
1234
- configurable: true
1235
- });
1236
- Object.defineProperty(DisplayObject.prototype, "timelineMasks", {
1237
- get: function () {
1238
- return this._timelineMasks;
1239
- },
1240
- /**
1241
- * Update mask from timeline and take account that can be a scriptMask
1242
- *
1243
- * @param masks Masks from timeline
1244
- */
1245
- set: function (masks) {
1246
- var oldMasks = this._timelineMasks ? this._timelineMasks : [];
1247
- if (masks) {
1248
- // and make sure that mask mode enabled if not already
1249
- for (var i = masks.length - 1; i >= 0; i--) {
1250
- var mask = masks[i];
1251
- if (!mask) {
1252
- console.warn('[DisplayObject] Timeline mask has null value, skipping it');
1253
- masks.splice(i, 1);
1254
- }
1255
- else {
1256
- var index = oldMasks.indexOf(mask);
1257
- if (index != -1) {
1258
- oldMasks.splice(index, 1);
1259
- }
1260
- else {
1261
- mask.maskMode = true;
1262
- }
1263
- }
1264
- }
1265
- }
1266
- //set mask mode to false for old masks
1267
- for (var i = oldMasks.length - 1; i >= 0; i--)
1268
- oldMasks[i].maskMode = false;
1269
- this._timelineMasks = masks;
1270
- this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1271
- },
1272
- enumerable: false,
1273
- configurable: true
1274
- });
1275
- Object.defineProperty(DisplayObject.prototype, "mouseChildren", {
1276
- /**
1277
- * Determines whether or not the children of the object are mouse, or user
1278
- * input device, enabled. If an object is enabled, a user can interact with
1279
- * it by using a mouse or user input device. The default is
1280
- * <code>true</code>.
1281
- *
1282
- * <p>This property is useful when you create a button with an instance of
1283
- * the Sprite class(instead of using the SimpleButton class). When you use a
1284
- * Sprite instance to create a button, you can choose to decorate the button
1285
- * by using the <code>addChild()</code> method to add additional Sprite
1286
- * instances. This process can cause unexpected behavior with mouse events
1287
- * because the Sprite instances you add as children can become the target
1288
- * object of a mouse event when you expect the parent instance to be the
1289
- * target object. To ensure that the parent instance serves as the target
1290
- * objects for mouse events, you can set the <code>mouseChildren</code>
1291
- * property of the parent instance to <code>false</code>.</p>
1292
- *
1293
- * <p> No event is dispatched by setting this property. You must use the
1294
- * <code>addEventListener()</code> method to create interactive
1295
- * functionality.</p>
1296
- */
1297
- get: function () {
1298
- return this._mouseChildren;
1299
- },
1300
- set: function (value) {
1301
- if (this._mouseChildren == value)
1302
- return;
1303
- this._mouseChildren = value;
1304
- this._invalidateHierarchicalProperty(HierarchicalProperty.MOUSE_ENABLED);
1305
- },
1306
- enumerable: false,
1307
- configurable: true
1308
- });
1309
- Object.defineProperty(DisplayObject.prototype, "x", {
1310
- /**
1311
- * Indicates the <i>x</i> coordinate of the DisplayObject instance relative
1312
- * to the local coordinates of the parent DisplayObjectContainer. If the
1313
- * object is inside a DisplayObjectContainer that has transformations, it is
1314
- * in the local coordinate system of the enclosing DisplayObjectContainer.
1315
- * Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the
1316
- * DisplayObjectContainer's children inherit a coordinate system that is
1317
- * rotated 90° counterclockwise. The object's coordinates refer to the
1318
- * registration point position.
1319
- */
1320
- get: function () {
1321
- return this._transform.position.x;
1322
- },
1323
- set: function (val) {
1324
- if (this._transform.position.x == val)
1325
- return;
1326
- this._transform.matrix3D._rawData[12] = val;
1327
- this._transform.invalidatePosition();
1328
- },
1329
- enumerable: false,
1330
- configurable: true
1331
- });
1332
- Object.defineProperty(DisplayObject.prototype, "y", {
1333
- /**
1334
- * Indicates the <i>y</i> coordinate of the DisplayObject instance relative
1335
- * to the local coordinates of the parent DisplayObjectContainer. If the
1336
- * object is inside a DisplayObjectContainer that has transformations, it is
1337
- * in the local coordinate system of the enclosing DisplayObjectContainer.
1338
- * Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the
1339
- * DisplayObjectContainer's children inherit a coordinate system that is
1340
- * rotated 90° counterclockwise. The object's coordinates refer to the
1341
- * registration point position.
1342
- */
1343
- get: function () {
1344
- return this._transform.position.y;
1345
- },
1346
- set: function (val) {
1347
- if (this._transform.position.y == val)
1348
- return;
1349
- this._transform.matrix3D._rawData[13] = val;
1350
- this._transform.invalidatePosition();
1351
- },
1352
- enumerable: false,
1353
- configurable: true
1354
- });
1355
- Object.defineProperty(DisplayObject.prototype, "z", {
1356
- /**
1357
- * Indicates the z coordinate position along the z-axis of the DisplayObject
1358
- * instance relative to the 3D parent container. The z property is used for
1359
- * 3D coordinates, not screen or pixel coordinates.
1360
- *
1361
- * <p>When you set a <code>z</code> property for a display object to
1362
- * something other than the default value of <code>0</code>, a corresponding
1363
- * Matrix3D object is automatically created. for adjusting a display object's
1364
- * position and orientation in three dimensions. When working with the
1365
- * z-axis, the existing behavior of x and y properties changes from screen or
1366
- * pixel coordinates to positions relative to the 3D parent container.</p>
1367
- *
1368
- * <p>For example, a child of the <code>_root</code> at position x = 100, y =
1369
- * 100, z = 200 is not drawn at pixel location(100,100). The child is drawn
1370
- * wherever the 3D projection calculation puts it. The calculation is:</p>
1371
- *
1372
- * <p><code>(x~~cameraFocalLength/cameraRelativeZPosition,
1373
- * y~~cameraFocalLength/cameraRelativeZPosition)</code></p>
1374
- */
1375
- get: function () {
1376
- return this._transform.position.z;
1377
- },
1378
- set: function (val) {
1379
- if (this._transform.position.z == val)
1380
- return;
1381
- this._transform.matrix3D._rawData[14] = val;
1382
- this._transform.invalidatePosition();
1383
- },
1384
- enumerable: false,
1385
- configurable: true
1386
- });
1387
- DisplayObject.prototype.advanceFrame = function () {
1388
- //default to do nothing
1389
- };
1390
- DisplayObject.prototype.getEntity = function () {
1391
- if (this._iController)
1392
- this._iController.update();
1393
- return;
1394
- };
1395
- DisplayObject.prototype._initNode = function (node) { };
1396
- /**
1397
- *
1398
- */
1399
- DisplayObject.prototype.clone = function () {
1400
- var newInstance = new DisplayObject();
1401
- this.copyTo(newInstance);
1402
- return newInstance;
1403
- };
1404
- DisplayObject.prototype.copyTo = function (displayObject) {
1405
- var _a;
1406
- displayObject.defaultBoundingVolume = this._defaultBoundingVolume;
1407
- if (this._registrationMatrix3D)
1408
- displayObject._registrationMatrix3D = this._registrationMatrix3D.clone();
1409
- displayObject.mouseChildren = this._mouseChildren;
1410
- displayObject.material = this._material;
1411
- displayObject.style = this._style;
1412
- displayObject.pickObject = this._pickObject;
1413
- displayObject.pickObjectFromTimeline = this.pickObjectFromTimeline;
1414
- displayObject.boundsVisible = this._boundsVisible;
1415
- displayObject.name = this._pName;
1416
- displayObject.mouseEnabled = this._mouseEnabled;
1417
- displayObject.extra = this.extra;
1418
- displayObject.maskMode = this._maskMode;
1419
- displayObject.castsShadows = this.castsShadows;
1420
- displayObject.assetNamespace = this.assetNamespace;
1421
- displayObject._symbol = this._symbol;
1422
- displayObject.avm1Symbol = this.avm1Symbol;
1423
- displayObject.isAVMScene = this.isAVMScene;
1424
- displayObject.isSlice9ScaledMC = this.isSlice9ScaledMC;
1425
- displayObject.scale9Grid = (_a = this.scale9Grid) === null || _a === void 0 ? void 0 : _a.clone();
1426
- if (this._timelineMasks) {
1427
- // clone mask tree, to avoid corruption
1428
- displayObject._timelineMasks = this._timelineMasks.slice();
1429
- // manually call invalidation
1430
- //displayObject._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1431
- }
1432
- displayObject._mask = this._mask;
1433
- this._transform.copyRawDataTo(displayObject._transform);
1434
- };
1435
- /**
1436
- *
1437
- */
1438
- DisplayObject.prototype.dispose = function () {
1439
- this.disposeValues();
1440
- };
1441
- DisplayObject.prototype.disposeValues = function () {
1442
- if (this._parent)
1443
- this._parent.removeChild(this);
1444
- this.material = null;
1445
- if (this._adapter) {
1446
- this._adapter.dispose();
1447
- this._adapter = null;
1448
- }
1449
- this._pickObject = null;
1450
- delete this._timelineMasks;
1451
- delete this._mask;
1452
- };
1453
- /**
1454
- * Rotates the 3d object around to face a point defined relative
1455
- * to the local coordinates of the parent <code>ObjectContainer3D</code>.
1456
- *
1457
- * @param scenePosition The vector defining the point to be looked at
1458
- * @param upAxis An optional vector used to define the desired
1459
- * up orientation of the 3d object after rotation has occurred
1460
- */
1461
- DisplayObject.prototype.lookAt = function (scenePosition, upAxis) {
1462
- if (upAxis === void 0) { upAxis = null; }
1463
- this.transform.lookAt(scenePosition, upAxis);
1464
- };
1465
- /**
1466
- * Moves the local point around which the object rotates.
1467
- *
1468
- * @param dx The amount of movement along the local x axis.
1469
- * @param dy The amount of movement along the local y axis.
1470
- * @param dz The amount of movement along the local z axis.
1471
- */
1472
- DisplayObject.prototype.movePivot = function (dx, dy, dz) {
1473
- if (dx == 0 && dy == 0 && dz == 0)
1474
- return;
1475
- if (!this._registrationMatrix3D)
1476
- this._registrationMatrix3D = new Matrix3D();
1477
- this._registrationMatrix3D._rawData[12] -= dx / this._transform.scale.x;
1478
- this._registrationMatrix3D._rawData[13] -= dy / this._transform.scale.y;
1479
- this._registrationMatrix3D._rawData[14] -= dz / this._transform.scale.z;
1480
- this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
1481
- };
1482
- DisplayObject.prototype.reset = function () {
1483
- this.visible = true;
1484
- if (!this.noTimelineUpdate)
1485
- this._transform.clearMatrix3D();
1486
- this._transform.clearColorTransform();
1487
- //this.name="";
1488
- this.mask = undefined;
1489
- this.timelineMasks = undefined;
1490
- this.maskMode = false;
1491
- };
1492
- /*
1493
- this checks if the mc is part of the displaylist (child of the stage)
1494
- todo: probably not the best way to do this
1495
- probably better to get this info by looking at root
1496
- */
1497
- DisplayObject.prototype.isOnDisplayList = function () {
1498
- var parent = this;
1499
- while (parent) {
1500
- if (parent.isAVMScene)
1501
- return true;
1502
- parent = parent.parent;
1503
- }
1504
- return false;
1505
- };
1506
- /**
1507
- * @internal
1508
- */
1509
- DisplayObject.prototype._setParent = function (parent) {
1510
- this._parent = parent;
1511
- };
1512
- DisplayObject.prototype._invalidateHierarchicalProperty = function (propDirty) {
1513
- for (var key in this._containerNodes)
1514
- this._containerNodes[key].invalidateHierarchicalProperty(propDirty);
1515
- };
1516
- Object.defineProperty(DisplayObject.prototype, "maskId", {
1517
- /**
1518
- * @internal
1519
- */
1520
- get: function () {
1521
- return this._maskId;
1522
- },
1523
- enumerable: false,
1524
- configurable: true
1525
- });
1526
- DisplayObject.prototype._setScaleX = function (val) {
1527
- if (this.scaleX == val)
1528
- return;
1529
- this._transform.scale.x = val;
1530
- this._transform.invalidateMatrix3D();
1531
- };
1532
- DisplayObject.prototype._setScaleY = function (val) {
1533
- if (this.scaleY == val)
1534
- return;
1535
- this._transform.scale.y = val;
1536
- this._transform.invalidateMatrix3D();
1537
- };
1538
- DisplayObject.prototype._setScaleZ = function (val) {
1539
- if (this.scaleZ == val)
1540
- return;
1541
- this._transform.scale.z = val;
1542
- this._transform.invalidateMatrix3D();
1543
- };
1544
- DisplayObject.prototype._updateBoundsPrefab = function (picker) {
1545
- if (this._boundsPrefab instanceof PrimitiveCubePrefab) {
1546
- var box = picker.getBoundingVolume(null, this._defaultBoundingVolume).getBox();
1547
- //TODO: if box is null, no prefab should be visible
1548
- if (box == null)
1549
- return;
1550
- this._boundsPrefab.width = box.width;
1551
- this._boundsPrefab.height = box.height;
1552
- this._boundsPrefab.depth = box.depth;
1553
- this._boundsPrimitive.registrationPoint = new Vector3D(-(box.x + box.width / 2) * this._boundsPrimitive.transform.scale.x, -(box.y + box.height / 2) * this._boundsPrimitive.transform.scale.y, -(box.z + box.depth / 2) * this._boundsPrimitive.transform.scale.z);
1554
- }
1555
- else if (this._boundsPrefab instanceof PrimitiveSpherePrefab) {
1556
- var sphere = picker.getBoundingVolume(null, this._defaultBoundingVolume).getSphere();
1557
- //console.log(sphere);
1558
- if (sphere == null)
1559
- return;
1560
- this._boundsPrefab.radius = sphere.radius;
1561
- this._boundsPrimitive.registrationPoint = new Vector3D(-sphere.x * this._boundsPrimitive.transform.scale.x, -sphere.y * this._boundsPrimitive.transform.scale.y, -sphere.z * this._boundsPrimitive.transform.scale.z);
1562
- }
1563
- };
1564
- DisplayObject.prototype._updateMaskMode = function () {
1565
- if (this._maskMode) {
1566
- this._mouseEnabled = false;
1567
- }
1568
- this._invalidateHierarchicalProperty(HierarchicalProperty.MASK_ID);
1569
- };
1570
- DisplayObject.prototype._invalidateMaterial = function () {
1571
- for (var key in this._renderObjects)
1572
- this._renderObjects[key]._onInvalidateMaterial();
1573
- };
1574
- DisplayObject.prototype._invalidateStyle = function () {
1575
- for (var key in this._renderObjects)
1576
- this._renderObjects[key]._onInvalidateStyle();
1577
- };
1578
- DisplayObject.prototype.invalidateElements = function () {
1579
- for (var key in this._renderObjects)
1580
- this._renderObjects[key]._onInvalidateElements();
1581
- };
1582
- DisplayObject.prototype._onInvalidateProperties = function (_event) {
1583
- if (_event === void 0) { _event = null; }
1584
- this._invalidateStyle();
1585
- };
1586
- DisplayObject.prototype._onInvalidateImages = function (_event) {
1587
- if (_event === void 0) { _event = null; }
1588
- this.invalidate();
1589
- };
1590
- DisplayObject.prototype._getDefaultBoundingVolume = function () {
1591
- return BoundingVolumeType.BOX_BOUNDS_FAST;
1592
- };
1593
- return DisplayObject;
1594
- }(AssetBase));
1595
- export { DisplayObject };
1
+ import { __extends } from "tslib";
2
+ import { Transform, TransformEvent, Matrix3D, Vector3D, AssetBase, } from '@awayjs/core';
3
+ import { BlendMode } from '@awayjs/stage';
4
+ import { BoundingVolumeType, HierarchicalProperty, AlignmentMode, OrientationMode, } from '@awayjs/view';
5
+ import { StyleEvent, ElementsType, } from '@awayjs/renderer';
6
+ import { PrimitiveCubePrefab } from '../prefabs/PrimitiveCubePrefab';
7
+ import { PrimitiveSpherePrefab } from '../prefabs/PrimitiveSpherePrefab';
8
+ import { Sprite } from './Sprite';
9
+ import { Settings } from '../Settings';
10
+ /**
11
+ * The DisplayObject class is the base class for all objects that can be
12
+ * placed on the display list. The display list manages all objects displayed
13
+ * in flash. Use the DisplayObjectContainer class to arrange the
14
+ * display objects in the display list. DisplayObjectContainer objects can
15
+ * have child display objects, while other display objects, such as Shape and
16
+ * TextField objects, are "leaf" nodes that have only parents and siblings, no
17
+ * children.
18
+ *
19
+ * <p>The DisplayObject class supports fbasic functionality like the <i>x</i>
20
+ * and <i>y</i> position of an object, as well as more advanced properties of
21
+ * the object such as its transformation matrix. </p>
22
+ *
23
+ * <p>DisplayObject is an abstract base class; therefore, you cannot call
24
+ * DisplayObject directly. Invoking <code>new DisplayObject()</code> throws an
25
+ * <code>ArgumentError</code> exception. </p>
26
+ *
27
+ * <p>All display objects inherit from the DisplayObject class.</p>
28
+ *
29
+ * <p>The DisplayObject class itself does not include any APIs for rendering
30
+ * content onscreen. For that reason, if you want create a custom subclass of
31
+ * the DisplayObject class, you will want to extend one of its subclasses that
32
+ * do have APIs for rendering content onscreen, such as the Shape, Sprite,
33
+ * Bitmap, SimpleButton, TextField, or MovieClip class.</p>
34
+ *
35
+ * <p>The DisplayObject class contains several broadcast events. Normally, the
36
+ * target of any particular event is a specific DisplayObject instance. For
37
+ * example, the target of an <code>added</code> event is the specific
38
+ * DisplayObject instance that was added to the display list. Having a single
39
+ * target restricts the placement of event listeners to that target and in
40
+ * some cases the target's ancestors on the display list. With broadcast
41
+ * events, however, the target is not a specific DisplayObject instance, but
42
+ * rather all DisplayObject instances, including those that are not on the
43
+ * display list. This means that you can add a listener to any DisplayObject
44
+ * instance to listen for broadcast events. In addition to the broadcast
45
+ * events listed in the DisplayObject class's Events table, the DisplayObject
46
+ * class also inherits two broadcast events from the EventDispatcher class:
47
+ * <code>activate</code> and <code>deactivate</code>.</p>
48
+ *
49
+ * <p>Some properties previously used in the ActionScript 1.0 and 2.0
50
+ * MovieClip, TextField, and Button classes(such as <code>_alpha</code>,
51
+ * <code>_height</code>, <code>_pName</code>, <code>_width</code>,
52
+ * <code>_x</code>, <code>_y</code>, and others) have equivalents in the
53
+ * ActionScript 3.0 DisplayObject class that are renamed so that they no
54
+ * longer begin with the underscore(_) character.</p>
55
+ *
56
+ * <p>For more information, see the "Display Programming" chapter of the
57
+ * <i>ActionScript 3.0 Developer's Guide</i>.</p>
58
+ *
59
+ * @event added Dispatched when a display object is added to the
60
+ * display list. The following methods trigger this
61
+ * event:
62
+ * <code>DisplayObjectContainer.addChild()</code>,
63
+ * <code>DisplayObjectContainer.addChildAt()</code>.
64
+ * @event addedToScene Dispatched when a display object is added to the on
65
+ * scene display list, either directly or through the
66
+ * addition of a sub tree in which the display object
67
+ * is contained. The following methods trigger this
68
+ * event:
69
+ * <code>DisplayObjectContainer.addChild()</code>,
70
+ * <code>DisplayObjectContainer.addChildAt()</code>.
71
+ * @event enterFrame [broadcast event] Dispatched when the playhead is
72
+ * entering a new frame. If the playhead is not
73
+ * moving, or if there is only one frame, this event
74
+ * is dispatched continuously in conjunction with the
75
+ * frame rate. This event is a broadcast event, which
76
+ * means that it is dispatched by all display objects
77
+ * with a listener registered for this event.
78
+ * @event exitFrame [broadcast event] Dispatched when the playhead is
79
+ * exiting the current frame. All frame scripts have
80
+ * been run. If the playhead is not moving, or if
81
+ * there is only one frame, this event is dispatched
82
+ * continuously in conjunction with the frame rate.
83
+ * This event is a broadcast event, which means that
84
+ * it is dispatched by all display objects with a
85
+ * listener registered for this event.
86
+ * @event frameConstructed [broadcast event] Dispatched after the constructors
87
+ * of frame display objects have run but before frame
88
+ * scripts have run. If the playhead is not moving, or
89
+ * if there is only one frame, this event is
90
+ * dispatched continuously in conjunction with the
91
+ * frame rate. This event is a broadcast event, which
92
+ * means that it is dispatched by all display objects
93
+ * with a listener registered for this event.
94
+ * @event removed Dispatched when a display object is about to be
95
+ * removed from the display list. Two methods of the
96
+ * DisplayObjectContainer class generate this event:
97
+ * <code>removeChild()</code> and
98
+ * <code>removeChildAt()</code>.
99
+ *
100
+ * <p>The following methods of a
101
+ * DisplayObjectContainer object also generate this
102
+ * event if an object must be removed to make room for
103
+ * the new object: <code>addChild()</code>,
104
+ * <code>addChildAt()</code>, and
105
+ * <code>setChildIndex()</code>. </p>
106
+ * @event removedFromScene Dispatched when a display object is about to be
107
+ * removed from the display list, either directly or
108
+ * through the removal of a sub tree in which the
109
+ * display object is contained. Two methods of the
110
+ * DisplayObjectContainer class generate this event:
111
+ * <code>removeChild()</code> and
112
+ * <code>removeChildAt()</code>.
113
+ *
114
+ * <p>The following methods of a
115
+ * DisplayObjectContainer object also generate this
116
+ * event if an object must be removed to make room for
117
+ * the new object: <code>addChild()</code>,
118
+ * <code>addChildAt()</code>, and
119
+ * <code>setChildIndex()</code>. </p>
120
+ * @event render [broadcast event] Dispatched when the display list
121
+ * is about to be updated and rendered. This event
122
+ * provides the last opportunity for objects listening
123
+ * for this event to make changes before the display
124
+ * list is rendered. You must call the
125
+ * <code>invalidate()</code> method of the Scene
126
+ * object each time you want a <code>render</code>
127
+ * event to be dispatched. <code>Render</code> events
128
+ * are dispatched to an object only if there is mutual
129
+ * trust between it and the object that called
130
+ * <code>Scene.invalidate()</code>. This event is a
131
+ * broadcast event, which means that it is dispatched
132
+ * by all display objects with a listener registered
133
+ * for this event.
134
+ *
135
+ * <p><b>Note: </b>This event is not dispatched if the
136
+ * display is not rendering. This is the case when the
137
+ * content is either minimized or obscured. </p>
138
+ */
139
+ var DisplayObject = /** @class */ (function (_super) {
140
+ __extends(DisplayObject, _super);
141
+ /**
142
+ * Creates a new <code>DisplayObject</code> instance.
143
+ */
144
+ function DisplayObject() {
145
+ var _this = _super.call(this) || this;
146
+ _this._renderObjects = {};
147
+ _this._containerNodes = {};
148
+ _this._mouseChildren = true;
149
+ _this._sessionID = -1;
150
+ _this._avmDepthID = -1;
151
+ _this._alignmentMode = AlignmentMode.REGISTRATION_POINT;
152
+ _this._visible = true;
153
+ _this._maskId = -1;
154
+ _this._mouseEnabled = true;
155
+ _this._maskMode = false;
156
+ _this.isSlice9ScaledMC = false;
157
+ _this.isSlice9ScaledSprite = false;
158
+ _this.isAVMScene = false;
159
+ // this is needed for AVM1 - todo: maybe do this on adapters ?
160
+ _this.placeObjectTag = null;
161
+ /**
162
+ * A value from the BlendMode class that specifies which blend mode to use. A
163
+ * bitmap can be drawn internally in two ways. If you have a blend mode
164
+ * enabled or an external clipping mask, the bitmap is drawn by adding a
165
+ * bitmap-filled square shape to the vector render. If you attempt to set
166
+ * this property to an invalid value, Flash runtimes set the value to
167
+ * <code>BlendMode.NORMAL</code>.
168
+ *
169
+ * <p>The <code>blendMode</code> property affects each pixel of the display
170
+ * object. Each pixel is composed of three constituent colors(red, green,
171
+ * and blue), and each constituent color has a value between 0x00 and 0xFF.
172
+ * Flash Player or Adobe AIR compares each constituent color of one pixel in
173
+ * the movie clip with the corresponding color of the pixel in the
174
+ * background. For example, if <code>blendMode</code> is set to
175
+ * <code>BlendMode.LIGHTEN</code>, Flash Player or Adobe AIR compares the red
176
+ * value of the display object with the red value of the background, and uses
177
+ * the lighter of the two as the value for the red component of the displayed
178
+ * color.</p>
179
+ *
180
+ * <p>The following table describes the <code>blendMode</code> settings. The
181
+ * BlendMode class defines string values you can use. The illustrations in
182
+ * the table show <code>blendMode</code> values applied to a circular display
183
+ * object(2) superimposed on another display object(1).</p>
184
+ */
185
+ _this._blendMode = BlendMode.NORMAL;
186
+ /**
187
+ *
188
+ */
189
+ _this.castsShadows = true;
190
+ /**
191
+ * An indexed array that contains each filter object currently associated
192
+ * with the display object. The flash.filters package contains several
193
+ * classes that define specific filters you can use.
194
+ *
195
+ * <p>Filters can be applied in Flash Professional at design time, or at run
196
+ * time by using ActionScript code. To apply a filter by using ActionScript,
197
+ * you must make a temporary copy of the entire <code>filters</code> array,
198
+ * modify the temporary array, then assign the value of the temporary array
199
+ * back to the <code>filters</code> array. You cannot directly add a new
200
+ * filter object to the <code>filters</code> array.</p>
201
+ *
202
+ * <p>To add a filter by using ActionScript, perform the following steps
203
+ * (assume that the target display object is named
204
+ * <code>myDisplayObject</code>):</p>
205
+ *
206
+ * <ol>
207
+ * <li>Create a new filter object by using the constructor method of your
208
+ * chosen filter class.</li>
209
+ * <li>Assign the value of the <code>myDisplayObject.filters</code> array
210
+ * to a temporary array, such as one named <code>myFilters</code>.</li>
211
+ * <li>Add the new filter object to the <code>myFilters</code> temporary
212
+ * array.</li>
213
+ * <li>Assign the value of the temporary array to the
214
+ * <code>myDisplayObject.filters</code> array.</li>
215
+ * </ol>
216
+ *
217
+ * <p>If the <code>filters</code> array is undefined, you do not need to use
218
+ * a temporary array. Instead, you can directly assign an array literal that
219
+ * contains one or more filter objects that you create. The first example in
220
+ * the Examples section adds a drop shadow filter by using code that handles
221
+ * both defined and undefined <code>filters</code> arrays.</p>
222
+ *
223
+ * <p>To modify an existing filter object, you must use the technique of
224
+ * modifying a copy of the <code>filters</code> array:</p>
225
+ *
226
+ * <ol>
227
+ * <li>Assign the value of the <code>filters</code> array to a temporary
228
+ * array, such as one named <code>myFilters</code>.</li>
229
+ * <li>Modify the property by using the temporary array,
230
+ * <code>myFilters</code>. For example, to set the quality property of the
231
+ * first filter in the array, you could use the following code:
232
+ * <code>myFilters[0].quality = 1;</code></li>
233
+ * <li>Assign the value of the temporary array to the <code>filters</code>
234
+ * array.</li>
235
+ * </ol>
236
+ *
237
+ * <p>At load time, if a display object has an associated filter, it is
238
+ * marked to cache itself as a transparent bitmap. From this point forward,
239
+ * as long as the display object has a valid filter list, the player caches
240
+ * the display object as a bitmap. This source bitmap is used as a source
241
+ * image for the filter effects. Each display object usually has two bitmaps:
242
+ * one with the original unfiltered source display object and another for the
243
+ * final image after filtering. The final image is used when rendering. As
244
+ * long as the display object does not change, the final image does not need
245
+ * updating.</p>
246
+ *
247
+ * <p>The flash.filters package includes classes for filters. For example, to
248
+ * create a DropShadow filter, you would write:</p>
249
+ *
250
+ * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
251
+ * and the shader output type is not compatible with
252
+ * this operation(the shader must specify a
253
+ * <code>pixel4</code> output).
254
+ * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
255
+ * and the shader doesn't specify any image input or
256
+ * the first input is not an <code>image4</code> input.
257
+ * @throws ArgumentError When <code>filters</code> includes a ShaderFilter
258
+ * and the shader specifies an image input that isn't
259
+ * provided.
260
+ * @throws ArgumentError When <code>filters</code> includes a ShaderFilter, a
261
+ * ByteArray or Vector.<Number> instance as a shader
262
+ * input, and the <code>width</code> and
263
+ * <code>height</code> properties aren't specified for
264
+ * the ShaderInput object, or the specified values
265
+ * don't match the amount of data in the input data.
266
+ * See the <code>ShaderInput.input</code> property for
267
+ * more information.
268
+ */
269
+ _this._filters = null;
270
+ /**
271
+ *
272
+ */
273
+ _this.orientationMode = OrientationMode.DEFAULT;
274
+ /**
275
+ *
276
+ */
277
+ _this.zOffset = 0;
278
+ _this.hasDispatchedAddedToStage = false;
279
+ _this.cursorType = '';
280
+ _this._isInFocus = false;
281
+ _this._tabEnabled = false;
282
+ _this._tabIndex = -1;
283
+ _this._avmDepthID = -1;
284
+ //global debug bounding boxes:
285
+ //this._boundsVisible=true;
286
+ _this._onInvalidatePropertiesDelegate = function (event) { return _this._onInvalidateProperties(event); };
287
+ _this._onInvalidateImagesDelegate = function (event) { return _this._onInvalidateImages(event); };
288
+ //creation of associated transform object
289
+ _this._transform = new Transform(null);
290
+ //setup transform listeners
291
+ _this._transform.addEventListener(TransformEvent.INVALIDATE_MATRIX3D, function (_event) { return _this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM); });
292
+ _this._transform.addEventListener(TransformEvent.INVALIDATE_COLOR_TRANSFORM, function (_event) { return _this._invalidateHierarchicalProperty(HierarchicalProperty.COLOR_TRANSFORM); });
293
+ //bounding volume dictonary
294
+ //default bounds type
295
+ _this._defaultBoundingVolume = _this._getDefaultBoundingVolume();
296
+ return _this;
297
+ }
298
+ DisplayObject.prototype.getScriptPrecedence = function () {
299
+ if (!this._parent) {
300
+ return [];
301
+ }
302
+ var result = this._parent.getScriptPrecedence();
303
+ if (this.placeObjectTag) {
304
+ result.push(this.placeObjectTag.actionBlocksPrecedence);
305
+ }
306
+ return result;
307
+ };
308
+ DisplayObject.prototype.getMouseCursor = function () {
309
+ return 'initial';
310
+ };
311
+ Object.defineProperty(DisplayObject.prototype, "tabEnabled", {
312
+ get: function () {
313
+ return this._tabEnabled;
314
+ },
315
+ set: function (value) {
316
+ this._tabEnabled = value;
317
+ },
318
+ enumerable: false,
319
+ configurable: true
320
+ });
321
+ Object.defineProperty(DisplayObject.prototype, "tabIndex", {
322
+ get: function () {
323
+ return this._tabIndex;
324
+ },
325
+ set: function (value) {
326
+ this._tabIndex = value;
327
+ },
328
+ enumerable: false,
329
+ configurable: true
330
+ });
331
+ Object.defineProperty(DisplayObject.prototype, "isInFocus", {
332
+ get: function () {
333
+ return this._isInFocus;
334
+ },
335
+ set: function (value) {
336
+ this._isInFocus = value;
337
+ },
338
+ enumerable: false,
339
+ configurable: true
340
+ });
341
+ DisplayObject.prototype.setFocus = function (value, fromMouseDown, sendSoftKeyEvent) {
342
+ if (fromMouseDown === void 0) { fromMouseDown = false; }
343
+ if (sendSoftKeyEvent === void 0) { sendSoftKeyEvent = true; }
344
+ if (this._isInFocus == value)
345
+ return;
346
+ this._isInFocus = value;
347
+ };
348
+ Object.defineProperty(DisplayObject.prototype, "alignmentMode", {
349
+ /**
350
+ *
351
+ */
352
+ get: function () {
353
+ return this._alignmentMode;
354
+ },
355
+ set: function (value) {
356
+ if (this._alignmentMode == value)
357
+ return;
358
+ this._alignmentMode = value;
359
+ this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
360
+ },
361
+ enumerable: false,
362
+ configurable: true
363
+ });
364
+ Object.defineProperty(DisplayObject.prototype, "alpha", {
365
+ /**
366
+ * Indicates the alpha transparency value of the object specified. Valid
367
+ * values are 0(fully transparent) to 1(fully opaque). The default value is
368
+ * 1. Display objects with <code>alpha</code> set to 0 <i>are</i> active,
369
+ * even though they are invisible.
370
+ */
371
+ get: function () {
372
+ return this._transform.colorTransform.alphaMultiplier;
373
+ },
374
+ set: function (value) {
375
+ this._transform.colorTransform.alphaMultiplier = value;
376
+ this._transform.invalidateColorTransform();
377
+ },
378
+ enumerable: false,
379
+ configurable: true
380
+ });
381
+ Object.defineProperty(DisplayObject.prototype, "blendMode", {
382
+ get: function () {
383
+ if (!Settings.USE_UNSAFE_BLENDS) {
384
+ return '';
385
+ }
386
+ if (Settings.REMAP_BLEND_MODE) {
387
+ return Settings.BLEND_MODE_REMAP_TABLE[this._blendMode] || this._blendMode;
388
+ }
389
+ return this._blendMode;
390
+ },
391
+ set: function (v) {
392
+ if (this._blendMode === v) {
393
+ return;
394
+ }
395
+ this._blendMode = v;
396
+ if (v === BlendMode.OVERLAY) {
397
+ this._transform.invalidateColorTransform();
398
+ }
399
+ this.invalidate();
400
+ },
401
+ enumerable: false,
402
+ configurable: true
403
+ });
404
+ Object.defineProperty(DisplayObject.prototype, "defaultBoundingVolume", {
405
+ /**
406
+ *
407
+ */
408
+ get: function () {
409
+ return this._defaultBoundingVolume;
410
+ },
411
+ set: function (value) {
412
+ if (this._defaultBoundingVolume == value)
413
+ return;
414
+ this._defaultBoundingVolume = value;
415
+ if (this._boundsPrimitive) {
416
+ this._boundsPrimitive.dispose();
417
+ this._boundsPrimitive = null;
418
+ }
419
+ this.invalidate();
420
+ },
421
+ enumerable: false,
422
+ configurable: true
423
+ });
424
+ Object.defineProperty(DisplayObject.prototype, "cacheAsBitmap", {
425
+ get: function () {
426
+ return this._bitmapCache;
427
+ },
428
+ set: function (v) {
429
+ if (v === this._bitmapCache) {
430
+ return;
431
+ }
432
+ if (!Settings.USE_UNSAFE_CACHE_AS_BITMAP) {
433
+ return;
434
+ }
435
+ v && console.warn('[@scene/DisplayObject] Unsafe cacheAsBitmap is enabled!' +
436
+ 'You can disable it by `Settings.USE_UNSAFE_CACHE_AS_BITMAP = false`', this.id);
437
+ this._bitmapCache = v;
438
+ },
439
+ enumerable: false,
440
+ configurable: true
441
+ });
442
+ Object.defineProperty(DisplayObject.prototype, "eulers", {
443
+ /**
444
+ * Defines the rotation of the 3d object as a <code>Vector3D</code>
445
+ * object containing euler angles for rotation around x, y and z axis.
446
+ */
447
+ get: function () {
448
+ if (!this._eulers)
449
+ this._eulers = new Vector3D();
450
+ this._eulers.x = this.rotationX;
451
+ this._eulers.y = this.rotationY;
452
+ this._eulers.z = this.rotationZ;
453
+ return this._eulers;
454
+ },
455
+ set: function (value) {
456
+ // previously this was using the setters for rotationX etc
457
+ // but because this will convert from radians to degree, i changed it to update directly
458
+ this._transform.rotation.x = value.x;
459
+ this._transform.rotation.y = value.y;
460
+ this._transform.rotation.z = value.z;
461
+ this._transform.invalidateMatrix3D();
462
+ },
463
+ enumerable: false,
464
+ configurable: true
465
+ });
466
+ Object.defineProperty(DisplayObject.prototype, "filters", {
467
+ get: function () {
468
+ return this._filters;
469
+ },
470
+ set: function (v) {
471
+ if (!Settings.USE_UNSAFE_FILTERS) {
472
+ return;
473
+ }
474
+ this._filters = v;
475
+ this._invalidateStyle();
476
+ },
477
+ enumerable: false,
478
+ configurable: true
479
+ });
480
+ DisplayObject.prototype.updateFilters = function (_newFilters) {
481
+ console.warn('[scene/DisplayObject] - updateFilters is just a stub');
482
+ };
483
+ Object.defineProperty(DisplayObject.prototype, "index", {
484
+ /**
485
+ * Indicates the instance container index of the DisplayObject. The object can be
486
+ * identified in the child list of its parent display object container by
487
+ * calling the <code>getChildByIndex()</code> method of the display object
488
+ * container.
489
+ *
490
+ * <p>If the DisplayObject has no parent container, index defaults to 0.</p>
491
+ */
492
+ get: function () {
493
+ if (this._parent)
494
+ return this._parent.getChildIndex(this);
495
+ return 0;
496
+ },
497
+ enumerable: false,
498
+ configurable: true
499
+ });
500
+ Object.defineProperty(DisplayObject.prototype, "loader", {
501
+ /**
502
+ * Returns a LoaderInfo object containing information about loading the file
503
+ * to which this display object belongs. The <code>loaderInfo</code> property
504
+ * is defined only for the root display object of a SWF file or for a loaded
505
+ * Bitmap(not for a Bitmap that is drawn with ActionScript). To find the
506
+ * <code>loaderInfo</code> object associated with the SWF file that contains
507
+ * a display object named <code>myDisplayObject</code>, use
508
+ * <code>myDisplayObject.root.loaderInfo</code>.
509
+ *
510
+ * <p>A large SWF file can monitor its download by calling
511
+ * <code>this.root.loaderInfo.addEventListener(Event.COMPLETE,
512
+ * func)</code>.</p>
513
+ */
514
+ get: function () {
515
+ return this._loader;
516
+ },
517
+ enumerable: false,
518
+ configurable: true
519
+ });
520
+ Object.defineProperty(DisplayObject.prototype, "mask", {
521
+ /**
522
+ * The calling display object is masked by the specified <code>mask</code>
523
+ * object. To ensure that masking works when the Stage is scaled, the
524
+ * <code>mask</code> display object must be in an active part of the display
525
+ * list. The <code>mask</code> object itself is not drawn. Set
526
+ * <code>mask</code> to <code>null</code> to remove the mask.
527
+ *
528
+ * <p>To be able to scale a mask object, it must be on the display list. To
529
+ * be able to drag a mask Sprite object(by calling its
530
+ * <code>startDrag()</code> method), it must be on the display list. To call
531
+ * the <code>startDrag()</code> method for a mask sprite based on a
532
+ * <code>mouseDown</code> event being dispatched by the sprite, set the
533
+ * sprite's <code>buttonMode</code> property to <code>true</code>.</p>
534
+ *
535
+ * <p>When display objects are cached by setting the
536
+ * <code>cacheAsBitmap</code> property to <code>true</code> an the
537
+ * <code>cacheAsBitmapMatrix</code> property to a Matrix object, both the
538
+ * mask and the display object being masked must be part of the same cached
539
+ * bitmap. Thus, if the display object is cached, then the mask must be a
540
+ * child of the display object. If an ancestor of the display object on the
541
+ * display list is cached, then the mask must be a child of that ancestor or
542
+ * one of its descendents. If more than one ancestor of the masked object is
543
+ * cached, then the mask must be a descendent of the cached container closest
544
+ * to the masked object in the display list.</p>
545
+ *
546
+ * <p><b>Note:</b> A single <code>mask</code> object cannot be used to mask
547
+ * more than one calling display object. When the <code>mask</code> is
548
+ * assigned to a second display object, it is removed as the mask of the
549
+ * first object, and that object's <code>mask</code> property becomes
550
+ * <code>null</code>.</p>
551
+ */
552
+ get: function () {
553
+ return this._mask;
554
+ },
555
+ set: function (value) {
556
+ if (this._mask === value)
557
+ return;
558
+ // remove older script mask
559
+ if (this._mask)
560
+ this._mask.maskMode = false;
561
+ this._mask = value;
562
+ if (value)
563
+ value.maskMode = true;
564
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
565
+ },
566
+ enumerable: false,
567
+ configurable: true
568
+ });
569
+ Object.defineProperty(DisplayObject.prototype, "maskMode", {
570
+ get: function () {
571
+ return this._maskMode;
572
+ },
573
+ set: function (value) {
574
+ if (this._maskMode == value)
575
+ return;
576
+ this._maskMode = value;
577
+ this._maskId = value ? this.id : -1;
578
+ this._updateMaskMode();
579
+ },
580
+ enumerable: false,
581
+ configurable: true
582
+ });
583
+ Object.defineProperty(DisplayObject.prototype, "pickObject", {
584
+ get: function () {
585
+ return this._pickObject;
586
+ },
587
+ set: function (value) {
588
+ if (this._pickObject == value)
589
+ return;
590
+ this._pickObject = (value == this)
591
+ ? null
592
+ : value.pickObjectFromTimeline ? value.clone() : value;
593
+ if (this._pickObject) {
594
+ this._pickObject.mouseChildren = false;
595
+ this._pickObject.mouseEnabled = false;
596
+ }
597
+ },
598
+ enumerable: false,
599
+ configurable: true
600
+ });
601
+ Object.defineProperty(DisplayObject.prototype, "mouseEnabled", {
602
+ /**
603
+ * Specifies whether this object receives mouse, or other user input,
604
+ * messages. The default value is <code>true</code>, which means that by
605
+ * default any InteractiveObject instance that is on the display list
606
+ * receives mouse events or other user input events. If
607
+ * <code>mouseEnabled</code> is set to <code>false</code>, the instance does
608
+ * not receive any mouse events(or other user input events like keyboard
609
+ * events). Any children of this instance on the display list are not
610
+ * affected. To change the <code>mouseEnabled</code> behavior for all
611
+ * children of an object on the display list, use
612
+ * <code>flash.display.DisplayObjectContainer.mouseChildren</code>.
613
+ *
614
+ * <p> No event is dispatched by setting this property. You must use the
615
+ * <code>addEventListener()</code> method to create interactive
616
+ * functionality.</p>
617
+ */
618
+ get: function () {
619
+ return this._mouseEnabled;
620
+ },
621
+ set: function (value) {
622
+ if (this._mouseEnabled == value)
623
+ return;
624
+ this._mouseEnabled = value;
625
+ },
626
+ enumerable: false,
627
+ configurable: true
628
+ });
629
+ Object.defineProperty(DisplayObject.prototype, "mouseX", {
630
+ /**
631
+ * Indicates the x coordinate of the mouse or user input device position, in
632
+ * pixels.
633
+ *
634
+ * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned x
635
+ * coordinate will reflect the non-rotated object.</p>
636
+ */
637
+ get: function () {
638
+ return this._mouseX;
639
+ },
640
+ enumerable: false,
641
+ configurable: true
642
+ });
643
+ Object.defineProperty(DisplayObject.prototype, "mouseY", {
644
+ /**
645
+ * Indicates the y coordinate of the mouse or user input device position, in
646
+ * pixels.
647
+ *
648
+ * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned y
649
+ * coordinate will reflect the non-rotated object.</p>
650
+ */
651
+ get: function () {
652
+ return this._mouseY;
653
+ },
654
+ enumerable: false,
655
+ configurable: true
656
+ });
657
+ Object.defineProperty(DisplayObject.prototype, "name", {
658
+ /**
659
+ * Indicates the instance name of the DisplayObject. The object can be
660
+ * identified in the child list of its parent display object container by
661
+ * calling the <code>getChildByName()</code> method of the display object
662
+ * container.
663
+ *
664
+ * @throws IllegalOperationError If you are attempting to set this property
665
+ * on an object that was placed on the timeline
666
+ * in the Flash authoring tool.
667
+ */
668
+ get: function () {
669
+ return this._pName ? this._pName : '';
670
+ },
671
+ set: function (value) {
672
+ this._pName = value;
673
+ },
674
+ enumerable: false,
675
+ configurable: true
676
+ });
677
+ Object.defineProperty(DisplayObject.prototype, "parent", {
678
+ /**
679
+ * Indicates the DisplayObjectContainer object that contains this display
680
+ * object. Use the <code>parent</code> property to specify a relative path to
681
+ * display objects that are above the current display object in the display
682
+ * list hierarchy.
683
+ *
684
+ * <p>You can use <code>parent</code> to move up multiple levels in the
685
+ * display list as in the following:</p>
686
+ *
687
+ * @throws SecurityError The parent display object belongs to a security
688
+ * sandbox to which you do not have access. You can
689
+ * avoid this situation by having the parent movie call
690
+ * the <code>Security.allowDomain()</code> method.
691
+ */
692
+ get: function () {
693
+ return this._parent;
694
+ },
695
+ enumerable: false,
696
+ configurable: true
697
+ });
698
+ Object.defineProperty(DisplayObject.prototype, "registrationPoint", {
699
+ /**
700
+ * Defines the local point around which the object rotates.
701
+ */
702
+ get: function () {
703
+ if (this._registrationMatrix3D)
704
+ return new Vector3D(-this._registrationMatrix3D._rawData[12] * this.scaleX, -this._registrationMatrix3D._rawData[13] * this.scaleY, -this._registrationMatrix3D._rawData[14] * this.scaleZ);
705
+ return null;
706
+ },
707
+ set: function (value) {
708
+ if (!value) {
709
+ if (!this._registrationMatrix3D)
710
+ return;
711
+ this._registrationMatrix3D._rawData[12] = 0;
712
+ this._registrationMatrix3D._rawData[13] = 0;
713
+ this._registrationMatrix3D._rawData[14] = 0;
714
+ if (this._registrationMatrix3D.isIdentity())
715
+ this._registrationMatrix3D = null;
716
+ }
717
+ else {
718
+ if (!this._registrationMatrix3D)
719
+ this._registrationMatrix3D = new Matrix3D();
720
+ this._registrationMatrix3D._rawData[12] = -value.x / this._transform.scale.x;
721
+ this._registrationMatrix3D._rawData[13] = -value.y / this._transform.scale.y;
722
+ this._registrationMatrix3D._rawData[14] = -value.z / this._transform.scale.z;
723
+ }
724
+ this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
725
+ },
726
+ enumerable: false,
727
+ configurable: true
728
+ });
729
+ Object.defineProperty(DisplayObject.prototype, "registrationScale", {
730
+ /**
731
+ * Defines the local scale.
732
+ */
733
+ get: function () {
734
+ if (this._registrationMatrix3D)
735
+ return new Vector3D(this._registrationMatrix3D._rawData[0], this._registrationMatrix3D._rawData[5], this._registrationMatrix3D._rawData[10]);
736
+ return null;
737
+ },
738
+ set: function (value) {
739
+ if (!value) {
740
+ if (!this._registrationMatrix3D)
741
+ return;
742
+ this._registrationMatrix3D._rawData[0] = 1;
743
+ this._registrationMatrix3D._rawData[5] = 1;
744
+ this._registrationMatrix3D._rawData[10] = 1;
745
+ if (this._registrationMatrix3D.isIdentity())
746
+ this._registrationMatrix3D = null;
747
+ }
748
+ else {
749
+ if (!this._registrationMatrix3D)
750
+ this._registrationMatrix3D = new Matrix3D();
751
+ this._registrationMatrix3D._rawData[0] = value.x;
752
+ this._registrationMatrix3D._rawData[5] = value.y;
753
+ this._registrationMatrix3D._rawData[10] = value.z;
754
+ }
755
+ this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
756
+ },
757
+ enumerable: false,
758
+ configurable: true
759
+ });
760
+ Object.defineProperty(DisplayObject.prototype, "root", {
761
+ /**
762
+ * For a display object in a loaded SWF file, the <code>root</code> property
763
+ * is the top-most display object in the portion of the display list's tree
764
+ * structure represented by that SWF file. For a Bitmap object representing a
765
+ * loaded image file, the <code>root</code> property is the Bitmap object
766
+ * itself. For the instance of the main class of the first SWF file loaded,
767
+ * the <code>root</code> property is the display object itself. The
768
+ * <code>root</code> property of the Scene object is the Scene object itself.
769
+ * The <code>root</code> property is set to <code>null</code> for any display
770
+ * object that has not been added to the display list, unless it has been
771
+ * added to a display object container that is off the display list but that
772
+ * is a child of the top-most display object in a loaded SWF file.
773
+ *
774
+ * <p>For example, if you create a new Sprite object by calling the
775
+ * <code>Sprite()</code> constructor method, its <code>root</code> property
776
+ * is <code>null</code> until you add it to the display list(or to a display
777
+ * object container that is off the display list but that is a child of the
778
+ * top-most display object in a SWF file).</p>
779
+ *
780
+ * <p>For a loaded SWF file, even though the Loader object used to load the
781
+ * file may not be on the display list, the top-most display object in the
782
+ * SWF file has its <code>root</code> property set to itself. The Loader
783
+ * object does not have its <code>root</code> property set until it is added
784
+ * as a child of a display object for which the <code>root</code> property is
785
+ * set.</p>
786
+ */
787
+ get: function () {
788
+ return this._root;
789
+ },
790
+ enumerable: false,
791
+ configurable: true
792
+ });
793
+ Object.defineProperty(DisplayObject.prototype, "rotationX", {
794
+ /**
795
+ * Indicates the x-axis rotation of the DisplayObject instance, in degrees,
796
+ * from its original orientation relative to the 3D parent container. Values
797
+ * from 0 to 180 represent clockwise rotation; values from 0 to -180
798
+ * represent counterclockwise rotation. Values outside this range are added
799
+ * to or subtracted from 360 to obtain a value within the range.
800
+ */
801
+ get: function () {
802
+ return this._transform.rotation.x;
803
+ },
804
+ set: function (val) {
805
+ if (this.rotationX == val)
806
+ return;
807
+ this._transform.rotation.x = val;
808
+ this._transform.invalidateMatrix3D();
809
+ },
810
+ enumerable: false,
811
+ configurable: true
812
+ });
813
+ Object.defineProperty(DisplayObject.prototype, "rotationY", {
814
+ /**
815
+ * Indicates the y-axis rotation of the DisplayObject instance, in degrees,
816
+ * from its original orientation relative to the 3D parent container. Values
817
+ * from 0 to 180 represent clockwise rotation; values from 0 to -180
818
+ * represent counterclockwise rotation. Values outside this range are added
819
+ * to or subtracted from 360 to obtain a value within the range.
820
+ */
821
+ get: function () {
822
+ return this._transform.rotation.y;
823
+ },
824
+ set: function (val) {
825
+ if (this.rotationY == val)
826
+ return;
827
+ this._transform.rotation.y = val;
828
+ this._transform.invalidateMatrix3D();
829
+ },
830
+ enumerable: false,
831
+ configurable: true
832
+ });
833
+ Object.defineProperty(DisplayObject.prototype, "rotationZ", {
834
+ /**
835
+ * Indicates the z-axis rotation of the DisplayObject instance, in degrees,
836
+ * from its original orientation relative to the 3D parent container. Values
837
+ * from 0 to 180 represent clockwise rotation; values from 0 to -180
838
+ * represent counterclockwise rotation. Values outside this range are added
839
+ * to or subtracted from 360 to obtain a value within the range.
840
+ */
841
+ get: function () {
842
+ return this._transform.rotation.z;
843
+ },
844
+ set: function (val) {
845
+ if (this.rotationZ == val)
846
+ return;
847
+ this._transform.rotation.z = val;
848
+ this._transform.invalidateMatrix3D();
849
+ },
850
+ enumerable: false,
851
+ configurable: true
852
+ });
853
+ Object.defineProperty(DisplayObject.prototype, "scale9Grid", {
854
+ /**
855
+ * The current scaling grid that is in effect. If set to <code>null</code>,
856
+ * the entire display object is scaled normally when any scale transformation
857
+ * is applied.
858
+ *
859
+ * <p>When you define the <code>scale9Grid</code> property, the display
860
+ * object is divided into a grid with nine regions based on the
861
+ * <code>scale9Grid</code> rectangle, which defines the center region of the
862
+ * grid. The eight other regions of the grid are the following areas: </p>
863
+ *
864
+ * <ul>
865
+ * <li>The upper-left corner outside of the rectangle</li>
866
+ * <li>The area above the rectangle </li>
867
+ * <li>The upper-right corner outside of the rectangle</li>
868
+ * <li>The area to the left of the rectangle</li>
869
+ * <li>The area to the right of the rectangle</li>
870
+ * <li>The lower-left corner outside of the rectangle</li>
871
+ * <li>The area below the rectangle</li>
872
+ * <li>The lower-right corner outside of the rectangle</li>
873
+ * </ul>
874
+ *
875
+ * <p>You can think of the eight regions outside of the center(defined by
876
+ * the rectangle) as being like a picture frame that has special rules
877
+ * applied to it when scaled.</p>
878
+ *
879
+ * <p>When the <code>scale9Grid</code> property is set and a display object
880
+ * is scaled, all text and gradients are scaled normally; however, for other
881
+ * types of objects the following rules apply:</p>
882
+ *
883
+ * <ul>
884
+ * <li>Content in the center region is scaled normally. </li>
885
+ * <li>Content in the corners is not scaled. </li>
886
+ * <li>Content in the top and bottom regions is scaled horizontally only.
887
+ * Content in the left and right regions is scaled vertically only.</li>
888
+ * <li>All fills(including bitmaps, video, and gradients) are stretched to
889
+ * fit their shapes.</li>
890
+ * </ul>
891
+ *
892
+ * <p>If a display object is rotated, all subsequent scaling is normal(and
893
+ * the <code>scale9Grid</code> property is ignored).</p>
894
+ *
895
+ * <p>For example, consider the following display object and a rectangle that
896
+ * is applied as the display object's <code>scale9Grid</code>:</p>
897
+ *
898
+ * <p>A common use for setting <code>scale9Grid</code> is to set up a display
899
+ * object to be used as a component, in which edge regions retain the same
900
+ * width when the component is scaled.</p>
901
+ *
902
+ * @throws ArgumentError If you pass an invalid argument to the method.
903
+ */
904
+ get: function () {
905
+ return this._scale9Grid;
906
+ },
907
+ set: function (value) {
908
+ this._scale9Grid = value;
909
+ this._invalidateHierarchicalProperty(HierarchicalProperty.SCALE9);
910
+ },
911
+ enumerable: false,
912
+ configurable: true
913
+ });
914
+ Object.defineProperty(DisplayObject.prototype, "scaleX", {
915
+ /**
916
+ * Indicates the horizontal scale(percentage) of the object as applied from
917
+ * the registration point. The default registration point is(0,0). 1.0
918
+ * equals 100% scale.
919
+ *
920
+ * <p>Scaling the local coordinate system changes the <code>x</code> and
921
+ * <code>y</code> property values, which are defined in whole pixels. </p>
922
+ */
923
+ get: function () {
924
+ return this._transform.scale.x;
925
+ },
926
+ set: function (val) {
927
+ //this._updateAbsoluteDimension();
928
+ this._setScaleX(val);
929
+ },
930
+ enumerable: false,
931
+ configurable: true
932
+ });
933
+ Object.defineProperty(DisplayObject.prototype, "scaleY", {
934
+ /**
935
+ * Indicates the vertical scale(percentage) of an object as applied from the
936
+ * registration point of the object. The default registration point is(0,0).
937
+ * 1.0 is 100% scale.
938
+ *
939
+ * <p>Scaling the local coordinate system changes the <code>x</code> and
940
+ * <code>y</code> property values, which are defined in whole pixels. </p>
941
+ */
942
+ get: function () {
943
+ return this._transform.scale.y;
944
+ },
945
+ set: function (val) {
946
+ //this._updateAbsoluteDimension();
947
+ this._setScaleY(val);
948
+ },
949
+ enumerable: false,
950
+ configurable: true
951
+ });
952
+ Object.defineProperty(DisplayObject.prototype, "scaleZ", {
953
+ /**
954
+ * Indicates the depth scale(percentage) of an object as applied from the
955
+ * registration point of the object. The default registration point is(0,0).
956
+ * 1.0 is 100% scale.
957
+ *
958
+ * <p>Scaling the local coordinate system changes the <code>x</code>,
959
+ * <code>y</code> and <code>z</code> property values, which are defined in
960
+ * whole pixels. </p>
961
+ */
962
+ get: function () {
963
+ return this._transform.scale.z;
964
+ },
965
+ set: function (val) {
966
+ //this._updateAbsoluteDimension();
967
+ this._setScaleZ(val);
968
+ },
969
+ enumerable: false,
970
+ configurable: true
971
+ });
972
+ Object.defineProperty(DisplayObject.prototype, "skewX", {
973
+ /**
974
+ * Indicates the horizontal skew(angle) of the object as applied from
975
+ * the registration point. The default registration point is(0,0).
976
+ */
977
+ get: function () {
978
+ return this._transform.skew.x;
979
+ },
980
+ set: function (val) {
981
+ if (this.skewX == val)
982
+ return;
983
+ this._transform.skew.x = val;
984
+ this._transform.invalidateMatrix3D();
985
+ },
986
+ enumerable: false,
987
+ configurable: true
988
+ });
989
+ Object.defineProperty(DisplayObject.prototype, "skewY", {
990
+ /**
991
+ * Indicates the vertical skew(angle) of an object as applied from the
992
+ * registration point of the object. The default registration point is(0,0).
993
+ */
994
+ get: function () {
995
+ return this._transform.skew.y;
996
+ },
997
+ set: function (val) {
998
+ if (this.skewY == val)
999
+ return;
1000
+ this._transform.skew.y = val;
1001
+ this._transform.invalidateMatrix3D();
1002
+ },
1003
+ enumerable: false,
1004
+ configurable: true
1005
+ });
1006
+ Object.defineProperty(DisplayObject.prototype, "skewZ", {
1007
+ /**
1008
+ * Indicates the depth skew(angle) of an object as applied from the
1009
+ * registration point of the object. The default registration point is(0,0).
1010
+ */
1011
+ get: function () {
1012
+ return this._transform.skew.z;
1013
+ },
1014
+ set: function (val) {
1015
+ if (this.skewZ == val)
1016
+ return;
1017
+ this._transform.skew.z = val;
1018
+ this._transform.invalidateMatrix3D();
1019
+ },
1020
+ enumerable: false,
1021
+ configurable: true
1022
+ });
1023
+ Object.defineProperty(DisplayObject.prototype, "scrollRect", {
1024
+ /**
1025
+ * The scroll rectangle bounds of the display object. The display object is
1026
+ * cropped to the size defined by the rectangle, and it scrolls within the
1027
+ * rectangle when you change the <code>x</code> and <code>y</code> properties
1028
+ * of the <code>scrollRect</code> object.
1029
+ *
1030
+ * <p>The properties of the <code>scrollRect</code> Rectangle object use the
1031
+ * display object's coordinate space and are scaled just like the overall
1032
+ * display object. The corner bounds of the cropped window on the scrolling
1033
+ * display object are the origin of the display object(0,0) and the point
1034
+ * defined by the width and height of the rectangle. They are not centered
1035
+ * around the origin, but use the origin to define the upper-left corner of
1036
+ * the area. A scrolled display object always scrolls in whole pixel
1037
+ * increments. </p>
1038
+ *
1039
+ * <p>You can scroll an object left and right by setting the <code>x</code>
1040
+ * property of the <code>scrollRect</code> Rectangle object. You can scroll
1041
+ * an object up and down by setting the <code>y</code> property of the
1042
+ * <code>scrollRect</code> Rectangle object. If the display object is rotated
1043
+ * 90° and you scroll it left and right, the display object actually scrolls
1044
+ * up and down.</p>
1045
+ */
1046
+ get: function () {
1047
+ var _a;
1048
+ return (_a = this._scrollRect) === null || _a === void 0 ? void 0 : _a.clone();
1049
+ },
1050
+ set: function (value) {
1051
+ var invalidatePos = true;
1052
+ if (!!this._scrollRect != !!value) {
1053
+ //invalidate masks only if scrollRect is being enabled or disabled
1054
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1055
+ this._scrollRect = value === null || value === void 0 ? void 0 : value.clone();
1056
+ }
1057
+ else if (this._scrollRect && !this._scrollRect.equals(value)) {
1058
+ this._scrollRect.copyFrom(value);
1059
+ }
1060
+ else {
1061
+ //invalidate position only if scrollRect changes
1062
+ invalidatePos = false;
1063
+ }
1064
+ if (invalidatePos) {
1065
+ this._transform.invalidatePosition();
1066
+ if (value) {
1067
+ if (!this._scrollRectPrimitive) {
1068
+ //create ScrollRectPrimitive
1069
+ this._scrollRectPrimitive = new Sprite();
1070
+ this._scrollRectPrimitive.maskMode = true;
1071
+ }
1072
+ //update ScrollRectPrimitive
1073
+ this._scrollRectPrimitive.graphics.clear();
1074
+ this._scrollRectPrimitive.graphics.beginFill(0x0000ff, 1);
1075
+ this._scrollRectPrimitive.graphics.drawRect(value.x, value.y, value.width, value.height);
1076
+ this._scrollRectPrimitive.graphics.endFill();
1077
+ }
1078
+ else if (this._scrollRectPrimitive) {
1079
+ //remove ScrollRectPrimitive
1080
+ this._scrollRectPrimitive = null;
1081
+ }
1082
+ }
1083
+ },
1084
+ enumerable: false,
1085
+ configurable: true
1086
+ });
1087
+ Object.defineProperty(DisplayObject.prototype, "material", {
1088
+ /**
1089
+ *
1090
+ */
1091
+ get: function () {
1092
+ return this._material;
1093
+ },
1094
+ set: function (value) {
1095
+ if (this._material == value)
1096
+ return;
1097
+ this._material = value;
1098
+ this._invalidateMaterial();
1099
+ },
1100
+ enumerable: false,
1101
+ configurable: true
1102
+ });
1103
+ Object.defineProperty(DisplayObject.prototype, "style", {
1104
+ /**
1105
+ *
1106
+ */
1107
+ get: function () {
1108
+ return this._style;
1109
+ },
1110
+ set: function (value) {
1111
+ if (this._style == value)
1112
+ return;
1113
+ if (this._style) {
1114
+ this._style.removeEventListener(StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
1115
+ this._style.removeEventListener(StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
1116
+ }
1117
+ this._style = value;
1118
+ if (this._style) {
1119
+ this._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
1120
+ this._style.addEventListener(StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
1121
+ }
1122
+ this._invalidateStyle();
1123
+ },
1124
+ enumerable: false,
1125
+ configurable: true
1126
+ });
1127
+ Object.defineProperty(DisplayObject.prototype, "boundsVisible", {
1128
+ /**
1129
+ *
1130
+ */
1131
+ get: function () {
1132
+ return this._boundsVisible;
1133
+ },
1134
+ set: function (value) {
1135
+ if (value == this._boundsVisible)
1136
+ return;
1137
+ this._boundsVisible = value;
1138
+ // if (this._boundsVisible && !this.partition)
1139
+ // this.partition = BasicPartition.getRootPartition(this);
1140
+ this.invalidate();
1141
+ },
1142
+ enumerable: false,
1143
+ configurable: true
1144
+ });
1145
+ DisplayObject.prototype.getScrollRectPrimitive = function () {
1146
+ return this._scrollRectPrimitive;
1147
+ };
1148
+ DisplayObject.prototype.getBoundsPrimitive = function (picker) {
1149
+ if (this._boundsPrimitive == null) {
1150
+ switch (this._defaultBoundingVolume) {
1151
+ case BoundingVolumeType.BOX:
1152
+ case BoundingVolumeType.BOX_BOUNDS:
1153
+ case BoundingVolumeType.BOX_BOUNDS_FAST:
1154
+ case BoundingVolumeType.BOX_FAST:
1155
+ this._boundsPrefab = new PrimitiveCubePrefab(null, ElementsType.LINE);
1156
+ this._boundsPrimitive = this._boundsPrefab.getNewObject();
1157
+ break;
1158
+ case BoundingVolumeType.SPHERE:
1159
+ case BoundingVolumeType.SPHERE_BOUNDS:
1160
+ case BoundingVolumeType.SPHERE_BOUNDS_FAST:
1161
+ case BoundingVolumeType.SPHERE_FAST:
1162
+ this._boundsPrefab = new PrimitiveSpherePrefab(null, ElementsType.LINE);
1163
+ this._boundsPrimitive = this._boundsPrefab.getNewObject();
1164
+ break;
1165
+ default:
1166
+ }
1167
+ this._boundsPrefabDirty = true;
1168
+ }
1169
+ if (this._boundsPrefabDirty)
1170
+ this._updateBoundsPrefab(picker);
1171
+ return this._boundsPrimitive;
1172
+ };
1173
+ Object.defineProperty(DisplayObject.prototype, "transform", {
1174
+ /**
1175
+ * An object with properties pertaining to a display object's matrix, color
1176
+ * transform, and pixel bounds. The specific properties - matrix,
1177
+ * colorTransform, and three read-only properties
1178
+ * (<code>concatenatedMatrix</code>, <code>concatenatedColorTransform</code>,
1179
+ * and <code>pixelBounds</code>) - are described in the entry for the
1180
+ * Transform class.
1181
+ *
1182
+ * <p>Each of the transform object's properties is itself an object. This
1183
+ * concept is important because the only way to set new values for the matrix
1184
+ * or colorTransform objects is to create a new object and copy that object
1185
+ * into the transform.matrix or transform.colorTransform property.</p>
1186
+ *
1187
+ * <p>For example, to increase the <code>tx</code> value of a display
1188
+ * object's matrix, you must make a copy of the entire matrix object, then
1189
+ * copy the new object into the matrix property of the transform object:</p>
1190
+ * <pre xml:space="preserve"><code> public myMatrix:Matrix =
1191
+ * myDisplayObject.transform.matrix; myMatrix.tx += 10;
1192
+ * myDisplayObject.transform.matrix = myMatrix; </code></pre>
1193
+ *
1194
+ * <p>You cannot directly set the <code>tx</code> property. The following
1195
+ * code has no effect on <code>myDisplayObject</code>: </p>
1196
+ * <pre xml:space="preserve"><code> myDisplayObject.transform.matrix.tx +=
1197
+ * 10; </code></pre>
1198
+ *
1199
+ * <p>You can also copy an entire transform object and assign it to another
1200
+ * display object's transform property. For example, the following code
1201
+ * copies the entire transform object from <code>myOldDisplayObj</code> to
1202
+ * <code>myNewDisplayObj</code>:</p>
1203
+ * <code>myNewDisplayObj.transform = myOldDisplayObj.transform;</code>
1204
+ *
1205
+ * <p>The resulting display object, <code>myNewDisplayObj</code>, now has the
1206
+ * same values for its matrix, color transform, and pixel bounds as the old
1207
+ * display object, <code>myOldDisplayObj</code>.</p>
1208
+ *
1209
+ * <p>Note that AIR for TV devices use hardware acceleration, if it is
1210
+ * available, for color transforms.</p>
1211
+ */
1212
+ get: function () {
1213
+ return this._transform;
1214
+ },
1215
+ enumerable: false,
1216
+ configurable: true
1217
+ });
1218
+ Object.defineProperty(DisplayObject.prototype, "visible", {
1219
+ /**
1220
+ * Whether or not the display object is visible. Display objects that are not
1221
+ * visible are disabled. For example, if <code>visible=false</code> for an
1222
+ * InteractiveObject instance, it cannot be clicked.
1223
+ */
1224
+ get: function () {
1225
+ return this._visible;
1226
+ },
1227
+ set: function (value) {
1228
+ if (this._visible == value)
1229
+ return;
1230
+ this._visible = value;
1231
+ this._invalidateHierarchicalProperty(HierarchicalProperty.VISIBLE);
1232
+ },
1233
+ enumerable: false,
1234
+ configurable: true
1235
+ });
1236
+ Object.defineProperty(DisplayObject.prototype, "timelineMasks", {
1237
+ get: function () {
1238
+ return this._timelineMasks;
1239
+ },
1240
+ /**
1241
+ * Update mask from timeline and take account that can be a scriptMask
1242
+ *
1243
+ * @param masks Masks from timeline
1244
+ */
1245
+ set: function (masks) {
1246
+ var oldMasks = this._timelineMasks ? this._timelineMasks : [];
1247
+ if (masks) {
1248
+ // and make sure that mask mode enabled if not already
1249
+ for (var i = masks.length - 1; i >= 0; i--) {
1250
+ var mask = masks[i];
1251
+ if (!mask) {
1252
+ console.warn('[DisplayObject] Timeline mask has null value, skipping it');
1253
+ masks.splice(i, 1);
1254
+ }
1255
+ else {
1256
+ var index = oldMasks.indexOf(mask);
1257
+ if (index != -1) {
1258
+ oldMasks.splice(index, 1);
1259
+ }
1260
+ else {
1261
+ mask.maskMode = true;
1262
+ }
1263
+ }
1264
+ }
1265
+ }
1266
+ //set mask mode to false for old masks
1267
+ for (var i = oldMasks.length - 1; i >= 0; i--)
1268
+ oldMasks[i].maskMode = false;
1269
+ this._timelineMasks = masks;
1270
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1271
+ },
1272
+ enumerable: false,
1273
+ configurable: true
1274
+ });
1275
+ Object.defineProperty(DisplayObject.prototype, "mouseChildren", {
1276
+ /**
1277
+ * Determines whether or not the children of the object are mouse, or user
1278
+ * input device, enabled. If an object is enabled, a user can interact with
1279
+ * it by using a mouse or user input device. The default is
1280
+ * <code>true</code>.
1281
+ *
1282
+ * <p>This property is useful when you create a button with an instance of
1283
+ * the Sprite class(instead of using the SimpleButton class). When you use a
1284
+ * Sprite instance to create a button, you can choose to decorate the button
1285
+ * by using the <code>addChild()</code> method to add additional Sprite
1286
+ * instances. This process can cause unexpected behavior with mouse events
1287
+ * because the Sprite instances you add as children can become the target
1288
+ * object of a mouse event when you expect the parent instance to be the
1289
+ * target object. To ensure that the parent instance serves as the target
1290
+ * objects for mouse events, you can set the <code>mouseChildren</code>
1291
+ * property of the parent instance to <code>false</code>.</p>
1292
+ *
1293
+ * <p> No event is dispatched by setting this property. You must use the
1294
+ * <code>addEventListener()</code> method to create interactive
1295
+ * functionality.</p>
1296
+ */
1297
+ get: function () {
1298
+ return this._mouseChildren;
1299
+ },
1300
+ set: function (value) {
1301
+ if (this._mouseChildren == value)
1302
+ return;
1303
+ this._mouseChildren = value;
1304
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MOUSE_ENABLED);
1305
+ },
1306
+ enumerable: false,
1307
+ configurable: true
1308
+ });
1309
+ Object.defineProperty(DisplayObject.prototype, "x", {
1310
+ /**
1311
+ * Indicates the <i>x</i> coordinate of the DisplayObject instance relative
1312
+ * to the local coordinates of the parent DisplayObjectContainer. If the
1313
+ * object is inside a DisplayObjectContainer that has transformations, it is
1314
+ * in the local coordinate system of the enclosing DisplayObjectContainer.
1315
+ * Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the
1316
+ * DisplayObjectContainer's children inherit a coordinate system that is
1317
+ * rotated 90° counterclockwise. The object's coordinates refer to the
1318
+ * registration point position.
1319
+ */
1320
+ get: function () {
1321
+ return this._transform.position.x;
1322
+ },
1323
+ set: function (val) {
1324
+ if (this._transform.position.x == val)
1325
+ return;
1326
+ this._transform.matrix3D._rawData[12] = val;
1327
+ this._transform.invalidatePosition();
1328
+ },
1329
+ enumerable: false,
1330
+ configurable: true
1331
+ });
1332
+ Object.defineProperty(DisplayObject.prototype, "y", {
1333
+ /**
1334
+ * Indicates the <i>y</i> coordinate of the DisplayObject instance relative
1335
+ * to the local coordinates of the parent DisplayObjectContainer. If the
1336
+ * object is inside a DisplayObjectContainer that has transformations, it is
1337
+ * in the local coordinate system of the enclosing DisplayObjectContainer.
1338
+ * Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the
1339
+ * DisplayObjectContainer's children inherit a coordinate system that is
1340
+ * rotated 90° counterclockwise. The object's coordinates refer to the
1341
+ * registration point position.
1342
+ */
1343
+ get: function () {
1344
+ return this._transform.position.y;
1345
+ },
1346
+ set: function (val) {
1347
+ if (this._transform.position.y == val)
1348
+ return;
1349
+ this._transform.matrix3D._rawData[13] = val;
1350
+ this._transform.invalidatePosition();
1351
+ },
1352
+ enumerable: false,
1353
+ configurable: true
1354
+ });
1355
+ Object.defineProperty(DisplayObject.prototype, "z", {
1356
+ /**
1357
+ * Indicates the z coordinate position along the z-axis of the DisplayObject
1358
+ * instance relative to the 3D parent container. The z property is used for
1359
+ * 3D coordinates, not screen or pixel coordinates.
1360
+ *
1361
+ * <p>When you set a <code>z</code> property for a display object to
1362
+ * something other than the default value of <code>0</code>, a corresponding
1363
+ * Matrix3D object is automatically created. for adjusting a display object's
1364
+ * position and orientation in three dimensions. When working with the
1365
+ * z-axis, the existing behavior of x and y properties changes from screen or
1366
+ * pixel coordinates to positions relative to the 3D parent container.</p>
1367
+ *
1368
+ * <p>For example, a child of the <code>_root</code> at position x = 100, y =
1369
+ * 100, z = 200 is not drawn at pixel location(100,100). The child is drawn
1370
+ * wherever the 3D projection calculation puts it. The calculation is:</p>
1371
+ *
1372
+ * <p><code>(x~~cameraFocalLength/cameraRelativeZPosition,
1373
+ * y~~cameraFocalLength/cameraRelativeZPosition)</code></p>
1374
+ */
1375
+ get: function () {
1376
+ return this._transform.position.z;
1377
+ },
1378
+ set: function (val) {
1379
+ if (this._transform.position.z == val)
1380
+ return;
1381
+ this._transform.matrix3D._rawData[14] = val;
1382
+ this._transform.invalidatePosition();
1383
+ },
1384
+ enumerable: false,
1385
+ configurable: true
1386
+ });
1387
+ DisplayObject.prototype.advanceFrame = function () {
1388
+ //default to do nothing
1389
+ };
1390
+ DisplayObject.prototype.getEntity = function () {
1391
+ if (this._iController)
1392
+ this._iController.update();
1393
+ return;
1394
+ };
1395
+ DisplayObject.prototype._initNode = function (node) { };
1396
+ /**
1397
+ *
1398
+ */
1399
+ DisplayObject.prototype.clone = function () {
1400
+ var newInstance = new DisplayObject();
1401
+ this.copyTo(newInstance);
1402
+ return newInstance;
1403
+ };
1404
+ DisplayObject.prototype.copyTo = function (displayObject) {
1405
+ var _a;
1406
+ displayObject.defaultBoundingVolume = this._defaultBoundingVolume;
1407
+ if (this._registrationMatrix3D)
1408
+ displayObject._registrationMatrix3D = this._registrationMatrix3D.clone();
1409
+ displayObject.mouseChildren = this._mouseChildren;
1410
+ displayObject.material = this._material;
1411
+ displayObject.style = this._style;
1412
+ displayObject.pickObject = this._pickObject;
1413
+ displayObject.pickObjectFromTimeline = this.pickObjectFromTimeline;
1414
+ displayObject.boundsVisible = this._boundsVisible;
1415
+ displayObject.name = this._pName;
1416
+ displayObject.mouseEnabled = this._mouseEnabled;
1417
+ displayObject.extra = this.extra;
1418
+ displayObject.maskMode = this._maskMode;
1419
+ displayObject.castsShadows = this.castsShadows;
1420
+ displayObject.assetNamespace = this.assetNamespace;
1421
+ displayObject._symbol = this._symbol;
1422
+ displayObject.avm1Symbol = this.avm1Symbol;
1423
+ displayObject.isAVMScene = this.isAVMScene;
1424
+ displayObject.isSlice9ScaledMC = this.isSlice9ScaledMC;
1425
+ displayObject.scale9Grid = (_a = this.scale9Grid) === null || _a === void 0 ? void 0 : _a.clone();
1426
+ if (this._timelineMasks) {
1427
+ // clone mask tree, to avoid corruption
1428
+ displayObject._timelineMasks = this._timelineMasks.slice();
1429
+ // manually call invalidation
1430
+ //displayObject._invalidateHierarchicalProperty(HierarchicalProperty.MASKS);
1431
+ }
1432
+ displayObject._mask = this._mask;
1433
+ this._transform.copyRawDataTo(displayObject._transform);
1434
+ };
1435
+ /**
1436
+ *
1437
+ */
1438
+ DisplayObject.prototype.dispose = function () {
1439
+ this.disposeValues();
1440
+ };
1441
+ DisplayObject.prototype.disposeValues = function () {
1442
+ if (this._parent)
1443
+ this._parent.removeChild(this);
1444
+ this.material = null;
1445
+ if (this._adapter) {
1446
+ this._adapter.dispose();
1447
+ this._adapter = null;
1448
+ }
1449
+ this._pickObject = null;
1450
+ delete this._timelineMasks;
1451
+ delete this._mask;
1452
+ };
1453
+ /**
1454
+ * Rotates the 3d object around to face a point defined relative
1455
+ * to the local coordinates of the parent <code>ObjectContainer3D</code>.
1456
+ *
1457
+ * @param scenePosition The vector defining the point to be looked at
1458
+ * @param upAxis An optional vector used to define the desired
1459
+ * up orientation of the 3d object after rotation has occurred
1460
+ */
1461
+ DisplayObject.prototype.lookAt = function (scenePosition, upAxis) {
1462
+ if (upAxis === void 0) { upAxis = null; }
1463
+ this.transform.lookAt(scenePosition, upAxis);
1464
+ };
1465
+ /**
1466
+ * Moves the local point around which the object rotates.
1467
+ *
1468
+ * @param dx The amount of movement along the local x axis.
1469
+ * @param dy The amount of movement along the local y axis.
1470
+ * @param dz The amount of movement along the local z axis.
1471
+ */
1472
+ DisplayObject.prototype.movePivot = function (dx, dy, dz) {
1473
+ if (dx == 0 && dy == 0 && dz == 0)
1474
+ return;
1475
+ if (!this._registrationMatrix3D)
1476
+ this._registrationMatrix3D = new Matrix3D();
1477
+ this._registrationMatrix3D._rawData[12] -= dx / this._transform.scale.x;
1478
+ this._registrationMatrix3D._rawData[13] -= dy / this._transform.scale.y;
1479
+ this._registrationMatrix3D._rawData[14] -= dz / this._transform.scale.z;
1480
+ this._invalidateHierarchicalProperty(HierarchicalProperty.SCENE_TRANSFORM);
1481
+ };
1482
+ DisplayObject.prototype.reset = function () {
1483
+ this.visible = true;
1484
+ if (!this.noTimelineUpdate)
1485
+ this._transform.clearMatrix3D();
1486
+ this._transform.clearColorTransform();
1487
+ //this.name="";
1488
+ this.mask = undefined;
1489
+ this.timelineMasks = undefined;
1490
+ this.maskMode = false;
1491
+ };
1492
+ /*
1493
+ this checks if the mc is part of the displaylist (child of the stage)
1494
+ todo: probably not the best way to do this
1495
+ probably better to get this info by looking at root
1496
+ */
1497
+ DisplayObject.prototype.isOnDisplayList = function () {
1498
+ var parent = this;
1499
+ while (parent) {
1500
+ if (parent.isAVMScene)
1501
+ return true;
1502
+ parent = parent.parent;
1503
+ }
1504
+ return false;
1505
+ };
1506
+ /**
1507
+ * @internal
1508
+ */
1509
+ DisplayObject.prototype._setParent = function (parent) {
1510
+ this._parent = parent;
1511
+ };
1512
+ DisplayObject.prototype._invalidateHierarchicalProperty = function (propDirty) {
1513
+ for (var key in this._containerNodes)
1514
+ this._containerNodes[key].invalidateHierarchicalProperty(propDirty);
1515
+ };
1516
+ Object.defineProperty(DisplayObject.prototype, "maskId", {
1517
+ /**
1518
+ * @internal
1519
+ */
1520
+ get: function () {
1521
+ return this._maskId;
1522
+ },
1523
+ enumerable: false,
1524
+ configurable: true
1525
+ });
1526
+ DisplayObject.prototype._setScaleX = function (val) {
1527
+ if (this.scaleX == val)
1528
+ return;
1529
+ this._transform.scale.x = val;
1530
+ this._transform.invalidateMatrix3D();
1531
+ };
1532
+ DisplayObject.prototype._setScaleY = function (val) {
1533
+ if (this.scaleY == val)
1534
+ return;
1535
+ this._transform.scale.y = val;
1536
+ this._transform.invalidateMatrix3D();
1537
+ };
1538
+ DisplayObject.prototype._setScaleZ = function (val) {
1539
+ if (this.scaleZ == val)
1540
+ return;
1541
+ this._transform.scale.z = val;
1542
+ this._transform.invalidateMatrix3D();
1543
+ };
1544
+ DisplayObject.prototype._updateBoundsPrefab = function (picker) {
1545
+ if (this._boundsPrefab instanceof PrimitiveCubePrefab) {
1546
+ var box = picker.getBoundingVolume(null, this._defaultBoundingVolume).getBox();
1547
+ //TODO: if box is null, no prefab should be visible
1548
+ if (box == null)
1549
+ return;
1550
+ this._boundsPrefab.width = box.width;
1551
+ this._boundsPrefab.height = box.height;
1552
+ this._boundsPrefab.depth = box.depth;
1553
+ this._boundsPrimitive.registrationPoint = new Vector3D(-(box.x + box.width / 2) * this._boundsPrimitive.transform.scale.x, -(box.y + box.height / 2) * this._boundsPrimitive.transform.scale.y, -(box.z + box.depth / 2) * this._boundsPrimitive.transform.scale.z);
1554
+ }
1555
+ else if (this._boundsPrefab instanceof PrimitiveSpherePrefab) {
1556
+ var sphere = picker.getBoundingVolume(null, this._defaultBoundingVolume).getSphere();
1557
+ //console.log(sphere);
1558
+ if (sphere == null)
1559
+ return;
1560
+ this._boundsPrefab.radius = sphere.radius;
1561
+ this._boundsPrimitive.registrationPoint = new Vector3D(-sphere.x * this._boundsPrimitive.transform.scale.x, -sphere.y * this._boundsPrimitive.transform.scale.y, -sphere.z * this._boundsPrimitive.transform.scale.z);
1562
+ }
1563
+ };
1564
+ DisplayObject.prototype._updateMaskMode = function () {
1565
+ if (this._maskMode) {
1566
+ this._mouseEnabled = false;
1567
+ }
1568
+ this._invalidateHierarchicalProperty(HierarchicalProperty.MASK_ID);
1569
+ };
1570
+ DisplayObject.prototype._invalidateMaterial = function () {
1571
+ for (var key in this._renderObjects)
1572
+ this._renderObjects[key]._onInvalidateMaterial();
1573
+ };
1574
+ DisplayObject.prototype._invalidateStyle = function () {
1575
+ for (var key in this._renderObjects)
1576
+ this._renderObjects[key]._onInvalidateStyle();
1577
+ };
1578
+ DisplayObject.prototype.invalidateElements = function () {
1579
+ for (var key in this._renderObjects)
1580
+ this._renderObjects[key]._onInvalidateElements();
1581
+ };
1582
+ DisplayObject.prototype._onInvalidateProperties = function (_event) {
1583
+ if (_event === void 0) { _event = null; }
1584
+ this._invalidateStyle();
1585
+ };
1586
+ DisplayObject.prototype._onInvalidateImages = function (_event) {
1587
+ if (_event === void 0) { _event = null; }
1588
+ this.invalidate();
1589
+ };
1590
+ DisplayObject.prototype._getDefaultBoundingVolume = function () {
1591
+ return BoundingVolumeType.BOX_BOUNDS_FAST;
1592
+ };
1593
+ return DisplayObject;
1594
+ }(AssetBase));
1595
+ export { DisplayObject };