@next2d/player 1.14.19 → 1.14.21

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 (386) hide show
  1. package/index.js +3 -3
  2. package/package.json +31 -6
  3. package/interface/AjaxEventImpl.d.ts +0 -5
  4. package/interface/AjaxEventImpl.js +0 -1
  5. package/interface/AjaxOptionImpl.d.ts +0 -13
  6. package/interface/AjaxOptionImpl.js +0 -1
  7. package/interface/AttachmentImpl.d.ts +0 -11
  8. package/interface/AttachmentImpl.js +0 -1
  9. package/interface/BitmapDataChannelImpl.d.ts +0 -1
  10. package/interface/BitmapDataChannelImpl.js +0 -1
  11. package/interface/BitmapDrawObjectImpl.d.ts +0 -6
  12. package/interface/BitmapDrawObjectImpl.js +0 -1
  13. package/interface/BitmapFilterTypeImpl.d.ts +0 -1
  14. package/interface/BitmapFilterTypeImpl.js +0 -1
  15. package/interface/BlendModeImpl.d.ts +0 -1
  16. package/interface/BlendModeImpl.js +0 -1
  17. package/interface/BoundsImpl.d.ts +0 -6
  18. package/interface/BoundsImpl.js +0 -1
  19. package/interface/Character.d.ts +0 -2
  20. package/interface/Character.js +0 -1
  21. package/interface/CharacterImpl.d.ts +0 -2
  22. package/interface/CharacterImpl.js +0 -1
  23. package/interface/ClipObjectImpl.d.ts +0 -14
  24. package/interface/ClipObjectImpl.js +0 -1
  25. package/interface/ColorStopImpl.d.ts +0 -7
  26. package/interface/ColorStopImpl.js +0 -1
  27. package/interface/DictionaryTagImpl.d.ts +0 -7
  28. package/interface/DictionaryTagImpl.js +0 -1
  29. package/interface/DisplacementMapFilterModeImpl.d.ts +0 -1
  30. package/interface/DisplacementMapFilterModeImpl.js +0 -1
  31. package/interface/DisplayImpl.d.ts +0 -28
  32. package/interface/DisplayImpl.js +0 -1
  33. package/interface/DisplayObjectImpl.d.ts +0 -2
  34. package/interface/DisplayObjectImpl.js +0 -1
  35. package/interface/DragRulesImpl.d.ts +0 -7
  36. package/interface/DragRulesImpl.js +0 -1
  37. package/interface/DropTargetImpl.d.ts +0 -2
  38. package/interface/DropTargetImpl.js +0 -1
  39. package/interface/EventDispatcherImpl.d.ts +0 -2
  40. package/interface/EventDispatcherImpl.js +0 -1
  41. package/interface/EventListenerImpl.d.ts +0 -6
  42. package/interface/EventListenerImpl.js +0 -1
  43. package/interface/EventsImpl.d.ts +0 -20
  44. package/interface/EventsImpl.js +0 -1
  45. package/interface/FillMeshImpl.d.ts +0 -5
  46. package/interface/FillMeshImpl.js +0 -1
  47. package/interface/FilterArrayImpl.d.ts +0 -10
  48. package/interface/FilterArrayImpl.js +0 -1
  49. package/interface/FilterQualityImpl.d.ts +0 -1
  50. package/interface/FilterQualityImpl.js +0 -1
  51. package/interface/FiltersImpl.d.ts +0 -20
  52. package/interface/FiltersImpl.js +0 -1
  53. package/interface/GeomImpl.d.ts +0 -12
  54. package/interface/GeomImpl.js +0 -1
  55. package/interface/GradientTypeImpl.d.ts +0 -3
  56. package/interface/GradientTypeImpl.js +0 -1
  57. package/interface/GraphicsParentImpl.d.ts +0 -2
  58. package/interface/GraphicsParentImpl.js +0 -1
  59. package/interface/GridImpl.d.ts +0 -6
  60. package/interface/GridImpl.js +0 -1
  61. package/interface/ImageTypeImpl.d.ts +0 -1
  62. package/interface/ImageTypeImpl.js +0 -1
  63. package/interface/IndexRangeImpl.d.ts +0 -4
  64. package/interface/IndexRangeImpl.js +0 -1
  65. package/interface/LoaderInfoDataImpl.d.ts +0 -7
  66. package/interface/LoaderInfoDataImpl.js +0 -1
  67. package/interface/LoopConfigImpl.d.ts +0 -8
  68. package/interface/LoopConfigImpl.js +0 -1
  69. package/interface/LoopTypeImpl.d.ts +0 -1
  70. package/interface/LoopTypeImpl.js +0 -1
  71. package/interface/MediaImpl.d.ts +0 -10
  72. package/interface/MediaImpl.js +0 -1
  73. package/interface/MovieClipActionObjectImpl.d.ts +0 -5
  74. package/interface/MovieClipActionObjectImpl.js +0 -1
  75. package/interface/MovieClipCharacterImpl.d.ts +0 -18
  76. package/interface/MovieClipCharacterImpl.js +0 -1
  77. package/interface/MovieClipLabelObjectImpl.d.ts +0 -4
  78. package/interface/MovieClipLabelObjectImpl.js +0 -1
  79. package/interface/MovieClipSoundObjectImpl.d.ts +0 -5
  80. package/interface/MovieClipSoundObjectImpl.js +0 -1
  81. package/interface/NetImpl.d.ts +0 -6
  82. package/interface/NetImpl.js +0 -1
  83. package/interface/NoCodeDataImpl.d.ts +0 -7
  84. package/interface/NoCodeDataImpl.js +0 -1
  85. package/interface/NoCodeDataZlibImpl.d.ts +0 -4
  86. package/interface/NoCodeDataZlibImpl.js +0 -1
  87. package/interface/ParentImpl.d.ts +0 -2
  88. package/interface/ParentImpl.js +0 -1
  89. package/interface/PlaceObjectImpl.d.ts +0 -12
  90. package/interface/PlaceObjectImpl.js +0 -1
  91. package/interface/PlayerHitObjectImpl.d.ts +0 -7
  92. package/interface/PlayerHitObjectImpl.js +0 -1
  93. package/interface/PlayerModeImpl.d.ts +0 -1
  94. package/interface/PlayerModeImpl.js +0 -1
  95. package/interface/PlayerOptionsImpl.d.ts +0 -8
  96. package/interface/PlayerOptionsImpl.js +0 -1
  97. package/interface/PointImpl.d.ts +0 -4
  98. package/interface/PointImpl.js +0 -1
  99. package/interface/PreObjectImpl.d.ts +0 -23
  100. package/interface/PreObjectImpl.js +0 -1
  101. package/interface/PropertyBitmapDataMessageImpl.d.ts +0 -8
  102. package/interface/PropertyBitmapDataMessageImpl.js +0 -1
  103. package/interface/PropertyContainerMessageImpl.d.ts +0 -6
  104. package/interface/PropertyContainerMessageImpl.js +0 -1
  105. package/interface/PropertyMessageImpl.d.ts +0 -41
  106. package/interface/PropertyMessageImpl.js +0 -1
  107. package/interface/PropertyMessageMapImpl.d.ts +0 -2
  108. package/interface/PropertyMessageMapImpl.js +0 -1
  109. package/interface/PropertyShapeMessageImpl.d.ts +0 -6
  110. package/interface/PropertyShapeMessageImpl.js +0 -1
  111. package/interface/PropertyTextMessageImpl.d.ts +0 -25
  112. package/interface/PropertyTextMessageImpl.js +0 -1
  113. package/interface/PropertyVideoMessageImpl.d.ts +0 -5
  114. package/interface/PropertyVideoMessageImpl.js +0 -1
  115. package/interface/RGBAImpl.d.ts +0 -6
  116. package/interface/RGBAImpl.js +0 -1
  117. package/interface/ShapeCharacterImpl.d.ts +0 -14
  118. package/interface/ShapeCharacterImpl.js +0 -1
  119. package/interface/SoundCharacterImpl.d.ts +0 -5
  120. package/interface/SoundCharacterImpl.js +0 -1
  121. package/interface/SoundTagImpl.d.ts +0 -6
  122. package/interface/SoundTagImpl.js +0 -1
  123. package/interface/SpriteImpl.d.ts +0 -2
  124. package/interface/SpriteImpl.js +0 -1
  125. package/interface/StageDataImpl.d.ts +0 -6
  126. package/interface/StageDataImpl.js +0 -1
  127. package/interface/StageQualityImpl.d.ts +0 -1
  128. package/interface/StageQualityImpl.js +0 -1
  129. package/interface/StrokeMethImpl.d.ts +0 -4
  130. package/interface/StrokeMethImpl.js +0 -1
  131. package/interface/StrokeTypeImpl.d.ts +0 -2
  132. package/interface/StrokeTypeImpl.js +0 -1
  133. package/interface/SurfaceFilterImpl.d.ts +0 -6
  134. package/interface/SurfaceFilterImpl.js +0 -1
  135. package/interface/TextBreakObjectImpl.d.ts +0 -9
  136. package/interface/TextBreakObjectImpl.js +0 -1
  137. package/interface/TextCharacterImpl.d.ts +0 -27
  138. package/interface/TextCharacterImpl.js +0 -1
  139. package/interface/TextDataImpl.d.ts +0 -2
  140. package/interface/TextDataImpl.js +0 -1
  141. package/interface/TextFieldAutoSizeImpl.d.ts +0 -1
  142. package/interface/TextFieldAutoSizeImpl.js +0 -1
  143. package/interface/TextFieldTypeImpl.d.ts +0 -1
  144. package/interface/TextFieldTypeImpl.js +0 -1
  145. package/interface/TextFormatAlignImpl.d.ts +0 -1
  146. package/interface/TextFormatAlignImpl.js +0 -1
  147. package/interface/TextFormatVerticalAlignImpl.d.ts +0 -1
  148. package/interface/TextFormatVerticalAlignImpl.js +0 -1
  149. package/interface/TextImageObjectImpl.d.ts +0 -11
  150. package/interface/TextImageObjectImpl.js +0 -1
  151. package/interface/TextImpl.d.ts +0 -6
  152. package/interface/TextImpl.js +0 -1
  153. package/interface/TextObjectImpl.d.ts +0 -7
  154. package/interface/TextObjectImpl.js +0 -1
  155. package/interface/TextObjectModeImpl.d.ts +0 -1
  156. package/interface/TextObjectModeImpl.js +0 -1
  157. package/interface/TextStringObjectImpl.d.ts +0 -7
  158. package/interface/TextStringObjectImpl.js +0 -1
  159. package/interface/UIImpl.d.ts +0 -8
  160. package/interface/UIImpl.js +0 -1
  161. package/interface/URLLoaderDataFormatImpl.d.ts +0 -1
  162. package/interface/URLLoaderDataFormatImpl.js +0 -1
  163. package/interface/URLRequestMethodImpl.d.ts +0 -1
  164. package/interface/URLRequestMethodImpl.js +0 -1
  165. package/interface/UniformDataImpl.d.ts +0 -5
  166. package/interface/UniformDataImpl.js +0 -1
  167. package/interface/UnzipQueueImpl.d.ts +0 -6
  168. package/interface/UnzipQueueImpl.js +0 -1
  169. package/interface/VerticesImpl.d.ts +0 -1
  170. package/interface/VerticesImpl.js +0 -1
  171. package/interface/VideoCharacterImpl.d.ts +0 -12
  172. package/interface/VideoCharacterImpl.js +0 -1
  173. package/next2d/display/BitmapData.d.ts +0 -143
  174. package/next2d/display/BitmapData.js +0 -387
  175. package/next2d/display/BlendMode.d.ts +0 -204
  176. package/next2d/display/BlendMode.js +0 -240
  177. package/next2d/display/DisplayObject.d.ts +0 -565
  178. package/next2d/display/DisplayObject.js +0 -1670
  179. package/next2d/display/DisplayObjectContainer.d.ts +0 -351
  180. package/next2d/display/DisplayObjectContainer.js +0 -1776
  181. package/next2d/display/FrameLabel.d.ts +0 -98
  182. package/next2d/display/FrameLabel.js +0 -120
  183. package/next2d/display/Graphics.d.ts +0 -577
  184. package/next2d/display/Graphics.js +0 -2161
  185. package/next2d/display/GraphicsBitmapFill.d.ts +0 -49
  186. package/next2d/display/GraphicsBitmapFill.js +0 -86
  187. package/next2d/display/GraphicsGradientFill.d.ts +0 -66
  188. package/next2d/display/GraphicsGradientFill.js +0 -157
  189. package/next2d/display/InteractiveObject.d.ts +0 -32
  190. package/next2d/display/InteractiveObject.js +0 -43
  191. package/next2d/display/Loader.d.ts +0 -131
  192. package/next2d/display/Loader.js +0 -321
  193. package/next2d/display/LoaderInfo.d.ts +0 -122
  194. package/next2d/display/LoaderInfo.js +0 -184
  195. package/next2d/display/LoopConfig.d.ts +0 -108
  196. package/next2d/display/LoopConfig.js +0 -156
  197. package/next2d/display/LoopType.d.ts +0 -104
  198. package/next2d/display/LoopType.js +0 -122
  199. package/next2d/display/MovieClip.d.ts +0 -314
  200. package/next2d/display/MovieClip.js +0 -941
  201. package/next2d/display/Shape.d.ts +0 -169
  202. package/next2d/display/Shape.js +0 -509
  203. package/next2d/display/Sprite.d.ts +0 -175
  204. package/next2d/display/Sprite.js +0 -280
  205. package/next2d/display/Stage.d.ts +0 -164
  206. package/next2d/display/Stage.js +0 -251
  207. package/next2d/events/Event.d.ts +0 -424
  208. package/next2d/events/Event.js +0 -560
  209. package/next2d/events/EventDispatcher.d.ts +0 -138
  210. package/next2d/events/EventDispatcher.js +0 -623
  211. package/next2d/events/EventPhase.d.ts +0 -80
  212. package/next2d/events/EventPhase.js +0 -94
  213. package/next2d/events/FocusEvent.d.ts +0 -89
  214. package/next2d/events/FocusEvent.js +0 -103
  215. package/next2d/events/HTTPStatusEvent.d.ts +0 -107
  216. package/next2d/events/HTTPStatusEvent.js +0 -139
  217. package/next2d/events/IOErrorEvent.d.ts +0 -82
  218. package/next2d/events/IOErrorEvent.js +0 -101
  219. package/next2d/events/MouseEvent.d.ts +0 -163
  220. package/next2d/events/MouseEvent.js +0 -207
  221. package/next2d/events/ProgressEvent.d.ts +0 -97
  222. package/next2d/events/ProgressEvent.js +0 -123
  223. package/next2d/events/VideoEvent.d.ts +0 -145
  224. package/next2d/events/VideoEvent.js +0 -181
  225. package/next2d/filters/BevelFilter.d.ts +0 -254
  226. package/next2d/filters/BevelFilter.js +0 -491
  227. package/next2d/filters/BitmapFilter.d.ts +0 -75
  228. package/next2d/filters/BitmapFilter.js +0 -95
  229. package/next2d/filters/BlurFilter.d.ts +0 -150
  230. package/next2d/filters/BlurFilter.js +0 -370
  231. package/next2d/filters/ColorMatrixFilter.d.ts +0 -116
  232. package/next2d/filters/ColorMatrixFilter.js +0 -179
  233. package/next2d/filters/ConvolutionFilter.d.ts +0 -210
  234. package/next2d/filters/ConvolutionFilter.js +0 -366
  235. package/next2d/filters/DisplacementMapFilter.d.ts +0 -212
  236. package/next2d/filters/DisplacementMapFilter.js +0 -372
  237. package/next2d/filters/DropShadowFilter.d.ts +0 -240
  238. package/next2d/filters/DropShadowFilter.js +0 -461
  239. package/next2d/filters/GlowFilter.d.ts +0 -204
  240. package/next2d/filters/GlowFilter.js +0 -356
  241. package/next2d/filters/GradientBevelFilter.d.ts +0 -243
  242. package/next2d/filters/GradientBevelFilter.js +0 -474
  243. package/next2d/filters/GradientGlowFilter.d.ts +0 -243
  244. package/next2d/filters/GradientGlowFilter.js +0 -464
  245. package/next2d/geom/ColorTransform.d.ts +0 -201
  246. package/next2d/geom/ColorTransform.js +0 -278
  247. package/next2d/geom/Matrix.d.ts +0 -299
  248. package/next2d/geom/Matrix.js +0 -454
  249. package/next2d/geom/Point.d.ts +0 -213
  250. package/next2d/geom/Point.js +0 -274
  251. package/next2d/geom/Rectangle.d.ts +0 -364
  252. package/next2d/geom/Rectangle.js +0 -513
  253. package/next2d/geom/Transform.d.ts +0 -213
  254. package/next2d/geom/Transform.js +0 -492
  255. package/next2d/media/Sound.d.ts +0 -208
  256. package/next2d/media/Sound.js +0 -504
  257. package/next2d/media/SoundMixer.d.ts +0 -68
  258. package/next2d/media/SoundMixer.js +0 -115
  259. package/next2d/media/SoundTransform.d.ts +0 -80
  260. package/next2d/media/SoundTransform.js +0 -111
  261. package/next2d/media/Video.d.ts +0 -331
  262. package/next2d/media/Video.js +0 -856
  263. package/next2d/net/URLRequest.d.ts +0 -143
  264. package/next2d/net/URLRequest.js +0 -232
  265. package/next2d/net/URLRequestHeader.d.ts +0 -82
  266. package/next2d/net/URLRequestHeader.js +0 -105
  267. package/next2d/text/TextField.d.ts +0 -644
  268. package/next2d/text/TextField.js +0 -2662
  269. package/next2d/text/TextFormat.d.ts +0 -250
  270. package/next2d/text/TextFormat.js +0 -460
  271. package/next2d/ui/Easing.d.ts +0 -359
  272. package/next2d/ui/Easing.js +0 -481
  273. package/next2d/ui/Job.d.ts +0 -155
  274. package/next2d/ui/Job.js +0 -333
  275. package/next2d/ui/Tween.d.ts +0 -62
  276. package/next2d/ui/Tween.js +0 -72
  277. package/packages/Display.d.ts +0 -3
  278. package/packages/Display.js +0 -36
  279. package/packages/Events.d.ts +0 -3
  280. package/packages/Events.js +0 -28
  281. package/packages/Filters.d.ts +0 -3
  282. package/packages/Filters.js +0 -28
  283. package/packages/Geom.d.ts +0 -3
  284. package/packages/Geom.js +0 -20
  285. package/packages/Media.d.ts +0 -3
  286. package/packages/Media.js +0 -18
  287. package/packages/Net.d.ts +0 -3
  288. package/packages/Net.js +0 -14
  289. package/packages/Text.d.ts +0 -3
  290. package/packages/Text.js +0 -14
  291. package/packages/UI.d.ts +0 -3
  292. package/packages/UI.js +0 -16
  293. package/player/Next2D.d.ts +0 -70
  294. package/player/Next2D.js +0 -192
  295. package/player/Player.d.ts +0 -334
  296. package/player/Player.js +0 -1863
  297. package/util/CacheStore.d.ts +0 -115
  298. package/util/CacheStore.js +0 -276
  299. package/util/Global.d.ts +0 -23
  300. package/util/Global.js +0 -67
  301. package/util/RenderUtil.d.ts +0 -472
  302. package/util/RenderUtil.js +0 -686
  303. package/util/Shortcut.d.ts +0 -28
  304. package/util/Shortcut.js +0 -28
  305. package/util/Util.d.ts +0 -334
  306. package/util/Util.js +0 -844
  307. package/webgl/BezierConverter.d.ts +0 -59
  308. package/webgl/BezierConverter.js +0 -106
  309. package/webgl/CanvasGradientToWebGL.d.ts +0 -94
  310. package/webgl/CanvasGradientToWebGL.js +0 -181
  311. package/webgl/CanvasPatternToWebGL.d.ts +0 -39
  312. package/webgl/CanvasPatternToWebGL.js +0 -66
  313. package/webgl/CanvasToWebGLContext.d.ts +0 -596
  314. package/webgl/CanvasToWebGLContext.js +0 -1421
  315. package/webgl/CanvasToWebGLContextBlend.d.ts +0 -97
  316. package/webgl/CanvasToWebGLContextBlend.js +0 -299
  317. package/webgl/CanvasToWebGLContextGrid.d.ts +0 -74
  318. package/webgl/CanvasToWebGLContextGrid.js +0 -283
  319. package/webgl/CanvasToWebGLContextMask.d.ts +0 -113
  320. package/webgl/CanvasToWebGLContextMask.js +0 -436
  321. package/webgl/CanvasToWebGLContextPath.d.ts +0 -111
  322. package/webgl/CanvasToWebGLContextPath.js +0 -210
  323. package/webgl/CanvasToWebGLContextStyle.d.ts +0 -77
  324. package/webgl/CanvasToWebGLContextStyle.js +0 -139
  325. package/webgl/ColorBufferPool.d.ts +0 -58
  326. package/webgl/ColorBufferPool.js +0 -134
  327. package/webgl/FrameBufferManager.d.ts +0 -135
  328. package/webgl/FrameBufferManager.js +0 -358
  329. package/webgl/StencilBufferPool.d.ts +0 -56
  330. package/webgl/StencilBufferPool.js +0 -142
  331. package/webgl/TextureManager.d.ts +0 -130
  332. package/webgl/TextureManager.js +0 -296
  333. package/webgl/VertexArrayObjectManager.d.ts +0 -95
  334. package/webgl/VertexArrayObjectManager.js +0 -277
  335. package/webgl/WebGLFillMeshGenerator.d.ts +0 -31
  336. package/webgl/WebGLFillMeshGenerator.js +0 -101
  337. package/webgl/WebGLStrokeMeshGenerator.d.ts +0 -182
  338. package/webgl/WebGLStrokeMeshGenerator.js +0 -504
  339. package/webgl/shader/CanvasToWebGLShader.d.ts +0 -85
  340. package/webgl/shader/CanvasToWebGLShader.js +0 -192
  341. package/webgl/shader/CanvasToWebGLShaderList.d.ts +0 -70
  342. package/webgl/shader/CanvasToWebGLShaderList.js +0 -109
  343. package/webgl/shader/GradientLUTGenerator.d.ts +0 -36
  344. package/webgl/shader/GradientLUTGenerator.js +0 -123
  345. package/webgl/shader/WebGLShaderUniform.d.ts +0 -52
  346. package/webgl/shader/WebGLShaderUniform.js +0 -165
  347. package/webgl/shader/fragment/FragmentShaderLibrary.d.ts +0 -18
  348. package/webgl/shader/fragment/FragmentShaderLibrary.js +0 -35
  349. package/webgl/shader/fragment/FragmentShaderSource.d.ts +0 -29
  350. package/webgl/shader/fragment/FragmentShaderSource.js +0 -99
  351. package/webgl/shader/fragment/FragmentShaderSourceBlend.d.ts +0 -67
  352. package/webgl/shader/fragment/FragmentShaderSourceBlend.js +0 -319
  353. package/webgl/shader/fragment/FragmentShaderSourceGradient.d.ts +0 -44
  354. package/webgl/shader/fragment/FragmentShaderSourceGradient.js +0 -114
  355. package/webgl/shader/fragment/FragmentShaderSourceGradientLUT.d.ts +0 -14
  356. package/webgl/shader/fragment/FragmentShaderSourceGradientLUT.js +0 -58
  357. package/webgl/shader/fragment/FragmentShaderSourceTexture.d.ts +0 -12
  358. package/webgl/shader/fragment/FragmentShaderSourceTexture.js +0 -36
  359. package/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.d.ts +0 -12
  360. package/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.js +0 -42
  361. package/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.d.ts +0 -11
  362. package/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.js +0 -35
  363. package/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.d.ts +0 -16
  364. package/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.js +0 -80
  365. package/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.d.ts +0 -15
  366. package/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.js +0 -106
  367. package/webgl/shader/fragment/filter/FragmentShaderSourceFilter.d.ts +0 -112
  368. package/webgl/shader/fragment/filter/FragmentShaderSourceFilter.js +0 -275
  369. package/webgl/shader/variants/BlendShaderVariantCollection.d.ts +0 -99
  370. package/webgl/shader/variants/BlendShaderVariantCollection.js +0 -239
  371. package/webgl/shader/variants/FilterShaderVariantCollection.d.ts +0 -150
  372. package/webgl/shader/variants/FilterShaderVariantCollection.js +0 -395
  373. package/webgl/shader/variants/GradientLUTShaderVariantCollection.d.ts +0 -49
  374. package/webgl/shader/variants/GradientLUTShaderVariantCollection.js +0 -107
  375. package/webgl/shader/variants/GradientShapeShaderVariantCollection.d.ts +0 -61
  376. package/webgl/shader/variants/GradientShapeShaderVariantCollection.js +0 -196
  377. package/webgl/shader/variants/ShapeShaderVariantCollection.d.ts +0 -117
  378. package/webgl/shader/variants/ShapeShaderVariantCollection.js +0 -427
  379. package/webgl/shader/vertex/VertexShaderLibrary.d.ts +0 -18
  380. package/webgl/shader/vertex/VertexShaderLibrary.js +0 -75
  381. package/webgl/shader/vertex/VertexShaderSource.d.ts +0 -23
  382. package/webgl/shader/vertex/VertexShaderSource.js +0 -92
  383. package/webgl/shader/vertex/VertexShaderSourceFill.d.ts +0 -45
  384. package/webgl/shader/vertex/VertexShaderSourceFill.js +0 -112
  385. package/webgl/shader/vertex/VertexShaderSourceStroke.d.ts +0 -27
  386. package/webgl/shader/vertex/VertexShaderSourceStroke.js +0 -149
@@ -1,1776 +0,0 @@
1
- import { InteractiveObject } from "./InteractiveObject";
2
- import { Event as Next2DEvent } from "../events/Event";
3
- import { Rectangle } from "../geom/Rectangle";
4
- import { $doUpdated } from "../../util/Global";
5
- import { $createInstance, $currentPlayer, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $rendererWorker } from "../../util/Util";
6
- import { $boundsMatrix, $clamp, $getArray, $getBoundsObject, $getFloat32Array6, $getFloat32Array8, $getMap, $getPreObject, $Math, $COLOR_ARRAY_IDENTITY, $MATRIX_ARRAY_IDENTITY, $multiplicationColor, $multiplicationMatrix, $Number, $poolArray, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $poolMap, $poolPreObject } from "../../util/RenderUtil";
7
- /**
8
- * DisplayObjectContainer クラスは、表示リストで表示オブジェクトコンテナとして機能するすべてのオブジェクトの基本クラスです。
9
- * このクラス自体は、画面上でのコンテンツの描画のための API を含みません。
10
- * そのため、DisplayObject クラスのカスタムサブクラスを作成する場合は、
11
- * Sprite、または MovieClip など、画面上にコンテンツを描画する API を持つサブクラスの 1 つを拡張する必要があります。
12
- *
13
- * The DisplayObjectContainer class is the base class for all objects that can serve
14
- * as display object containers on the display list.
15
- * This class itself does not contain any API for drawing content on the screen.
16
- * Therefore, if you want to create a custom subclass of the DisplayObject class,
17
- * you need to extend one of its subclasses that has an API for drawing content on the screen,
18
- * such as Sprite or MovieClip.
19
- *
20
- * @class
21
- * @memberOf next2d.display
22
- * @extends InteractiveObject
23
- */
24
- export class DisplayObjectContainer extends InteractiveObject {
25
- /**
26
- * @constructor
27
- * @public
28
- */
29
- constructor() {
30
- super();
31
- /**
32
- * @type {array}
33
- * @default null
34
- * @private
35
- */
36
- this._$placeMap = null;
37
- /**
38
- * @type {array}
39
- * @default null
40
- * @private
41
- */
42
- this._$placeObjects = null;
43
- /**
44
- * @type {array}
45
- * @default null
46
- * @private
47
- */
48
- this._$controller = null;
49
- /**
50
- * @type {array}
51
- * @default null
52
- * @private
53
- */
54
- this._$dictionary = null;
55
- /**
56
- * @type {array}
57
- * @private
58
- */
59
- this._$children = $getArray();
60
- /**
61
- * @type {boolean}
62
- * @default true
63
- * @private
64
- */
65
- this._$needsChildren = true;
66
- /**
67
- * @type {boolean}
68
- * @default true
69
- * @private
70
- */
71
- this._$mouseChildren = true;
72
- /**
73
- * @type {boolean}
74
- * @default true
75
- * @private
76
- */
77
- this._$wait = true;
78
- /**
79
- * @type {Map}
80
- * @private
81
- */
82
- this._$names = $getMap();
83
- return new Proxy(this, {
84
- "get": (object, name) => {
85
- if (object._$names.size && object._$names.has(name)) {
86
- return object._$names.get(name);
87
- }
88
- // @ts-ignore
89
- return object[name];
90
- }
91
- });
92
- }
93
- /**
94
- * @description オブジェクトの子がマウスまたはユーザー入力デバイスに対応しているかどうかを判断します。
95
- * Determine if the object's children are compatible with mouse or user input devices.
96
- *
97
- * @member {boolean}
98
- * @public
99
- */
100
- get mouseChildren() {
101
- return this._$mouseChildren;
102
- }
103
- set mouseChildren(mouse_children) {
104
- this._$mouseChildren = !!mouse_children;
105
- }
106
- /**
107
- * @description このオブジェクトの子の数を返します。
108
- * Returns the number of children of this object.
109
- *
110
- * @member {number}
111
- * @readonly
112
- * @public
113
- */
114
- get numChildren() {
115
- return this._$needsChildren
116
- ? this._$getChildren().length
117
- : this._$children.length;
118
- }
119
- /**
120
- * @description この DisplayObjectContainer インスタンスに子 DisplayObject インスタンスを追加します。
121
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance.
122
- *
123
- * @param {DisplayObject} child
124
- * @return {DisplayObject}
125
- * @method
126
- * @public
127
- */
128
- addChild(child) {
129
- if (child._$parent) {
130
- child._$parent._$remove(child, !(child._$parent._$instanceId === this._$instanceId));
131
- }
132
- this._$getChildren().push(child);
133
- if (child._$name) {
134
- this._$names.set(child._$name, child);
135
- }
136
- return this._$addChild(child);
137
- }
138
- /**
139
- * @description この DisplayObjectContainer インスタンスに子 DisplayObject インスタンスを追加します。
140
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance.
141
- *
142
- * @param {DisplayObject} child
143
- * @param {number} index
144
- * @return {DisplayObject}
145
- * @method
146
- * @public
147
- */
148
- addChildAt(child, index) {
149
- if (child._$parent) {
150
- child._$parent._$remove(child, !(child._$parent._$instanceId === this._$instanceId));
151
- }
152
- const children = this._$getChildren();
153
- const length = children.length;
154
- if (0 > index || index > length) {
155
- throw new RangeError(`RangeError: addChildAt: index error: ${index}`);
156
- }
157
- if (length && length > index) {
158
- children.splice(index, 0, child);
159
- for (let idx = 0; idx < index; ++idx) {
160
- const instance = children[idx];
161
- if (instance._$name) {
162
- this._$names.set(instance._$name, instance);
163
- }
164
- }
165
- }
166
- else {
167
- children.push(child);
168
- if (child._$name) {
169
- this._$names.set(child._$name, child);
170
- }
171
- }
172
- return this._$addChild(child);
173
- }
174
- /**
175
- * @description 指定された表示オブジェクトが、DisplayObjectContainer インスタンスの子であるか
176
- * インスタンス自体であるかを指定します。
177
- * Determines whether the specified display object is a child
178
- * of the DisplayObjectContainer instance or the instance itself.
179
- *
180
- * @param {DisplayObject} child
181
- * @return {boolean}
182
- * @method
183
- * @public
184
- */
185
- contains(child) {
186
- if (this._$instanceId === child._$instanceId) {
187
- return true;
188
- }
189
- const children = this._$getChildren();
190
- for (let idx = 0; idx < children.length; ++idx) {
191
- const instance = children[idx];
192
- if (instance._$instanceId === child._$instanceId) {
193
- return true;
194
- }
195
- if (instance instanceof DisplayObjectContainer) {
196
- if (instance.contains(child)) {
197
- return true;
198
- }
199
- }
200
- }
201
- return false;
202
- }
203
- /**
204
- * @description 指定のインデックス位置にある子表示オブジェクトインスタンスを返します。
205
- * Returns the child display object instance that exists at the specified index.
206
- *
207
- * @param {number} index
208
- * @return {DisplayObject}
209
- * @method
210
- * @public
211
- */
212
- getChildAt(index) {
213
- const children = this._$getChildren();
214
- if (0 > index || index > children.length) {
215
- throw new RangeError(`RangeError: getChildAt: index error: ${index}`);
216
- }
217
- return index in children ? children[index] : null;
218
- }
219
- /**
220
- * @description 指定された名前に一致する子表示オブジェクトを返します。
221
- * Returns the child display object that exists with the specified name.
222
- *
223
- * @param {string} name
224
- * @return {{DisplayObject}|null}
225
- * @method
226
- * @public
227
- */
228
- getChildByName(name) {
229
- if (!name) {
230
- return null;
231
- }
232
- // fixed logic
233
- const children = this._$getChildren();
234
- for (let idx = 0; idx < children.length; ++idx) {
235
- const child = children[idx];
236
- if (child.name !== name) {
237
- continue;
238
- }
239
- return child;
240
- }
241
- return null;
242
- }
243
- /**
244
- * @description 子 DisplayObject インスタンスのインデックス位置を返します。
245
- * Returns the index position of a child DisplayObject instance.
246
- *
247
- * @param {DisplayObject} child
248
- * @return {number}
249
- * @method
250
- * @public
251
- */
252
- getChildIndex(child) {
253
- if (child._$parent !== this) {
254
- throw new Error("ArgumentError: getChildIndex: not child");
255
- }
256
- const index = this._$getChildren().indexOf(child);
257
- if (index === -1) {
258
- throw new Error("ArgumentError: getChildIndex: not found.");
259
- }
260
- return index;
261
- }
262
- /**
263
- * @description DisplayObjectContainer インスタンスの子リストから指定の
264
- * child DisplayObject インスタンスを削除します。
265
- * Removes the specified child DisplayObject instance from the
266
- * child list of the DisplayObjectContainer instance.
267
- *
268
- * @param {DisplayObject} child
269
- * @return {DisplayObject}
270
- * @method
271
- * @public
272
- */
273
- removeChild(child) {
274
- if (child._$parent !== this) {
275
- throw new Error("ArgumentError: removeChild: not child");
276
- }
277
- return this._$remove(child);
278
- }
279
- /**
280
- * @description DisplayObjectContainer の子リストの指定された index 位置から子 DisplayObject を削除します。
281
- * Removes a child DisplayObject from the specified index position
282
- * in the child list of the DisplayObjectContainer.
283
- *
284
- * @param {number} index
285
- * @return {DisplayObject}
286
- * @method
287
- * @public
288
- */
289
- removeChildAt(index) {
290
- return this._$remove(this.getChildAt(index));
291
- }
292
- /**
293
- * @description DisplayObjectContainer インスタンスの子リストから
294
- * すべての child DisplayObject インスタンスを削除します。
295
- * Removes all child DisplayObject instances from
296
- * the child list of the DisplayObjectContainer instance.
297
- *
298
- * @param {number} [begin_index=0]
299
- * @param {number} [end_index=0x7fffffff]
300
- * @return {void}
301
- * @method
302
- * @public
303
- */
304
- removeChildren(begin_index = 0, end_index = 0x7fffffff) {
305
- const children = this._$getChildren();
306
- if (!children.length) {
307
- return;
308
- }
309
- begin_index = $clamp(begin_index, 0, 0x7ffffffe, 0) - 1;
310
- end_index = $clamp(end_index, 1, 0x7ffffff, 0x7ffffff);
311
- for (let idx = $Math.min(end_index, children.length - 1); idx > begin_index; --idx) {
312
- this._$remove(children[idx]);
313
- }
314
- }
315
- /**
316
- * @description 表示オブジェクトコンテナの既存の子の位置を変更します。
317
- * Changes the position of an existing child in the display object container.
318
- *
319
- * @param {DisplayObject} child
320
- * @param {number} index
321
- * @return {void}
322
- * @method
323
- * @public
324
- */
325
- setChildIndex(child, index) {
326
- const currentIndex = this.getChildIndex(child);
327
- if (currentIndex === index) {
328
- return;
329
- }
330
- const children = this._$getChildren();
331
- children.splice(currentIndex, 1);
332
- children.splice(index, 0, child);
333
- if ($rendererWorker) {
334
- this._$postChildrenIds();
335
- }
336
- this._$doChanged();
337
- }
338
- /**
339
- * @description 指定された 2 つの子オブジェクトの z 順序(重ね順)を入れ替えます。
340
- * Swaps the z-order (front-to-back order) of the two specified child objects.
341
- *
342
- * @param {DisplayObject} child1
343
- * @param {DisplayObject} child2
344
- * @return {void}
345
- * @method
346
- * @public
347
- */
348
- swapChildren(child1, child2) {
349
- const children = this._$getChildren();
350
- const index1 = this.getChildIndex(child1);
351
- const index2 = this.getChildIndex(child2);
352
- children[index1] = child2;
353
- children[index2] = child1;
354
- if ($rendererWorker) {
355
- this._$postChildrenIds();
356
- }
357
- this._$doChanged();
358
- }
359
- /**
360
- * @description 子リスト内の指定されたインデックス位置に該当する 2 つの子オブジェクトの z 順序(重ね順)を入れ替えます。
361
- * Swaps the z-order (front-to-back order) of the child objects at
362
- * the two specified index positions in the child list.
363
- *
364
- * @param {number} index1
365
- * @param {number} index2
366
- * @return {void}
367
- * @method
368
- * @public
369
- */
370
- swapChildrenAt(index1, index2) {
371
- this.swapChildren(this.getChildAt(index1), this.getChildAt(index2));
372
- }
373
- /**
374
- * @param {array} [matrix=null]
375
- * @return {object}
376
- * @private
377
- */
378
- _$getBounds(matrix = null) {
379
- let multiMatrix = $MATRIX_ARRAY_IDENTITY;
380
- if (matrix) {
381
- multiMatrix = matrix;
382
- const rawMatrix = this._$transform._$rawMatrix();
383
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
384
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
385
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
386
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
387
- }
388
- }
389
- const graphics = "_$graphics" in this
390
- ? this._$graphics
391
- : null;
392
- const children = this._$needsChildren
393
- ? this._$getChildren()
394
- : this._$children;
395
- // size zero
396
- if (!children.length && !graphics) {
397
- const bounds = $getBoundsObject(multiMatrix[4], -multiMatrix[4], multiMatrix[5], -multiMatrix[5]);
398
- if (matrix && multiMatrix !== matrix) {
399
- $poolFloat32Array6(multiMatrix);
400
- }
401
- return bounds;
402
- }
403
- // data init
404
- const no = $Number.MAX_VALUE;
405
- let xMin = no;
406
- let xMax = -no;
407
- let yMin = no;
408
- let yMax = -no;
409
- if (graphics) {
410
- const baseBounds = graphics._$getBounds();
411
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
412
- $poolBoundsObject(baseBounds);
413
- xMin = bounds.xMin;
414
- xMax = bounds.xMax;
415
- yMin = bounds.yMin;
416
- yMax = bounds.yMax;
417
- $poolBoundsObject(bounds);
418
- }
419
- for (let idx = 0; idx < children.length; ++idx) {
420
- const bounds = children[idx]._$getBounds(multiMatrix);
421
- xMin = $Math.min(xMin, bounds.xMin);
422
- xMax = $Math.max(xMax, bounds.xMax);
423
- yMin = $Math.min(yMin, bounds.yMin);
424
- yMax = $Math.max(yMax, bounds.yMax);
425
- $poolBoundsObject(bounds);
426
- }
427
- if (matrix && multiMatrix !== matrix) {
428
- $poolFloat32Array6(multiMatrix);
429
- }
430
- // end
431
- return $getBoundsObject(xMin, xMax, yMin, yMax);
432
- }
433
- /**
434
- * @param {array} [matrix=null]
435
- * @return {object}
436
- * @private
437
- */
438
- _$getLayerBounds(matrix = null) {
439
- let multiMatrix = $MATRIX_ARRAY_IDENTITY;
440
- if (matrix) {
441
- multiMatrix = matrix;
442
- const rawMatrix = this._$transform._$rawMatrix();
443
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
444
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
445
- }
446
- }
447
- const graphics = "_$graphics" in this
448
- ? this._$graphics
449
- : null;
450
- const children = this._$needsChildren
451
- ? this._$getChildren()
452
- : this._$children;
453
- // size zero
454
- if (!children.length && !graphics) {
455
- const bounds = $getBoundsObject(multiMatrix[4], -multiMatrix[4], multiMatrix[5], -multiMatrix[5]);
456
- if (matrix && multiMatrix !== matrix) {
457
- $poolFloat32Array6(multiMatrix);
458
- }
459
- return bounds;
460
- }
461
- // data init
462
- const no = $Number.MAX_VALUE;
463
- let xMin = no;
464
- let xMax = -no;
465
- let yMin = no;
466
- let yMax = -no;
467
- if (graphics) {
468
- const baseBounds = graphics._$getBounds();
469
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
470
- $poolBoundsObject(baseBounds);
471
- xMin = +bounds.xMin;
472
- xMax = +bounds.xMax;
473
- yMin = +bounds.yMin;
474
- yMax = +bounds.yMax;
475
- $poolBoundsObject(bounds);
476
- }
477
- for (let idx = 0; idx < children.length; ++idx) {
478
- const bounds = children[idx]
479
- ._$getLayerBounds(multiMatrix);
480
- xMin = $Math.min(xMin, bounds.xMin);
481
- xMax = $Math.max(xMax, bounds.xMax);
482
- yMin = $Math.min(yMin, bounds.yMin);
483
- yMax = $Math.max(yMax, bounds.yMax);
484
- $poolBoundsObject(bounds);
485
- }
486
- if (matrix && multiMatrix !== matrix) {
487
- $poolFloat32Array6(multiMatrix);
488
- }
489
- // end
490
- if (!matrix) {
491
- return $getBoundsObject(xMin, xMax, yMin, yMax);
492
- }
493
- const filters = this._$filters || this.filters;
494
- if (!filters.length) {
495
- return $getBoundsObject(xMin, xMax, yMin, yMax);
496
- }
497
- let rect = new Rectangle(xMin, yMin, xMax - xMin, yMax - yMin);
498
- for (let idx = 0; idx < filters.length; ++idx) {
499
- rect = filters[idx]
500
- ._$generateFilterRect(rect, 0, 0);
501
- }
502
- xMin = rect.x;
503
- xMax = rect.x + rect.width;
504
- yMin = rect.y;
505
- yMax = rect.y + rect.height;
506
- return $getBoundsObject(xMin, xMax, yMin, yMax);
507
- }
508
- /**
509
- * @return {array}
510
- * @private
511
- */
512
- _$getChildren() {
513
- if (this._$needsChildren) {
514
- // set flag
515
- this._$needsChildren = false;
516
- const currentChildren = this._$children;
517
- if (!this._$controller) {
518
- return currentChildren;
519
- }
520
- const frame = "_$currentFrame" in this ? this._$currentFrame : 1;
521
- const controller = this._$controller[frame];
522
- // first build
523
- if (!currentChildren.length) {
524
- if (controller) {
525
- for (let idx = 0; idx < controller.length; ++idx) {
526
- const instance = this._$createInstance(controller[idx]);
527
- instance._$placeId = idx;
528
- const loopConfig = instance.loopConfig;
529
- if (loopConfig) {
530
- instance._$currentFrame = instance
531
- ._$getLoopFrame(loopConfig);
532
- }
533
- currentChildren.push(instance);
534
- if (instance._$name) {
535
- this._$names.set(instance._$name, instance);
536
- }
537
- }
538
- }
539
- return currentChildren;
540
- }
541
- const player = $currentPlayer();
542
- const cacheStore = player.cacheStore;
543
- const useWorker = !!$rendererWorker && !!this._$stage;
544
- const skipIds = $getMap();
545
- const poolInstances = $getMap();
546
- let depth = 0;
547
- const children = $getArray();
548
- for (let idx = 0; idx < currentChildren.length; ++idx) {
549
- const instance = currentChildren[idx];
550
- const parent = instance._$parent;
551
- if (!parent || parent._$instanceId !== this._$instanceId) {
552
- continue;
553
- }
554
- const instanceId = instance._$instanceId;
555
- const startFrame = instance._$startFrame;
556
- const endFrame = instance._$endFrame;
557
- if (startFrame === 1 && endFrame === 0
558
- || startFrame <= frame && endFrame > frame) {
559
- // reset
560
- instance._$isNext = true;
561
- instance._$placeObject = null;
562
- instance._$filters = null;
563
- instance._$blendMode = null;
564
- if (instance._$id === -1) {
565
- children.push(instance);
566
- if (instance._$name) {
567
- this._$names.set(instance._$name, instance);
568
- }
569
- continue;
570
- }
571
- const id = controller[depth];
572
- if (instance._$id === id) {
573
- instance._$placeId = depth;
574
- children.push(instance);
575
- if (instance._$name) {
576
- this._$names.set(instance._$name, instance);
577
- }
578
- if (poolInstances.has(id)) {
579
- poolInstances.delete(id);
580
- }
581
- skipIds.set(id, true);
582
- depth++;
583
- if (useWorker) {
584
- instance._$postProperty();
585
- }
586
- continue;
587
- }
588
- poolInstances.set(instance._$id, instance);
589
- continue;
590
- }
591
- if (useWorker) {
592
- instance._$removeWorkerInstance();
593
- }
594
- cacheStore.setRemoveTimer(instanceId);
595
- if (instance._$loaderInfo && instance._$characterId) {
596
- cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
597
- }
598
- // remove event
599
- if (instance.willTrigger(Next2DEvent.REMOVED)) {
600
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
601
- }
602
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
603
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE, true));
604
- }
605
- // reset
606
- instance._$added = false;
607
- instance._$addedStage = false;
608
- instance._$active = false;
609
- instance._$updated = true;
610
- instance._$filters = null;
611
- instance._$blendMode = null;
612
- instance._$isNext = true;
613
- instance._$placeObject = null;
614
- instance._$created = false;
615
- instance._$posted = false;
616
- if (instance instanceof DisplayObjectContainer) {
617
- instance._$executeRemovedFromStage();
618
- instance._$removeParentAndStage();
619
- }
620
- }
621
- if (controller) {
622
- for (let idx = 0; idx < controller.length; ++idx) {
623
- const id = controller[idx];
624
- if (skipIds.has(id)) {
625
- continue;
626
- }
627
- const instance = poolInstances.has(id)
628
- ? poolInstances.get(id)
629
- : this._$createInstance(id);
630
- instance._$placeId = idx;
631
- const loopConfig = instance.loopConfig;
632
- if (loopConfig) {
633
- instance._$currentFrame = instance
634
- ._$getLoopFrame(loopConfig);
635
- }
636
- children.push(instance);
637
- if (instance._$name) {
638
- this._$names.set(instance._$name, instance);
639
- }
640
- }
641
- }
642
- // object pool
643
- $poolMap(skipIds);
644
- $poolMap(poolInstances);
645
- // update
646
- currentChildren.length = 0;
647
- currentChildren.push(...children);
648
- $poolArray(children);
649
- }
650
- return this._$children;
651
- }
652
- /**
653
- * @return void
654
- * @private
655
- */
656
- _$clearChildren() {
657
- this._$doChanged();
658
- $doUpdated();
659
- // reset
660
- this._$names.clear();
661
- // clear
662
- this._$needsChildren = true;
663
- }
664
- /**
665
- * @param {DisplayObject} child
666
- * @returns {DisplayObject}
667
- * @private
668
- */
669
- _$addChild(child) {
670
- // init
671
- child._$parent = this;
672
- if (!child._$stage || !child._$root) {
673
- child._$stage = this._$stage;
674
- child._$root = this._$root;
675
- }
676
- // setup
677
- if (child instanceof DisplayObjectContainer) {
678
- child._$setParentAndStage();
679
- child._$wait = true;
680
- }
681
- // added event
682
- if (!child._$added) {
683
- if (child.willTrigger(Next2DEvent.ADDED)) {
684
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED, true));
685
- }
686
- child._$added = true;
687
- }
688
- if (this._$stage !== null && !child._$addedStage) {
689
- if (child.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
690
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
691
- }
692
- child._$addedStage = true;
693
- // set params
694
- if (child instanceof DisplayObjectContainer) {
695
- child._$executeAddedToStage();
696
- }
697
- if ($rendererWorker) {
698
- child._$createWorkerInstance();
699
- child._$postProperty();
700
- this._$postChildrenIds();
701
- }
702
- }
703
- this._$doChanged();
704
- child._$active = true;
705
- child._$updated = true;
706
- child._$isNext = true;
707
- return child;
708
- }
709
- /**
710
- * @return {void}
711
- * @method
712
- * @private
713
- */
714
- _$setParentAndStage() {
715
- const children = this._$needsChildren
716
- ? this._$getChildren()
717
- : this._$children;
718
- for (let idx = 0; idx < children.length; ++idx) {
719
- const instance = children[idx];
720
- instance._$root = this._$root;
721
- instance._$stage = this._$stage;
722
- if (instance instanceof DisplayObjectContainer) {
723
- instance._$setParentAndStage();
724
- instance._$wait = true;
725
- }
726
- }
727
- }
728
- /**
729
- * @return {void}
730
- * @method
731
- * @private
732
- */
733
- _$executeAddedToStage() {
734
- const children = this._$needsChildren
735
- ? this._$getChildren()
736
- : this._$children;
737
- const childrenIds = $getArray();
738
- for (let idx = 0; idx < children.length; ++idx) {
739
- const instance = children[idx];
740
- if (!instance) {
741
- continue;
742
- }
743
- childrenIds.push(instance._$instanceId);
744
- if (!instance._$addedStage) {
745
- if ($rendererWorker) {
746
- instance._$createWorkerInstance();
747
- instance._$postProperty();
748
- }
749
- if (instance.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
750
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
751
- }
752
- instance._$addedStage = true;
753
- }
754
- if (instance instanceof DisplayObjectContainer) {
755
- instance._$executeAddedToStage();
756
- }
757
- }
758
- if ($rendererWorker) {
759
- this._$postChildrenIds(childrenIds);
760
- }
761
- $poolArray(childrenIds);
762
- }
763
- /**
764
- * @param {DisplayObject} child
765
- * @param {boolean} do_event
766
- * @return {DisplayObject}
767
- * @private
768
- */
769
- _$remove(child, do_event = true) {
770
- child._$transform._$transform();
771
- // remove all broadcast events
772
- if (child.hasEventListener(Next2DEvent.ENTER_FRAME)) {
773
- child.removeAllEventListener(Next2DEvent.ENTER_FRAME);
774
- }
775
- if (child.hasEventListener(Next2DEvent.EXIT_FRAME)) {
776
- child.removeAllEventListener(Next2DEvent.EXIT_FRAME);
777
- }
778
- if (child.hasEventListener(Next2DEvent.FRAME_CONSTRUCTED)) {
779
- child.removeAllEventListener(Next2DEvent.FRAME_CONSTRUCTED);
780
- }
781
- if (child.hasEventListener(Next2DEvent.RENDER)) {
782
- child.removeAllEventListener(Next2DEvent.RENDER);
783
- }
784
- if (child.hasEventListener(Next2DEvent.ACTIVATE)) {
785
- child.removeAllEventListener(Next2DEvent.ACTIVATE);
786
- }
787
- if (child.hasEventListener(Next2DEvent.DEACTIVATE)) {
788
- child.removeAllEventListener(Next2DEvent.DEACTIVATE);
789
- }
790
- if (child.hasEventListener("keyDown")) {
791
- child.removeAllEventListener("keyDown");
792
- }
793
- if (child.hasEventListener("keyUp")) {
794
- child.removeAllEventListener("keyUp");
795
- }
796
- // remove
797
- const children = this._$needsChildren
798
- ? this._$getChildren()
799
- : this._$children;
800
- const depth = this.getChildIndex(child);
801
- children.splice(depth, 1);
802
- this._$names.delete(child.name);
803
- if (do_event) {
804
- // event
805
- if (child.willTrigger(Next2DEvent.REMOVED)) {
806
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
807
- }
808
- // remove stage event
809
- if (this._$stage !== null) {
810
- // worker側のDisplayObjectも削除
811
- if ($rendererWorker) {
812
- child._$removeWorkerInstance();
813
- this._$postChildrenIds();
814
- }
815
- if (child.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
816
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
817
- }
818
- if (child instanceof DisplayObjectContainer) {
819
- child._$executeRemovedFromStage();
820
- }
821
- }
822
- const player = $currentPlayer();
823
- const cacheStore = player.cacheStore;
824
- cacheStore.setRemoveTimer(child._$instanceId);
825
- if (child._$loaderInfo && child._$characterId) {
826
- cacheStore.setRemoveTimer(`${child._$loaderInfo._$id}@${child._$characterId}`);
827
- }
828
- // reset params
829
- if (child instanceof DisplayObjectContainer) {
830
- child._$removeParentAndStage();
831
- }
832
- // reset
833
- child._$stage = null;
834
- child._$parent = null;
835
- child._$root = null;
836
- child._$active = false;
837
- child._$wait = true;
838
- child._$updated = true;
839
- child._$added = false;
840
- child._$addedStage = false;
841
- child._$created = false;
842
- child._$posted = false;
843
- this._$doChanged();
844
- }
845
- return child;
846
- }
847
- /**
848
- * @return {void}
849
- * @method
850
- * @private
851
- */
852
- _$executeRemovedFromStage() {
853
- const children = this._$getChildren().slice(0);
854
- for (let idx = 0; idx < children.length; ++idx) {
855
- const instance = children[idx];
856
- if (!instance) {
857
- continue;
858
- }
859
- if (instance._$addedStage) {
860
- // workerのDisplayObjectを削除
861
- if ($rendererWorker) {
862
- instance._$removeWorkerInstance();
863
- }
864
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
865
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
866
- }
867
- instance._$created = false;
868
- instance._$posted = false;
869
- instance._$addedStage = false;
870
- }
871
- if (instance instanceof DisplayObjectContainer) {
872
- instance._$executeRemovedFromStage();
873
- }
874
- }
875
- }
876
- /**
877
- * @return {void}
878
- * @method
879
- * @private
880
- */
881
- _$removeParentAndStage() {
882
- const children = this._$needsChildren
883
- ? this._$getChildren()
884
- : this._$children;
885
- const player = $currentPlayer();
886
- const cacheStore = player.cacheStore;
887
- for (let idx = 0; idx < children.length; ++idx) {
888
- const instance = children[idx];
889
- cacheStore.setRemoveTimer(instance._$instanceId);
890
- if (instance._$loaderInfo && instance._$characterId) {
891
- cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
892
- }
893
- if (instance instanceof DisplayObjectContainer) {
894
- instance._$removeParentAndStage();
895
- }
896
- instance._$stage = null;
897
- instance._$root = null;
898
- instance._$addedStage = false;
899
- }
900
- if ("_$sounds" in this) {
901
- const soundsMap = this._$sounds;
902
- if (soundsMap.size) {
903
- for (const sounds of soundsMap.values()) {
904
- for (let idx = 0; idx < sounds.length; ++idx) {
905
- const sound = sounds[idx];
906
- sound.stop();
907
- }
908
- }
909
- }
910
- }
911
- this._$needsChildren = true;
912
- }
913
- /**
914
- * @return {void}
915
- * @method
916
- * @private
917
- */
918
- _$prepareActions() {
919
- const children = this._$needsChildren
920
- ? this._$getChildren()
921
- : this._$children;
922
- for (let idx = children.length - 1; idx > -1; --idx) {
923
- children[idx]._$prepareActions();
924
- }
925
- // added event
926
- this._$executeAddedEvent();
927
- }
928
- /**
929
- * @return {boolean}
930
- * @method
931
- * @private
932
- */
933
- _$nextFrame() {
934
- let isNext = false;
935
- const children = this._$getChildren();
936
- for (let idx = children.length - 1; idx > -1; --idx) {
937
- const child = children[idx];
938
- if (!child._$isNext) {
939
- continue;
940
- }
941
- if (isNext) {
942
- child._$nextFrame();
943
- }
944
- else {
945
- isNext = child._$nextFrame();
946
- }
947
- }
948
- // added event
949
- this._$executeAddedEvent();
950
- this._$isNext = isNext;
951
- if (!this._$posted && $rendererWorker) {
952
- this._$postProperty();
953
- }
954
- return this._$isNext;
955
- }
956
- /**
957
- * @param {CanvasToWebGLContext} context
958
- * @param {Float32Array} matrix
959
- * @return {void}
960
- * @method
961
- * @private
962
- */
963
- _$clip(context, matrix) {
964
- let multiMatrix = matrix;
965
- const rawMatrix = this._$transform._$rawMatrix();
966
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
967
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
968
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
969
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
970
- }
971
- const graphics = "_$graphics" in this
972
- ? this._$graphics
973
- : null;
974
- if (graphics && graphics._$canDraw) {
975
- graphics._$clip(context, multiMatrix);
976
- }
977
- const children = this._$getChildren();
978
- for (let idx = 0; idx < children.length; ++idx) {
979
- const instance = children[idx];
980
- // mask instance
981
- if (instance._$isMask) {
982
- continue;
983
- }
984
- instance._$clip(context, multiMatrix);
985
- instance._$updated = false;
986
- }
987
- if (multiMatrix !== matrix) {
988
- $poolFloat32Array6(multiMatrix);
989
- }
990
- }
991
- /**
992
- * @param {CanvasToWebGLContext} context
993
- * @param {Float32Array} matrix
994
- * @return {object}
995
- * @private
996
- */
997
- _$preDraw(context, matrix) {
998
- let multiMatrix = matrix;
999
- const rawMatrix = this._$transform._$rawMatrix();
1000
- if (rawMatrix !== $MATRIX_HIT_ARRAY_IDENTITY
1001
- && rawMatrix[0] !== 1 || rawMatrix[1] !== 0
1002
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
1003
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
1004
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1005
- }
1006
- // size zero
1007
- if (!multiMatrix[0] && !multiMatrix[1]
1008
- || !multiMatrix[2] && !multiMatrix[3]) {
1009
- return null;
1010
- }
1011
- // return object
1012
- const object = $getPreObject();
1013
- // setup
1014
- object.matrix = multiMatrix;
1015
- // check
1016
- const filters = this._$filters || this.filters;
1017
- const blendMode = this._$blendMode || this.blendMode;
1018
- if (filters.length > 0 || blendMode !== "normal") {
1019
- // check size
1020
- const baseBounds = this._$getBounds(null);
1021
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
1022
- $poolBoundsObject(baseBounds);
1023
- const xMax = +bounds.xMax;
1024
- const xMin = +bounds.xMin;
1025
- const yMax = +bounds.yMax;
1026
- const yMin = +bounds.yMin;
1027
- $poolBoundsObject(bounds);
1028
- const width = $Math.abs(xMax - xMin);
1029
- const height = $Math.abs(yMax - yMin);
1030
- if (0 >= width || 0 >= height) {
1031
- $poolPreObject(object);
1032
- return null;
1033
- }
1034
- if (0 > xMin + width || 0 > yMin + height) {
1035
- $poolPreObject(object);
1036
- return null;
1037
- }
1038
- const currentAttachment = context
1039
- .frameBuffer
1040
- .currentAttachment;
1041
- if (!currentAttachment
1042
- || !currentAttachment.texture
1043
- || xMin > currentAttachment.width
1044
- || yMin > currentAttachment.height) {
1045
- $poolPreObject(object);
1046
- return null;
1047
- }
1048
- // set origin position
1049
- object.basePosition.x = rawMatrix[4];
1050
- object.basePosition.y = rawMatrix[5];
1051
- // check after size
1052
- const baseLayerBounds = this._$getLayerBounds(null);
1053
- const layerBounds = $boundsMatrix(baseLayerBounds, multiMatrix);
1054
- // filter size
1055
- let layerWidth = $Math.abs(layerBounds.xMax - layerBounds.xMin);
1056
- let layerHeight = $Math.abs(layerBounds.yMax - layerBounds.yMin);
1057
- $poolBoundsObject(layerBounds);
1058
- // move size
1059
- let tx = multiMatrix[4] - $Math.floor(xMin);
1060
- let ty = multiMatrix[5] - $Math.floor(yMin);
1061
- let dx = $Math.floor(xMin);
1062
- let dy = $Math.floor(yMin);
1063
- let originX = xMin;
1064
- let originY = yMin;
1065
- if (layerWidth !== width || layerHeight !== height) {
1066
- const layerMatrix = $getFloat32Array6(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], 0, 0);
1067
- const moveBounds = $boundsMatrix(baseLayerBounds, layerMatrix);
1068
- // pool
1069
- $poolFloat32Array6(layerMatrix);
1070
- tx += -$Math.floor(moveBounds.xMin) - tx;
1071
- ty += -$Math.floor(moveBounds.yMin) - ty;
1072
- dx -= -$Math.floor(moveBounds.xMin) - (multiMatrix[4] - dx);
1073
- dy -= -$Math.floor(moveBounds.yMin) - (multiMatrix[5] - dy);
1074
- originX -= -moveBounds.xMin - (multiMatrix[4] - originX);
1075
- originY -= -moveBounds.yMin - (multiMatrix[5] - originY);
1076
- $poolBoundsObject(moveBounds);
1077
- }
1078
- $poolBoundsObject(baseLayerBounds);
1079
- // set position
1080
- object.position.dx = dx > 0 ? dx : 0;
1081
- object.position.dy = dy > 0 ? dy : 0;
1082
- // resize
1083
- if (layerWidth + originX > currentAttachment.texture.width) {
1084
- layerWidth -= layerWidth - currentAttachment.texture.width + originX;
1085
- }
1086
- if (layerHeight + originY > currentAttachment.texture.height) {
1087
- layerHeight -= layerHeight - currentAttachment.texture.height + originY;
1088
- }
1089
- if (0 > dx) {
1090
- tx += dx;
1091
- layerWidth += originX;
1092
- }
1093
- if (0 > dy) {
1094
- ty += dy;
1095
- layerHeight += originY;
1096
- }
1097
- if (0 >= layerWidth || 0 >= layerHeight // size (-)
1098
- || !layerWidth || !layerHeight // NaN or Infinity
1099
- ) {
1100
- $poolPreObject(object);
1101
- return null;
1102
- }
1103
- // start layer
1104
- context._$startLayer($getBoundsObject(originX, 0, originY, 0));
1105
- // check cache
1106
- object.canApply = this._$canApply(filters);
1107
- const updated = this._$isFilterUpdated(layerWidth, layerHeight, multiMatrix, filters, object.canApply, object.basePosition.x, object.basePosition.y);
1108
- // current mask cache
1109
- context._$saveCurrentMask();
1110
- if (updated) {
1111
- context._$saveAttachment($Math.ceil(layerWidth), $Math.ceil(layerHeight), false);
1112
- }
1113
- // setup
1114
- object.isFilter = true;
1115
- object.isUpdated = updated;
1116
- object.color = $getFloat32Array8();
1117
- object.baseMatrix = multiMatrix;
1118
- object.filters = filters;
1119
- object.blendMode = blendMode;
1120
- object.layerWidth = layerWidth;
1121
- object.layerHeight = layerHeight;
1122
- object.matrix = $getFloat32Array6(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], tx, ty);
1123
- }
1124
- return object;
1125
- }
1126
- /**
1127
- * @param {CanvasToWebGLContext} context
1128
- * @param {Float32Array} matrix
1129
- * @param {Float32Array} color_transform
1130
- * @param {object} object
1131
- * @return {void}
1132
- * @method
1133
- * @private
1134
- */
1135
- _$postDraw(context, matrix, color_transform, object) {
1136
- // cache
1137
- const cacheKeys = $getArray(this._$instanceId, "f");
1138
- const player = $currentPlayer();
1139
- const cacheStore = player.cacheStore;
1140
- const manager = context.frameBuffer;
1141
- // cache or new texture
1142
- let texture = null;
1143
- if (object.isUpdated) {
1144
- texture = manager
1145
- .getTextureFromCurrentAttachment();
1146
- const cacheTexture = cacheStore.get(cacheKeys);
1147
- if (cacheTexture) {
1148
- cacheStore.set(cacheKeys, null);
1149
- manager.releaseTexture(cacheTexture);
1150
- }
1151
- }
1152
- else {
1153
- texture = cacheStore.get(cacheKeys);
1154
- if (!texture) {
1155
- throw new Error("the texture is null.");
1156
- }
1157
- }
1158
- // blend only
1159
- if (!object.canApply) {
1160
- texture._$offsetX = 0;
1161
- texture._$offsetY = 0;
1162
- }
1163
- // set cache offset
1164
- let offsetX = texture._$offsetX;
1165
- let offsetY = texture._$offsetY;
1166
- // execute filter
1167
- if (object.isUpdated && object.canApply) {
1168
- // cache clear
1169
- const cache = cacheStore.get(cacheKeys);
1170
- if (cache) {
1171
- // reset cache params
1172
- cacheStore.set(cacheKeys, null);
1173
- cache.layerWidth = 0;
1174
- cache.layerHeight = 0;
1175
- cache._$offsetX = 0;
1176
- cache._$offsetY = 0;
1177
- cache.matrix = null;
1178
- cache.colorTransform = null;
1179
- manager.releaseTexture(cache);
1180
- }
1181
- // apply filter
1182
- const filters = object.filters;
1183
- if (filters && filters.length) {
1184
- // init
1185
- context._$offsetX = 0;
1186
- context._$offsetY = 0;
1187
- for (let idx = 0; idx < filters.length; ++idx) {
1188
- texture = filters[idx]
1189
- ._$applyFilter(context, matrix);
1190
- }
1191
- offsetX = context._$offsetX;
1192
- offsetY = context._$offsetY;
1193
- // reset
1194
- context._$offsetX = 0;
1195
- context._$offsetY = 0;
1196
- // set offset
1197
- texture._$offsetX = offsetX;
1198
- texture._$offsetY = offsetY;
1199
- }
1200
- }
1201
- // update cache params
1202
- if (object.isUpdated) {
1203
- texture.filterState = object.canApply;
1204
- // cache texture
1205
- const matrix = object.baseMatrix;
1206
- if (matrix) {
1207
- texture.matrix = `${matrix[0]}_${matrix[1]}_${matrix[2]}_${matrix[3]}`;
1208
- }
1209
- texture.layerWidth = object.layerWidth;
1210
- texture.layerHeight = object.layerHeight;
1211
- }
1212
- // cache texture
1213
- cacheStore.set(cacheKeys, texture);
1214
- $poolArray(cacheKeys);
1215
- // set current buffer
1216
- if (object.isUpdated) {
1217
- context._$restoreAttachment();
1218
- }
1219
- // set
1220
- context.reset();
1221
- context.globalAlpha = $clamp(color_transform[3] + color_transform[7] / 255, 0, 1);
1222
- context.globalCompositeOperation = object.blendMode;
1223
- context.setTransform(1, 0, 0, 1, 0, 0);
1224
- context.drawImage(texture, -offsetX + object.position.dx, -offsetY + object.position.dy, texture.width, texture.height, color_transform);
1225
- // end blend
1226
- context._$endLayer();
1227
- // reset
1228
- context._$restoreCurrentMask();
1229
- // object pool
1230
- if (object.baseMatrix !== matrix) {
1231
- $poolFloat32Array6(object.baseMatrix);
1232
- }
1233
- $poolFloat32Array6(object.matrix);
1234
- $poolPreObject(object);
1235
- }
1236
- /**
1237
- * @param {CanvasToWebGLContext} context
1238
- * @param {Float32Array} matrix
1239
- * @param {Float32Array} color_transform
1240
- * @return {void}
1241
- * @method
1242
- * @private
1243
- */
1244
- _$draw(context, matrix, color_transform) {
1245
- // not draw
1246
- if (!this._$visible) {
1247
- return;
1248
- }
1249
- const transform = this._$transform;
1250
- let multiColor = color_transform;
1251
- const rawColor = transform._$rawColorTransform();
1252
- if (rawColor !== $COLOR_ARRAY_IDENTITY
1253
- && rawColor[0] !== 1 || rawColor[1] !== 1
1254
- || rawColor[2] !== 1 || rawColor[3] !== 1
1255
- || rawColor[4] !== 0 || rawColor[5] !== 0
1256
- || rawColor[6] !== 0 || rawColor[7] !== 0) {
1257
- multiColor = $multiplicationColor(color_transform, rawColor);
1258
- }
1259
- // not draw
1260
- const alpha = $clamp(multiColor[3] + multiColor[7] / 255, 0, 1, 0);
1261
- if (!alpha) {
1262
- return;
1263
- }
1264
- // not draw
1265
- const children = this._$getChildren();
1266
- const length = children.length;
1267
- const graphics = "_$graphics" in this
1268
- ? this._$graphics
1269
- : null;
1270
- if (!length && (!graphics || !graphics._$canDraw)) {
1271
- return;
1272
- }
1273
- // pre data
1274
- const preObject = this._$preDraw(context, matrix);
1275
- if (!preObject) {
1276
- return;
1277
- }
1278
- // use cache
1279
- if (preObject.isFilter && !preObject.isUpdated) {
1280
- this._$postDraw(context, matrix, multiColor, preObject);
1281
- return;
1282
- }
1283
- let preMatrix = preObject.matrix;
1284
- const preColorTransform = preObject.isFilter && preObject.color
1285
- ? preObject.color
1286
- : multiColor;
1287
- // if graphics draw
1288
- if (graphics && graphics._$canDraw) {
1289
- graphics._$draw(context, preMatrix, preColorTransform);
1290
- }
1291
- // init clip params
1292
- let shouldClip = true;
1293
- let clipDepth = 0;
1294
- const clipMatrix = $getArray();
1295
- const instanceMatrix = $getArray();
1296
- const clipStack = $getArray();
1297
- const shouldClips = $getArray();
1298
- const player = $currentPlayer();
1299
- // draw children
1300
- const isLayer = context.isLayer;
1301
- const isUpdate = this._$isUpdated();
1302
- for (let idx = 0; idx < length; ++idx) {
1303
- const instance = children[idx];
1304
- if (isUpdate) {
1305
- instance._$placeObject = null;
1306
- }
1307
- // mask instance
1308
- if (instance._$isMask) {
1309
- continue;
1310
- }
1311
- // not layer mode
1312
- const blendMode = instance._$blendMode || instance.blendMode;
1313
- if ((blendMode === "alpha" || blendMode === "erase")
1314
- && !isLayer) {
1315
- continue;
1316
- }
1317
- // mask end
1318
- if (clipDepth
1319
- && (instance._$placeId > clipDepth || instance._$clipDepth > 0)) {
1320
- context.restore();
1321
- if (shouldClip) {
1322
- context._$leaveClip();
1323
- if (clipMatrix.length) {
1324
- const matrix = clipMatrix.pop();
1325
- if (matrix) {
1326
- $poolFloat32Array6(preMatrix);
1327
- preMatrix = matrix;
1328
- }
1329
- }
1330
- }
1331
- // clear
1332
- clipDepth = clipStack.length ? clipStack.pop() || 0 : 0;
1333
- shouldClip = !!shouldClips.pop();
1334
- }
1335
- // mask size 0
1336
- if (!shouldClip) {
1337
- continue;
1338
- }
1339
- // mask start
1340
- if (instance._$clipDepth > 0) {
1341
- context.save();
1342
- if (clipDepth) {
1343
- clipStack.push(clipDepth);
1344
- }
1345
- shouldClips.push(shouldClip);
1346
- clipDepth = instance._$clipDepth;
1347
- shouldClip = instance._$shouldClip(preMatrix);
1348
- if (shouldClip) {
1349
- const adjMatrix = instance._$startClip(context, preMatrix);
1350
- if (adjMatrix === false) { // fixed
1351
- shouldClip = false;
1352
- continue;
1353
- }
1354
- if (adjMatrix instanceof Float32Array) {
1355
- clipMatrix.push(preMatrix);
1356
- preMatrix = adjMatrix;
1357
- }
1358
- }
1359
- continue;
1360
- }
1361
- // mask start
1362
- const maskInstance = instance._$mask;
1363
- if (maskInstance) {
1364
- maskInstance._$updated = false;
1365
- let maskMatrix;
1366
- if (this === maskInstance._$parent) {
1367
- maskMatrix = preMatrix;
1368
- }
1369
- else {
1370
- maskMatrix = $MATRIX_ARRAY_IDENTITY;
1371
- let parent = maskInstance._$parent;
1372
- while (parent) {
1373
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1374
- parent = parent._$parent;
1375
- }
1376
- const mScale = player.scaleX;
1377
- const playerMatrix = $getFloat32Array6(mScale, 0, 0, mScale, 0, 0);
1378
- maskMatrix = $multiplicationMatrix(playerMatrix, maskMatrix);
1379
- $poolFloat32Array6(playerMatrix);
1380
- if (context.isLayer) {
1381
- const currentPosition = context.getCurrentPosition();
1382
- maskMatrix[4] -= currentPosition.xMin;
1383
- maskMatrix[5] -= currentPosition.yMin;
1384
- }
1385
- if (context.cacheBounds) {
1386
- maskMatrix[4] -= context.cacheBounds.xMin;
1387
- maskMatrix[5] -= context.cacheBounds.yMin;
1388
- }
1389
- }
1390
- if (!maskInstance._$shouldClip(maskMatrix)) {
1391
- continue;
1392
- }
1393
- const adjMatrix = maskInstance._$startClip(context, maskMatrix);
1394
- context.save();
1395
- if (adjMatrix === false) { // fixed
1396
- context.restore();
1397
- continue;
1398
- }
1399
- if (adjMatrix instanceof Float32Array) {
1400
- instanceMatrix.push(preMatrix);
1401
- if (this !== maskInstance._$parent) {
1402
- const rawMatrix = transform._$rawMatrix();
1403
- adjMatrix[0] = $Math.abs(preMatrix[0]) * $Math.sign(rawMatrix[0]);
1404
- adjMatrix[1] = $Math.abs(preMatrix[1]) * $Math.sign(rawMatrix[1]);
1405
- adjMatrix[2] = $Math.abs(preMatrix[2]) * $Math.sign(rawMatrix[2]);
1406
- adjMatrix[3] = $Math.abs(preMatrix[3]) * $Math.sign(rawMatrix[3]);
1407
- adjMatrix[4] = preMatrix[4] - context.cacheBounds.xMin;
1408
- adjMatrix[5] = preMatrix[5] - context.cacheBounds.yMin;
1409
- }
1410
- preMatrix = adjMatrix;
1411
- }
1412
- }
1413
- instance._$draw(context, preMatrix, preColorTransform);
1414
- instance._$updated = false;
1415
- // mask end
1416
- if (maskInstance) {
1417
- context.restore();
1418
- context._$leaveClip();
1419
- if (instanceMatrix.length) {
1420
- const matrix = instanceMatrix.pop();
1421
- if (matrix) {
1422
- $poolFloat32Array6(preMatrix);
1423
- preMatrix = matrix;
1424
- }
1425
- }
1426
- }
1427
- }
1428
- // end mask
1429
- if (clipDepth) {
1430
- context.restore();
1431
- if (shouldClips.pop()) {
1432
- context._$leaveClip();
1433
- }
1434
- }
1435
- // object pool
1436
- $poolArray(clipMatrix);
1437
- $poolArray(instanceMatrix);
1438
- $poolArray(clipStack);
1439
- $poolArray(shouldClips);
1440
- // filter and blend
1441
- if (preObject.isFilter) {
1442
- return this._$postDraw(context, matrix, multiColor, preObject);
1443
- }
1444
- if (preObject.matrix !== matrix) {
1445
- $poolFloat32Array6(preObject.matrix);
1446
- }
1447
- if (multiColor !== color_transform) {
1448
- $poolFloat32Array8(multiColor);
1449
- }
1450
- $poolPreObject(preObject);
1451
- }
1452
- /**
1453
- * @param {CanvasRenderingContext2D} context
1454
- * @param {Float32Array} matrix
1455
- * @param {object} options
1456
- * @param {boolean} [mouse_children=true]
1457
- * @return {boolean}
1458
- * @method
1459
- * @private
1460
- */
1461
- _$mouseHit(context, matrix, options, mouse_children = true) {
1462
- let multiMatrix = matrix;
1463
- const rawMatrix = this._$transform._$rawMatrix();
1464
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1465
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1466
- }
1467
- const children = this._$getChildren();
1468
- // mask set
1469
- const clips = $getArray();
1470
- const targets = $getArray();
1471
- const clipIndexes = $getMap();
1472
- let clipDepth = 0;
1473
- let clipIdx = 0;
1474
- for (let idx = 0; idx < children.length; ++idx) {
1475
- const instance = children[idx];
1476
- if (!instance._$visible && !instance._$hitObject) {
1477
- continue;
1478
- }
1479
- if (instance._$clipDepth) {
1480
- clipIdx = clips.length;
1481
- clipDepth = instance._$clipDepth;
1482
- clips.push(instance);
1483
- continue;
1484
- }
1485
- // clip end
1486
- if (clipDepth && instance._$placeId > clipDepth) {
1487
- clipIdx = 0;
1488
- clipDepth = 0;
1489
- }
1490
- // clip check on
1491
- if (clipIdx) {
1492
- clipIndexes.set(instance._$instanceId, clipIdx);
1493
- }
1494
- targets.push(instance);
1495
- }
1496
- // setup
1497
- const mouseChildren = this._$mouseChildren && mouse_children;
1498
- let hit = false;
1499
- const isRoot = this._$root === this;
1500
- while (targets.length) {
1501
- const instance = targets.pop();
1502
- if (instance._$isMask) {
1503
- continue;
1504
- }
1505
- if (isRoot && !(instance instanceof InteractiveObject)) {
1506
- continue;
1507
- }
1508
- // mask target
1509
- if (clipIndexes.has(instance._$instanceId)) {
1510
- const index = clipIndexes.get(instance._$instanceId);
1511
- if (!index) {
1512
- continue;
1513
- }
1514
- const clip = clips[index];
1515
- if (!clip._$hit(context, multiMatrix, options, true)) {
1516
- continue;
1517
- }
1518
- }
1519
- // mask hit test
1520
- const maskInstance = instance._$mask;
1521
- if (maskInstance) {
1522
- if (this === maskInstance._$parent) {
1523
- if (!maskInstance._$hit(context, multiMatrix, options, true)) {
1524
- continue;
1525
- }
1526
- }
1527
- else {
1528
- let maskMatrix = $MATRIX_ARRAY_IDENTITY;
1529
- let parent = maskInstance._$parent;
1530
- while (parent) {
1531
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1532
- parent = parent._$parent;
1533
- }
1534
- if (!maskInstance._$hit(context, maskMatrix, options, true)) {
1535
- continue;
1536
- }
1537
- }
1538
- }
1539
- if (instance._$mouseHit(context, multiMatrix, options, mouseChildren)
1540
- || instance._$hitArea
1541
- && instance
1542
- ._$hitArea
1543
- ._$mouseHit(context, multiMatrix, options, mouseChildren)) {
1544
- if (instance._$root === instance) {
1545
- return true;
1546
- }
1547
- if (!mouseChildren) {
1548
- return true;
1549
- }
1550
- hit = true;
1551
- if (instance instanceof InteractiveObject) {
1552
- if (!instance.mouseEnabled && !instance._$hitObject) {
1553
- continue;
1554
- }
1555
- if (!$isTouch && !options.pointer) {
1556
- if ("_$text" in instance
1557
- && "type" in instance
1558
- && instance.type === "input") {
1559
- options.pointer = "text";
1560
- }
1561
- if ("buttonMode" in instance
1562
- && "useHandCursor" in instance
1563
- && instance.buttonMode
1564
- && instance.useHandCursor) {
1565
- options.pointer = "pointer";
1566
- }
1567
- }
1568
- if (!options.hit) {
1569
- options.hit = !instance.mouseEnabled && instance._$hitObject
1570
- ? instance._$hitObject
1571
- : instance;
1572
- }
1573
- return true;
1574
- }
1575
- }
1576
- }
1577
- // pool
1578
- $poolArray(clips);
1579
- $poolArray(targets);
1580
- $poolMap(clipIndexes);
1581
- // graphics
1582
- if (!hit) {
1583
- const graphics = "_$graphics" in this
1584
- ? this._$graphics
1585
- : null;
1586
- if (graphics) {
1587
- hit = graphics._$hit(context, multiMatrix, options);
1588
- }
1589
- }
1590
- if (multiMatrix !== matrix) {
1591
- $poolFloat32Array6(multiMatrix);
1592
- }
1593
- // not found
1594
- return hit;
1595
- }
1596
- /**
1597
- * @param {CanvasRenderingContext2D} context
1598
- * @param {Float32Array} matrix
1599
- * @param {object} options
1600
- * @param {boolean} [is_clip=false]
1601
- * @return {boolean}
1602
- * @method
1603
- * @private
1604
- */
1605
- _$hit(context, matrix, options, is_clip = false) {
1606
- let multiMatrix = matrix;
1607
- const rawMatrix = this._$transform._$rawMatrix();
1608
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1609
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1610
- }
1611
- const children = this._$getChildren();
1612
- for (let idx = children.length; idx > -1; --idx) {
1613
- const instance = children[idx];
1614
- if (instance._$isMask) {
1615
- continue;
1616
- }
1617
- if (instance._$hit(context, multiMatrix, options, is_clip)) {
1618
- return true;
1619
- }
1620
- }
1621
- let hit = false;
1622
- const graphics = "_$graphics" in this
1623
- ? this._$graphics
1624
- : null;
1625
- if (graphics) {
1626
- hit = graphics._$hit(context, multiMatrix, options);
1627
- }
1628
- if (multiMatrix !== matrix) {
1629
- $poolFloat32Array6(multiMatrix);
1630
- }
1631
- return hit;
1632
- }
1633
- /**
1634
- * @param {number} index
1635
- * @return {DisplayObject}
1636
- * @method
1637
- * @private
1638
- */
1639
- _$createInstance(index) {
1640
- if (!this._$dictionary) {
1641
- throw new Error("the dictionary is null.");
1642
- }
1643
- // build
1644
- const tag = this._$dictionary[index];
1645
- const loaderInfo = this._$loaderInfo;
1646
- if (!loaderInfo || !loaderInfo._$data) {
1647
- throw new Error("the loaderInfo or data is null.");
1648
- }
1649
- const character = loaderInfo._$data.characters[tag.characterId];
1650
- // symbol class
1651
- const instance = $createInstance(character.extends);
1652
- instance._$build(tag, this);
1653
- instance._$id = index;
1654
- return instance;
1655
- }
1656
- /**
1657
- * @param {number} x
1658
- * @param {number} y
1659
- * @return {boolean}
1660
- * @method
1661
- * @private
1662
- */
1663
- _$outCheck(x, y) {
1664
- let matrix = $MATRIX_ARRAY_IDENTITY;
1665
- let parent = this._$parent;
1666
- while (parent) {
1667
- matrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), matrix);
1668
- parent = parent._$parent;
1669
- }
1670
- $hitContext.setTransform(1, 0, 0, 1, 0, 0);
1671
- $hitContext.beginPath();
1672
- const options = {
1673
- "x": x,
1674
- "y": y,
1675
- "pointer": "",
1676
- "hit": null
1677
- };
1678
- return this._$mouseHit($hitContext, matrix, options);
1679
- }
1680
- /**
1681
- * @return {void}
1682
- * @method
1683
- * @private
1684
- */
1685
- _$createWorkerInstance() {
1686
- if (this._$created || !$rendererWorker) {
1687
- return;
1688
- }
1689
- this._$created = true;
1690
- const options = $getArray();
1691
- const message = {
1692
- "command": "createDisplayObjectContainer",
1693
- "instanceId": this._$instanceId,
1694
- "parentId": this._$parent ? this._$parent._$instanceId : -1
1695
- };
1696
- const graphics = "_$graphics" in this
1697
- ? this._$graphics
1698
- : null;
1699
- if (graphics) {
1700
- const recodes = graphics._$getRecodes();
1701
- options.push(recodes.buffer);
1702
- message.recodes = recodes;
1703
- message.maxAlpha = graphics._$maxAlpha;
1704
- message.canDraw = graphics._$canDraw;
1705
- message.xMin = graphics._$xMin;
1706
- message.yMin = graphics._$yMin;
1707
- message.xMax = graphics._$xMax;
1708
- message.yMax = graphics._$yMax;
1709
- }
1710
- $rendererWorker.postMessage(message, options);
1711
- }
1712
- /**
1713
- * @return {object}
1714
- * @method
1715
- * @private
1716
- */
1717
- _$postProperty() {
1718
- if (!$rendererWorker) {
1719
- return;
1720
- }
1721
- this._$postChildrenIds();
1722
- const options = $getArray();
1723
- const message = this._$createMessage();
1724
- const graphics = "_$graphics" in this
1725
- ? this._$graphics
1726
- : null;
1727
- if (graphics && !graphics._$buffer) {
1728
- message.maxAlpha = graphics._$maxAlpha;
1729
- message.canDraw = graphics._$canDraw;
1730
- const recodes = graphics._$getRecodes();
1731
- message.recodes = recodes;
1732
- options.push(recodes.buffer);
1733
- const bounds = this._$getBounds();
1734
- message.xMin = bounds.xMin;
1735
- message.yMin = bounds.yMin;
1736
- message.xMax = bounds.xMax;
1737
- message.yMax = bounds.yMax;
1738
- }
1739
- $rendererWorker
1740
- .postMessage(message, options);
1741
- $poolArray(options);
1742
- this._$posted = true;
1743
- this._$updated = false;
1744
- }
1745
- /**
1746
- * @param {array} [childrenIds=null]
1747
- * @return {void}
1748
- * @method
1749
- * @private
1750
- */
1751
- _$postChildrenIds(childrenIds = null) {
1752
- if (!$rendererWorker) {
1753
- return;
1754
- }
1755
- if (!childrenIds) {
1756
- const children = this._$getChildren();
1757
- childrenIds = $getArray();
1758
- for (let idx = 0; idx < children.length; ++idx) {
1759
- childrenIds.push(children[idx]._$instanceId);
1760
- }
1761
- $rendererWorker.postMessage({
1762
- "command": "setChildren",
1763
- "instanceId": this._$instanceId,
1764
- "children": childrenIds
1765
- });
1766
- $poolArray(childrenIds);
1767
- }
1768
- else {
1769
- $rendererWorker.postMessage({
1770
- "command": "setChildren",
1771
- "instanceId": this._$instanceId,
1772
- "children": childrenIds
1773
- });
1774
- }
1775
- }
1776
- }