@next2d/display 1.18.12 → 2.0.0

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 (405) hide show
  1. package/package.json +17 -28
  2. package/src/BitmapData/service/BitmapDataCanvasToBufferService.d.ts +10 -0
  3. package/src/BitmapData/service/BitmapDataCanvasToBufferService.js +22 -0
  4. package/src/BitmapData/service/BitmapDataImageToBufferService.d.ts +10 -0
  5. package/src/BitmapData/service/BitmapDataImageToBufferService.js +21 -0
  6. package/src/BitmapData.d.ts +71 -0
  7. package/src/BitmapData.js +133 -0
  8. package/{dist → src}/BlendMode.d.ts +4 -50
  9. package/{dist → src}/BlendMode.js +4 -58
  10. package/src/DisplayObject/service/DisplayObjectApplyChangesService.d.ts +11 -0
  11. package/src/DisplayObject/service/DisplayObjectApplyChangesService.js +16 -0
  12. package/src/DisplayObject/service/DisplayObjectBaseBuildService.d.ts +16 -0
  13. package/src/DisplayObject/service/DisplayObjectBaseBuildService.js +31 -0
  14. package/src/DisplayObject/service/DisplayObjectBlendToNumberService.d.ts +11 -0
  15. package/src/DisplayObject/service/DisplayObjectBlendToNumberService.js +45 -0
  16. package/src/DisplayObject/service/DisplayObjectBuildFilterService.d.ts +12 -0
  17. package/src/DisplayObject/service/DisplayObjectBuildFilterService.js +53 -0
  18. package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.d.ts +14 -0
  19. package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.js +31 -0
  20. package/src/DisplayObject/service/DisplayObjectDispatchAddedEventService.d.ts +11 -0
  21. package/src/DisplayObject/service/DisplayObjectDispatchAddedEventService.js +19 -0
  22. package/src/DisplayObject/service/DisplayObjectDispatchAddedToStageEventService.d.ts +11 -0
  23. package/src/DisplayObject/service/DisplayObjectDispatchAddedToStageEventService.js +21 -0
  24. package/src/DisplayObject/service/DisplayObjectDispatchRemovedEventService.d.ts +11 -0
  25. package/src/DisplayObject/service/DisplayObjectDispatchRemovedEventService.js +19 -0
  26. package/src/DisplayObject/service/DisplayObjectDispatchRemovedToStageEventService.d.ts +11 -0
  27. package/src/DisplayObject/service/DisplayObjectDispatchRemovedToStageEventService.js +27 -0
  28. package/src/DisplayObject/service/DisplayObjectGenerateHashService.d.ts +10 -0
  29. package/src/DisplayObject/service/DisplayObjectGenerateHashService.js +24 -0
  30. package/src/DisplayObject/service/DisplayObjectGetPlaceObjectService.d.ts +12 -0
  31. package/src/DisplayObject/service/DisplayObjectGetPlaceObjectService.js +41 -0
  32. package/src/DisplayObject/service/DisplayObjectGlobalToLocalService.d.ts +13 -0
  33. package/src/DisplayObject/service/DisplayObjectGlobalToLocalService.js +18 -0
  34. package/src/DisplayObject/service/DisplayObjectLocalToGlobalService.d.ts +13 -0
  35. package/src/DisplayObject/service/DisplayObjectLocalToGlobalService.js +17 -0
  36. package/src/DisplayObject/service/DisplayObjectRemoveService.d.ts +11 -0
  37. package/src/DisplayObject/service/DisplayObjectRemoveService.js +16 -0
  38. package/src/DisplayObject/usecase/DisplayObjectConcatenatedMatrixUseCase.d.ts +12 -0
  39. package/src/DisplayObject/usecase/DisplayObjectConcatenatedMatrixUseCase.js +25 -0
  40. package/src/DisplayObject/usecase/DisplayObjectGetAlphaUseCase.d.ts +11 -0
  41. package/src/DisplayObject/usecase/DisplayObjectGetAlphaUseCase.js +24 -0
  42. package/src/DisplayObject/usecase/DisplayObjectGetBlendModeUseCase.d.ts +12 -0
  43. package/src/DisplayObject/usecase/DisplayObjectGetBlendModeUseCase.js +19 -0
  44. package/src/DisplayObject/usecase/DisplayObjectGetBoundsUseCase.d.ts +13 -0
  45. package/src/DisplayObject/usecase/DisplayObjectGetBoundsUseCase.js +37 -0
  46. package/src/DisplayObject/usecase/DisplayObjectGetCalcBoundsUseCase.d.ts +11 -0
  47. package/src/DisplayObject/usecase/DisplayObjectGetCalcBoundsUseCase.js +28 -0
  48. package/src/DisplayObject/usecase/DisplayObjectGetColorTransformUseCase.d.ts +12 -0
  49. package/src/DisplayObject/usecase/DisplayObjectGetColorTransformUseCase.js +17 -0
  50. package/src/DisplayObject/usecase/DisplayObjectGetFiltersUseCase.d.ts +12 -0
  51. package/src/DisplayObject/usecase/DisplayObjectGetFiltersUseCase.js +25 -0
  52. package/src/DisplayObject/usecase/DisplayObjectGetHeightUseCase.d.ts +11 -0
  53. package/src/DisplayObject/usecase/DisplayObjectGetHeightUseCase.js +24 -0
  54. package/src/DisplayObject/usecase/DisplayObjectGetMatrixUseCase.d.ts +12 -0
  55. package/src/DisplayObject/usecase/DisplayObjectGetMatrixUseCase.js +17 -0
  56. package/src/DisplayObject/usecase/DisplayObjectGetRawBoundsUseCase.d.ts +11 -0
  57. package/src/DisplayObject/usecase/DisplayObjectGetRawBoundsUseCase.js +28 -0
  58. package/src/DisplayObject/usecase/DisplayObjectGetRawColorTransformUseCase.d.ts +11 -0
  59. package/src/DisplayObject/usecase/DisplayObjectGetRawColorTransformUseCase.js +25 -0
  60. package/src/DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase.d.ts +12 -0
  61. package/src/DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase.js +26 -0
  62. package/src/DisplayObject/usecase/DisplayObjectGetRotationUseCase.d.ts +11 -0
  63. package/src/DisplayObject/usecase/DisplayObjectGetRotationUseCase.js +23 -0
  64. package/src/DisplayObject/usecase/DisplayObjectGetScaleXUseCase.d.ts +11 -0
  65. package/src/DisplayObject/usecase/DisplayObjectGetScaleXUseCase.js +29 -0
  66. package/src/DisplayObject/usecase/DisplayObjectGetScaleYUseCase.d.ts +11 -0
  67. package/src/DisplayObject/usecase/DisplayObjectGetScaleYUseCase.js +29 -0
  68. package/src/DisplayObject/usecase/DisplayObjectGetWidthUseCase.d.ts +11 -0
  69. package/src/DisplayObject/usecase/DisplayObjectGetWidthUseCase.js +24 -0
  70. package/src/DisplayObject/usecase/DisplayObjectGetXUseCase.d.ts +11 -0
  71. package/src/DisplayObject/usecase/DisplayObjectGetXUseCase.js +16 -0
  72. package/src/DisplayObject/usecase/DisplayObjectGetYUseCase.d.ts +11 -0
  73. package/src/DisplayObject/usecase/DisplayObjectGetYUseCase.js +16 -0
  74. package/src/DisplayObject/usecase/DisplayObjectHitTestObjectUseCase.d.ts +10 -0
  75. package/src/DisplayObject/usecase/DisplayObjectHitTestObjectUseCase.js +35 -0
  76. package/src/DisplayObject/usecase/DisplayObjectHitTestPointUseCase.d.ts +14 -0
  77. package/src/DisplayObject/usecase/DisplayObjectHitTestPointUseCase.js +69 -0
  78. package/src/DisplayObject/usecase/DisplayObjectIsMaskReflectedInDisplayUseCase.d.ts +16 -0
  79. package/src/DisplayObject/usecase/DisplayObjectIsMaskReflectedInDisplayUseCase.js +59 -0
  80. package/src/DisplayObject/usecase/DisplayObjectSetAlphaUseCase.d.ts +12 -0
  81. package/src/DisplayObject/usecase/DisplayObjectSetAlphaUseCase.js +32 -0
  82. package/src/DisplayObject/usecase/DisplayObjectSetBlendModeUseCase.d.ts +13 -0
  83. package/src/DisplayObject/usecase/DisplayObjectSetBlendModeUseCase.js +18 -0
  84. package/src/DisplayObject/usecase/DisplayObjectSetFiltersUseCase.d.ts +13 -0
  85. package/src/DisplayObject/usecase/DisplayObjectSetFiltersUseCase.js +15 -0
  86. package/src/DisplayObject/usecase/DisplayObjectSetHeightUseCase.d.ts +12 -0
  87. package/src/DisplayObject/usecase/DisplayObjectSetHeightUseCase.js +30 -0
  88. package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.d.ts +12 -0
  89. package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.js +63 -0
  90. package/src/DisplayObject/usecase/DisplayObjectSetScaleXUseCase.d.ts +12 -0
  91. package/src/DisplayObject/usecase/DisplayObjectSetScaleXUseCase.js +48 -0
  92. package/src/DisplayObject/usecase/DisplayObjectSetScaleYUseCase.d.ts +12 -0
  93. package/src/DisplayObject/usecase/DisplayObjectSetScaleYUseCase.js +48 -0
  94. package/src/DisplayObject/usecase/DisplayObjectSetWidthUseCase.d.ts +12 -0
  95. package/src/DisplayObject/usecase/DisplayObjectSetWidthUseCase.js +30 -0
  96. package/src/DisplayObject/usecase/DisplayObjectSetXUseCase.d.ts +12 -0
  97. package/src/DisplayObject/usecase/DisplayObjectSetXUseCase.js +27 -0
  98. package/src/DisplayObject/usecase/DisplayObjectSetYUseCase.d.ts +12 -0
  99. package/src/DisplayObject/usecase/DisplayObjectSetYUseCase.js +27 -0
  100. package/src/DisplayObject.d.ts +706 -0
  101. package/src/DisplayObject.js +1094 -0
  102. package/src/DisplayObjectContainer/service/DisplayObjectContainerAddedToStageService.d.ts +11 -0
  103. package/src/DisplayObjectContainer/service/DisplayObjectContainerAddedToStageService.js +24 -0
  104. package/src/DisplayObjectContainer/service/DisplayObjectContainerAssignStageAndRootService.d.ts +11 -0
  105. package/src/DisplayObjectContainer/service/DisplayObjectContainerAssignStageAndRootService.js +26 -0
  106. package/src/DisplayObjectContainer/service/DisplayObjectContainerContainsService.d.ts +13 -0
  107. package/src/DisplayObjectContainer/service/DisplayObjectContainerContainsService.js +32 -0
  108. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildAtService.d.ts +13 -0
  109. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildAtService.js +14 -0
  110. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildByNameService.d.ts +13 -0
  111. package/src/DisplayObjectContainer/service/DisplayObjectContainerGetChildByNameService.js +24 -0
  112. package/src/DisplayObjectContainer/service/DisplayObjectContainerRemovedToStageService.d.ts +12 -0
  113. package/src/DisplayObjectContainer/service/DisplayObjectContainerRemovedToStageService.js +24 -0
  114. package/src/DisplayObjectContainer/service/DisplayObjectContainerUnAssignStageAndRootService.d.ts +11 -0
  115. package/src/DisplayObjectContainer/service/DisplayObjectContainerUnAssignStageAndRootService.js +29 -0
  116. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAddChildUseCase.d.ts +13 -0
  117. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAddChildUseCase.js +53 -0
  118. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAdvanceFrameUseCase.d.ts +11 -0
  119. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerAdvanceFrameUseCase.js +39 -0
  120. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerCalcBoundsMatrixUseCase.d.ts +11 -0
  121. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerCalcBoundsMatrixUseCase.js +62 -0
  122. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateClipQueueUseCase.d.ts +13 -0
  123. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateClipQueueUseCase.js +49 -0
  124. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.d.ts +18 -0
  125. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.js +163 -0
  126. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerMouseHitUseCase.d.ts +17 -0
  127. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerMouseHitUseCase.js +206 -0
  128. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerPrepareUseCase.d.ts +11 -0
  129. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerPrepareUseCase.js +32 -0
  130. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRawBoundsMatrixUseCase.d.ts +12 -0
  131. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRawBoundsMatrixUseCase.js +62 -0
  132. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildAtUseCase.d.ts +12 -0
  133. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildAtUseCase.js +19 -0
  134. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildUseCase.d.ts +13 -0
  135. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildUseCase.js +66 -0
  136. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildrenUseCase.d.ts +12 -0
  137. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerRemoveChildrenUseCase.js +25 -0
  138. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSetChildIndexUseCase.d.ts +14 -0
  139. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSetChildIndexUseCase.js +22 -0
  140. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenAtUseCase.d.ts +13 -0
  141. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenAtUseCase.js +23 -0
  142. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenUseCase.d.ts +14 -0
  143. package/src/DisplayObjectContainer/usecase/DisplayObjectContainerSwapChildrenUseCase.js +23 -0
  144. package/src/DisplayObjectContainer.d.ts +229 -0
  145. package/src/DisplayObjectContainer.js +317 -0
  146. package/src/DisplayObjectUtil.d.ts +288 -0
  147. package/src/DisplayObjectUtil.js +465 -0
  148. package/src/FrameLabel.d.ts +45 -0
  149. package/src/FrameLabel.js +59 -0
  150. package/src/Graphics/service/GraphicsCalcFillBoundsService.d.ts +13 -0
  151. package/src/Graphics/service/GraphicsCalcFillBoundsService.js +17 -0
  152. package/src/Graphics/service/GraphicsCalcLineBoundsService.d.ts +17 -0
  153. package/src/Graphics/service/GraphicsCalcLineBoundsService.js +58 -0
  154. package/src/Graphics/service/GraphicsDrawEllipseService.d.ts +15 -0
  155. package/src/Graphics/service/GraphicsDrawEllipseService.js +36 -0
  156. package/src/Graphics/service/GraphicsDrawRectService.d.ts +15 -0
  157. package/src/Graphics/service/GraphicsDrawRectService.js +28 -0
  158. package/src/Graphics/service/GraphicsDrawRoundRectService.d.ts +17 -0
  159. package/src/Graphics/service/GraphicsDrawRoundRectService.js +48 -0
  160. package/src/Graphics/service/GraphicsHitTestService.d.ts +13 -0
  161. package/src/Graphics/service/GraphicsHitTestService.js +73 -0
  162. package/src/Graphics/service/GraphicsMargePathService.d.ts +15 -0
  163. package/src/Graphics/service/GraphicsMargePathService.js +23 -0
  164. package/src/Graphics/service/GraphicsToNumberArrayService.d.ts +10 -0
  165. package/src/Graphics/service/GraphicsToNumberArrayService.js +242 -0
  166. package/src/Graphics/usecase/GraphicsCalcBoundsUseCase.d.ts +17 -0
  167. package/src/Graphics/usecase/GraphicsCalcBoundsUseCase.js +28 -0
  168. package/{dist → src}/Graphics.d.ts +240 -217
  169. package/src/Graphics.js +1224 -0
  170. package/{dist → src}/GraphicsBitmapFill.d.ts +4 -5
  171. package/{dist → src}/GraphicsBitmapFill.js +29 -6
  172. package/{dist → src}/GraphicsGradientFill.d.ts +12 -13
  173. package/{dist → src}/GraphicsGradientFill.js +68 -19
  174. package/src/InteractiveObject.d.ts +37 -0
  175. package/src/InteractiveObject.js +51 -0
  176. package/src/Loader/service/LoaderBuildService.d.ts +13 -0
  177. package/src/Loader/service/LoaderBuildService.js +46 -0
  178. package/src/Loader/service/LoaderLoadStartEventService.d.ts +12 -0
  179. package/src/Loader/service/LoaderLoadStartEventService.js +19 -0
  180. package/src/Loader/service/LoaderProgressEventService.d.ts +12 -0
  181. package/src/Loader/service/LoaderProgressEventService.js +16 -0
  182. package/src/Loader/usecase/LoaderLoadEndEventUseCase.d.ts +12 -0
  183. package/src/Loader/usecase/LoaderLoadEndEventUseCase.js +39 -0
  184. package/src/Loader/usecase/LoaderLoadJsonUseCase.d.ts +14 -0
  185. package/src/Loader/usecase/LoaderLoadJsonUseCase.js +33 -0
  186. package/src/Loader/usecase/LoaderLoadUseCase.d.ts +14 -0
  187. package/src/Loader/usecase/LoaderLoadUseCase.js +39 -0
  188. package/src/Loader/worker/ZlibInflateWorker.d.ts +2 -0
  189. package/src/Loader/worker/ZlibInflateWorker.js +20 -0
  190. package/src/Loader.d.ts +82 -0
  191. package/src/Loader.js +104 -0
  192. package/src/LoaderInfo.d.ts +68 -0
  193. package/src/LoaderInfo.js +96 -0
  194. package/src/LoopConfig.d.ts +61 -0
  195. package/src/LoopConfig.js +86 -0
  196. package/src/LoopType.d.ts +59 -0
  197. package/src/LoopType.js +69 -0
  198. package/src/MovieClip/service/MovieClipAddActionsService.d.ts +12 -0
  199. package/src/MovieClip/service/MovieClipAddActionsService.js +27 -0
  200. package/src/MovieClip/service/MovieClipAddFrameLabelService.d.ts +13 -0
  201. package/src/MovieClip/service/MovieClipAddFrameLabelService.js +16 -0
  202. package/src/MovieClip/service/MovieClipAddLabelsService.d.ts +13 -0
  203. package/src/MovieClip/service/MovieClipAddLabelsService.js +20 -0
  204. package/src/MovieClip/service/MovieClipBuildSoundsService.d.ts +15 -0
  205. package/src/MovieClip/service/MovieClipBuildSoundsService.js +47 -0
  206. package/src/MovieClip/service/MovieClipCurrentFrameLabelService.d.ts +12 -0
  207. package/src/MovieClip/service/MovieClipCurrentFrameLabelService.js +19 -0
  208. package/src/MovieClip/service/MovieClipCurrentLabelsService.d.ts +12 -0
  209. package/src/MovieClip/service/MovieClipCurrentLabelsService.js +14 -0
  210. package/src/MovieClip/service/MovieClipDispatchFrameLabelEventService.d.ts +13 -0
  211. package/src/MovieClip/service/MovieClipDispatchFrameLabelEventService.js +24 -0
  212. package/src/MovieClip/service/MovieClipGetChildrenService.d.ts +13 -0
  213. package/src/MovieClip/service/MovieClipGetChildrenService.js +133 -0
  214. package/src/MovieClip/service/MovieClipGetFrameForLabelService.d.ts +12 -0
  215. package/src/MovieClip/service/MovieClipGetFrameForLabelService.js +22 -0
  216. package/src/MovieClip/service/MovieClipSetActionService.d.ts +12 -0
  217. package/src/MovieClip/service/MovieClipSetActionService.js +21 -0
  218. package/src/MovieClip/service/MovieClipSetSoundsService.d.ts +13 -0
  219. package/src/MovieClip/service/MovieClipSetSoundsService.js +21 -0
  220. package/src/MovieClip/usecase/MovieClipAdvanceFrameUseCase.d.ts +11 -0
  221. package/src/MovieClip/usecase/MovieClipAdvanceFrameUseCase.js +36 -0
  222. package/src/MovieClip/usecase/MovieClipBuildDictionaryCharacterUseCase.d.ts +17 -0
  223. package/src/MovieClip/usecase/MovieClipBuildDictionaryCharacterUseCase.js +51 -0
  224. package/src/MovieClip/usecase/MovieClipBuildFromCharacterUseCase.d.ts +12 -0
  225. package/src/MovieClip/usecase/MovieClipBuildFromCharacterUseCase.js +33 -0
  226. package/src/MovieClip/usecase/MovieClipGoToFrameUseCase.d.ts +12 -0
  227. package/src/MovieClip/usecase/MovieClipGoToFrameUseCase.js +58 -0
  228. package/src/MovieClip/usecase/MovieClipGotoAndPlayUseCase.d.ts +12 -0
  229. package/src/MovieClip/usecase/MovieClipGotoAndPlayUseCase.js +15 -0
  230. package/src/MovieClip/usecase/MovieClipGotoAndStopUseCase.d.ts +12 -0
  231. package/src/MovieClip/usecase/MovieClipGotoAndStopUseCase.js +16 -0
  232. package/src/MovieClip/usecase/MovieClipNextFrameUseCase.d.ts +11 -0
  233. package/src/MovieClip/usecase/MovieClipNextFrameUseCase.js +17 -0
  234. package/src/MovieClip/usecase/MovieClipPrepareActionUseCase.d.ts +11 -0
  235. package/src/MovieClip/usecase/MovieClipPrepareActionUseCase.js +21 -0
  236. package/src/MovieClip/usecase/MovieClipPrepareSoundUseCase.d.ts +11 -0
  237. package/src/MovieClip/usecase/MovieClipPrepareSoundUseCase.js +18 -0
  238. package/src/MovieClip/usecase/MovieClipPrevFrameUseCase.d.ts +11 -0
  239. package/src/MovieClip/usecase/MovieClipPrevFrameUseCase.js +17 -0
  240. package/{dist → src}/MovieClip.d.ts +128 -167
  241. package/src/MovieClip.js +409 -0
  242. package/src/Shape/service/ShapeGetRawBoundsService.d.ts +10 -0
  243. package/src/Shape/service/ShapeGetRawBoundsService.js +13 -0
  244. package/src/Shape/usecase/ShapeBuildFromCharacterUseCase.d.ts +13 -0
  245. package/src/Shape/usecase/ShapeBuildFromCharacterUseCase.js +121 -0
  246. package/src/Shape/usecase/ShapeCalcBoundsMatrixUseCase.d.ts +12 -0
  247. package/src/Shape/usecase/ShapeCalcBoundsMatrixUseCase.js +30 -0
  248. package/src/Shape/usecase/ShapeClearBitmapBufferUseCase.d.ts +11 -0
  249. package/src/Shape/usecase/ShapeClearBitmapBufferUseCase.js +24 -0
  250. package/src/Shape/usecase/ShapeGenerateClipQueueUseCase.d.ts +12 -0
  251. package/src/Shape/usecase/ShapeGenerateClipQueueUseCase.js +30 -0
  252. package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.d.ts +17 -0
  253. package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.js +241 -0
  254. package/src/Shape/usecase/ShapeHitTestUseCase.d.ts +15 -0
  255. package/src/Shape/usecase/ShapeHitTestUseCase.js +34 -0
  256. package/src/Shape/usecase/ShapeLoadSrcUseCase.d.ts +12 -0
  257. package/src/Shape/usecase/ShapeLoadSrcUseCase.js +32 -0
  258. package/src/Shape/usecase/ShapeSetBitmapBufferUseCase.d.ts +14 -0
  259. package/src/Shape/usecase/ShapeSetBitmapBufferUseCase.js +22 -0
  260. package/src/Shape.d.ts +153 -0
  261. package/src/Shape.js +235 -0
  262. package/src/Sprite/service/SpriteStartDragService.d.ts +14 -0
  263. package/src/Sprite/service/SpriteStartDragService.js +22 -0
  264. package/src/Sprite/service/SpriteStopDragService.d.ts +11 -0
  265. package/src/Sprite/service/SpriteStopDragService.js +17 -0
  266. package/src/Sprite.d.ts +126 -0
  267. package/src/Sprite.js +192 -0
  268. package/src/Stage/service/StageExecuteFrameActionsService.d.ts +9 -0
  269. package/src/Stage/service/StageExecuteFrameActionsService.js +34 -0
  270. package/src/Stage/service/StageExecuteFrameSoundsService.d.ts +9 -0
  271. package/src/Stage/service/StageExecuteFrameSoundsService.js +35 -0
  272. package/src/Stage/usecase/StageGenerateRenderQueueUseCase.d.ts +18 -0
  273. package/src/Stage/usecase/StageGenerateRenderQueueUseCase.js +42 -0
  274. package/src/Stage/usecase/StageReadyUseCase.d.ts +11 -0
  275. package/src/Stage/usecase/StageReadyUseCase.js +20 -0
  276. package/src/Stage/usecase/StageTickerUseCase.d.ts +9 -0
  277. package/src/Stage/usecase/StageTickerUseCase.js +20 -0
  278. package/src/Stage.d.ts +161 -0
  279. package/src/Stage.js +240 -0
  280. package/src/TextField/service/TextFieldGetRawBoundsService.d.ts +10 -0
  281. package/src/TextField/service/TextFieldGetRawBoundsService.js +12 -0
  282. package/src/TextField/usecase/TextFieldCalcBoundsMatrixUseCase.d.ts +12 -0
  283. package/src/TextField/usecase/TextFieldCalcBoundsMatrixUseCase.js +30 -0
  284. package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.d.ts +17 -0
  285. package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.js +200 -0
  286. package/src/TextField/usecase/TextFieldHitTestUseCase.d.ts +15 -0
  287. package/src/TextField/usecase/TextFieldHitTestUseCase.js +36 -0
  288. package/src/Video/service/VideoGetRawBoundsService.d.ts +11 -0
  289. package/src/Video/service/VideoGetRawBoundsService.js +13 -0
  290. package/src/Video/usecase/VideoCalcBoundsMatrixUseCase.d.ts +12 -0
  291. package/src/Video/usecase/VideoCalcBoundsMatrixUseCase.js +30 -0
  292. package/src/Video/usecase/VideoGenerateRenderQueueUseCase.d.ts +18 -0
  293. package/src/Video/usecase/VideoGenerateRenderQueueUseCase.js +177 -0
  294. package/src/Video/usecase/VideoHitTestUseCase.d.ts +15 -0
  295. package/src/Video/usecase/VideoHitTestUseCase.js +37 -0
  296. package/{dist → src}/index.d.ts +0 -3
  297. package/{dist → src}/index.js +0 -3
  298. package/src/interface/IAjaxEvent.d.ts +5 -0
  299. package/src/interface/IAjaxEvent.js +1 -0
  300. package/src/interface/IAjaxOption.d.ts +13 -0
  301. package/src/interface/IAjaxOption.js +1 -0
  302. package/src/interface/IAnimationToolData.d.ts +8 -0
  303. package/src/interface/IAnimationToolData.js +1 -0
  304. package/src/interface/IAnimationToolDataZlib.d.ts +4 -0
  305. package/src/interface/IAnimationToolDataZlib.js +1 -0
  306. package/src/interface/IBlendMode.d.ts +1 -0
  307. package/src/interface/IBlendMode.js +1 -0
  308. package/src/interface/IBounds.d.ts +6 -0
  309. package/src/interface/IBounds.js +1 -0
  310. package/src/interface/ICapsStyle.d.ts +1 -0
  311. package/src/interface/ICapsStyle.js +1 -0
  312. package/src/interface/ICharacter.d.ts +5 -0
  313. package/src/interface/ICharacter.js +1 -0
  314. package/src/interface/IColorStop.d.ts +7 -0
  315. package/src/interface/IColorStop.js +1 -0
  316. package/src/interface/IDictionaryTag.d.ts +8 -0
  317. package/src/interface/IDictionaryTag.js +1 -0
  318. package/src/interface/IDisplayObject.d.ts +2 -0
  319. package/src/interface/IDisplayObject.js +1 -0
  320. package/src/interface/IFilterArray.d.ts +2 -0
  321. package/src/interface/IFilterArray.js +1 -0
  322. package/src/interface/IGradientType.d.ts +1 -0
  323. package/src/interface/IGradientType.js +1 -0
  324. package/src/interface/IGrid.d.ts +6 -0
  325. package/src/interface/IGrid.js +1 -0
  326. package/src/interface/IInterpolationMethod.d.ts +1 -0
  327. package/src/interface/IInterpolationMethod.js +1 -0
  328. package/src/interface/IJointStyle.d.ts +1 -0
  329. package/src/interface/IJointStyle.js +1 -0
  330. package/src/interface/ILoaderInfoData.d.ts +7 -0
  331. package/src/interface/ILoaderInfoData.js +1 -0
  332. package/src/interface/ILoopConfig.d.ts +8 -0
  333. package/src/interface/ILoopConfig.js +1 -0
  334. package/src/interface/ILoopType.d.ts +1 -0
  335. package/src/interface/ILoopType.js +1 -0
  336. package/src/interface/IMovieClipActionObject.d.ts +5 -0
  337. package/src/interface/IMovieClipActionObject.js +1 -0
  338. package/src/interface/IMovieClipCharacter.d.ts +17 -0
  339. package/src/interface/IMovieClipCharacter.js +1 -0
  340. package/src/interface/IMovieClipLabelObject.d.ts +4 -0
  341. package/src/interface/IMovieClipLabelObject.js +1 -0
  342. package/src/interface/IMovieClipSoundObject.d.ts +5 -0
  343. package/src/interface/IMovieClipSoundObject.js +1 -0
  344. package/src/interface/IParent.d.ts +2 -0
  345. package/src/interface/IParent.js +1 -0
  346. package/src/interface/IPlaceObject.d.ts +14 -0
  347. package/src/interface/IPlaceObject.js +1 -0
  348. package/src/interface/IPlayerHitObject.d.ts +7 -0
  349. package/src/interface/IPlayerHitObject.js +1 -0
  350. package/src/interface/IShapeCharacter.d.ts +14 -0
  351. package/src/interface/IShapeCharacter.js +1 -0
  352. package/src/interface/ISoundCharacter.d.ts +4 -0
  353. package/src/interface/ISoundCharacter.js +1 -0
  354. package/src/interface/ISoundTag.d.ts +6 -0
  355. package/src/interface/ISoundTag.js +1 -0
  356. package/src/interface/ISpreadMethod.d.ts +1 -0
  357. package/src/interface/ISpreadMethod.js +1 -0
  358. package/src/interface/ISprite.d.ts +2 -0
  359. package/src/interface/ISprite.js +1 -0
  360. package/src/interface/IStageData.d.ts +6 -0
  361. package/src/interface/IStageData.js +1 -0
  362. package/src/interface/ISurfaceFilter.d.ts +6 -0
  363. package/src/interface/ISurfaceFilter.js +1 -0
  364. package/src/interface/ITextFieldCharacter.d.ts +26 -0
  365. package/src/interface/ITextFieldCharacter.js +1 -0
  366. package/src/interface/ITextFieldType.d.ts +1 -0
  367. package/src/interface/ITextFieldType.js +1 -0
  368. package/src/interface/ITextFormatAlign.d.ts +1 -0
  369. package/src/interface/ITextFormatAlign.js +1 -0
  370. package/src/interface/IURLLoaderDataFormat.d.ts +1 -0
  371. package/src/interface/IURLLoaderDataFormat.js +1 -0
  372. package/src/interface/IURLRequestHeader.d.ts +4 -0
  373. package/src/interface/IURLRequestHeader.js +1 -0
  374. package/src/interface/IURLRequestMethod.d.ts +1 -0
  375. package/src/interface/IURLRequestMethod.js +1 -0
  376. package/src/interface/IVideoCharacter.d.ts +11 -0
  377. package/src/interface/IVideoCharacter.js +1 -0
  378. package/dist/BitmapData.d.ts +0 -151
  379. package/dist/BitmapData.js +0 -417
  380. package/dist/DisplayObject.d.ts +0 -563
  381. package/dist/DisplayObject.js +0 -1791
  382. package/dist/DisplayObjectContainer.d.ts +0 -346
  383. package/dist/DisplayObjectContainer.js +0 -1612
  384. package/dist/FrameLabel.d.ts +0 -98
  385. package/dist/FrameLabel.js +0 -120
  386. package/dist/Graphics.js +0 -2304
  387. package/dist/InteractiveObject.d.ts +0 -32
  388. package/dist/InteractiveObject.js +0 -43
  389. package/dist/Loader.d.ts +0 -140
  390. package/dist/Loader.js +0 -319
  391. package/dist/LoaderInfo.d.ts +0 -120
  392. package/dist/LoaderInfo.js +0 -184
  393. package/dist/LoopConfig.d.ts +0 -108
  394. package/dist/LoopConfig.js +0 -156
  395. package/dist/LoopType.d.ts +0 -104
  396. package/dist/LoopType.js +0 -122
  397. package/dist/MovieClip.js +0 -934
  398. package/dist/Shape.d.ts +0 -162
  399. package/dist/Shape.js +0 -517
  400. package/dist/Sprite.d.ts +0 -158
  401. package/dist/Sprite.js +0 -258
  402. package/dist/Stage.d.ts +0 -164
  403. package/dist/Stage.js +0 -252
  404. package/dist/TextField.d.ts +0 -656
  405. package/dist/TextField.js +0 -2807
@@ -1,1612 +0,0 @@
1
- import { InteractiveObject } from "./InteractiveObject";
2
- import { Event as Next2DEvent } from "@next2d/events";
3
- import { $createInstance, $currentPlayer, $getRenderBufferArray, $getRenderMessageObject, $hitContext, $isTouch, $MATRIX_HIT_ARRAY_IDENTITY, $poolRenderMessageObject, $rendererWorker } from "@next2d/util";
4
- import { $cacheStore, $doUpdated, $boundsMatrix, $clamp, $getArray, $getBoundsObject, $getFloat32Array6, $getFloat32Array8, $getMap, $getPreObject, $Math, $COLOR_ARRAY_IDENTITY, $MATRIX_ARRAY_IDENTITY, $multiplicationColor, $multiplicationMatrix, $Number, $poolArray, $poolBoundsObject, $poolFloat32Array6, $poolFloat32Array8, $poolMap, $poolPreObject, $devicePixelRatio } from "@next2d/share";
5
- /**
6
- * DisplayObjectContainer クラスは、表示リストで表示オブジェクトコンテナとして機能するすべてのオブジェクトの基本クラスです。
7
- * このクラス自体は、画面上でのコンテンツの描画のための API を含みません。
8
- * そのため、DisplayObject クラスのカスタムサブクラスを作成する場合は、
9
- * Sprite、または MovieClip など、画面上にコンテンツを描画する API を持つサブクラスの 1 つを拡張する必要があります。
10
- *
11
- * The DisplayObjectContainer class is the base class for all objects that can serve
12
- * as display object containers on the display list.
13
- * This class itself does not contain any API for drawing content on the screen.
14
- * Therefore, if you want to create a custom subclass of the DisplayObject class,
15
- * you need to extend one of its subclasses that has an API for drawing content on the screen,
16
- * such as Sprite or MovieClip.
17
- *
18
- * @class
19
- * @memberOf next2d.display
20
- * @extends InteractiveObject
21
- */
22
- export class DisplayObjectContainer extends InteractiveObject {
23
- /**
24
- * @constructor
25
- * @public
26
- */
27
- constructor() {
28
- super();
29
- /**
30
- * @type {array}
31
- * @default null
32
- * @private
33
- */
34
- this._$placeMap = null;
35
- /**
36
- * @type {array}
37
- * @default null
38
- * @private
39
- */
40
- this._$placeObjects = null;
41
- /**
42
- * @type {array}
43
- * @default null
44
- * @private
45
- */
46
- this._$controller = null;
47
- /**
48
- * @type {array}
49
- * @default null
50
- * @private
51
- */
52
- this._$dictionary = null;
53
- /**
54
- * @type {array}
55
- * @private
56
- */
57
- this._$children = $getArray();
58
- /**
59
- * @type {boolean}
60
- * @default true
61
- * @private
62
- */
63
- this._$needsChildren = true;
64
- /**
65
- * @type {boolean}
66
- * @default true
67
- * @private
68
- */
69
- this._$mouseChildren = true;
70
- /**
71
- * @type {boolean}
72
- * @default true
73
- * @private
74
- */
75
- this._$wait = true;
76
- /**
77
- * @type {Map}
78
- * @private
79
- */
80
- this._$names = $getMap();
81
- return new Proxy(this, {
82
- "get": (object, name) => {
83
- if (object._$names.size && object._$names.has(name)) {
84
- return object._$names.get(name);
85
- }
86
- // @ts-ignore
87
- return object[name];
88
- }
89
- });
90
- }
91
- /**
92
- * @description オブジェクトの子がマウスまたはユーザー入力デバイスに対応しているかどうかを判断します。
93
- * Determine if the object's children are compatible with mouse or user input devices.
94
- *
95
- * @member {boolean}
96
- * @public
97
- */
98
- get mouseChildren() {
99
- return this._$mouseChildren;
100
- }
101
- set mouseChildren(mouse_children) {
102
- this._$mouseChildren = !!mouse_children;
103
- }
104
- /**
105
- * @description このオブジェクトの子の数を返します。
106
- * Returns the number of children of this object.
107
- *
108
- * @member {number}
109
- * @readonly
110
- * @public
111
- */
112
- get numChildren() {
113
- return this._$needsChildren
114
- ? this._$getChildren().length
115
- : this._$children.length;
116
- }
117
- /**
118
- * @description この DisplayObjectContainer インスタンスに子 DisplayObject インスタンスを追加します。
119
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance.
120
- *
121
- * @param {DisplayObject} child
122
- * @return {DisplayObject}
123
- * @method
124
- * @public
125
- */
126
- addChild(child) {
127
- if (child._$parent) {
128
- child._$parent._$remove(child, !(child._$parent._$instanceId === this._$instanceId));
129
- }
130
- this._$getChildren().push(child);
131
- if (child._$name) {
132
- this._$names.set(child._$name, child);
133
- }
134
- return this._$addChild(child);
135
- }
136
- /**
137
- * @description この DisplayObjectContainer インスタンスに子 DisplayObject インスタンスを追加します。
138
- * Adds a child DisplayObject instance to this DisplayObjectContainer instance.
139
- *
140
- * @param {DisplayObject} child
141
- * @param {number} index
142
- * @return {DisplayObject}
143
- * @method
144
- * @public
145
- */
146
- addChildAt(child, index) {
147
- if (child._$parent) {
148
- child._$parent._$remove(child, !(child._$parent._$instanceId === this._$instanceId));
149
- }
150
- const children = this._$getChildren();
151
- const length = children.length;
152
- if (0 > index || index > length) {
153
- throw new RangeError(`RangeError: addChildAt: index error: ${index}`);
154
- }
155
- if (length && length > index) {
156
- children.splice(index, 0, child);
157
- for (let idx = 0; idx < index; ++idx) {
158
- const instance = children[idx];
159
- if (instance._$name) {
160
- this._$names.set(instance._$name, instance);
161
- }
162
- }
163
- }
164
- else {
165
- children.push(child);
166
- if (child._$name) {
167
- this._$names.set(child._$name, child);
168
- }
169
- }
170
- return this._$addChild(child);
171
- }
172
- /**
173
- * @description 指定された表示オブジェクトが、DisplayObjectContainer インスタンスの子であるか
174
- * インスタンス自体であるかを指定します。
175
- * Determines whether the specified display object is a child
176
- * of the DisplayObjectContainer instance or the instance itself.
177
- *
178
- * @param {DisplayObject} child
179
- * @return {boolean}
180
- * @method
181
- * @public
182
- */
183
- contains(child) {
184
- if (this._$instanceId === child._$instanceId) {
185
- return true;
186
- }
187
- const children = this._$getChildren();
188
- for (let idx = 0; idx < children.length; ++idx) {
189
- const instance = children[idx];
190
- if (instance._$instanceId === child._$instanceId) {
191
- return true;
192
- }
193
- if (instance instanceof DisplayObjectContainer) {
194
- if (instance.contains(child)) {
195
- return true;
196
- }
197
- }
198
- }
199
- return false;
200
- }
201
- /**
202
- * @description 指定のインデックス位置にある子表示オブジェクトインスタンスを返します。
203
- * Returns the child display object instance that exists at the specified index.
204
- *
205
- * @param {number} index
206
- * @return {DisplayObject}
207
- * @method
208
- * @public
209
- */
210
- getChildAt(index) {
211
- const children = this._$getChildren();
212
- if (0 > index || index > children.length) {
213
- throw new RangeError(`RangeError: getChildAt: index error: ${index}`);
214
- }
215
- return index in children ? children[index] : null;
216
- }
217
- /**
218
- * @description 指定された名前に一致する子表示オブジェクトを返します。
219
- * Returns the child display object that exists with the specified name.
220
- *
221
- * @param {string} name
222
- * @return {{DisplayObject}|null}
223
- * @method
224
- * @public
225
- */
226
- getChildByName(name) {
227
- if (!name) {
228
- return null;
229
- }
230
- // fixed logic
231
- const children = this._$getChildren();
232
- for (let idx = 0; idx < children.length; ++idx) {
233
- const child = children[idx];
234
- if (child.name !== name) {
235
- continue;
236
- }
237
- return child;
238
- }
239
- return null;
240
- }
241
- /**
242
- * @description 子 DisplayObject インスタンスのインデックス位置を返します。
243
- * Returns the index position of a child DisplayObject instance.
244
- *
245
- * @param {DisplayObject} child
246
- * @return {number}
247
- * @method
248
- * @public
249
- */
250
- getChildIndex(child) {
251
- if (child._$parent !== this) {
252
- throw new Error("ArgumentError: getChildIndex: not child");
253
- }
254
- const index = this._$getChildren().indexOf(child);
255
- if (index === -1) {
256
- throw new Error("ArgumentError: getChildIndex: not found.");
257
- }
258
- return index;
259
- }
260
- /**
261
- * @description DisplayObjectContainer インスタンスの子リストから指定の
262
- * child DisplayObject インスタンスを削除します。
263
- * Removes the specified child DisplayObject instance from the
264
- * child list of the DisplayObjectContainer instance.
265
- *
266
- * @param {DisplayObject} child
267
- * @return {DisplayObject}
268
- * @method
269
- * @public
270
- */
271
- removeChild(child) {
272
- if (child._$parent !== this) {
273
- throw new Error("ArgumentError: removeChild: not child");
274
- }
275
- return this._$remove(child);
276
- }
277
- /**
278
- * @description DisplayObjectContainer の子リストの指定された index 位置から子 DisplayObject を削除します。
279
- * Removes a child DisplayObject from the specified index position
280
- * in the child list of the DisplayObjectContainer.
281
- *
282
- * @param {number} index
283
- * @return {DisplayObject}
284
- * @method
285
- * @public
286
- */
287
- removeChildAt(index) {
288
- return this._$remove(this.getChildAt(index));
289
- }
290
- /**
291
- * @description DisplayObjectContainer インスタンスの子リストから
292
- * すべての child DisplayObject インスタンスを削除します。
293
- * Removes all child DisplayObject instances from
294
- * the child list of the DisplayObjectContainer instance.
295
- *
296
- * @param {number} [begin_index=0]
297
- * @param {number} [end_index=0x7fffffff]
298
- * @return {void}
299
- * @method
300
- * @public
301
- */
302
- removeChildren(begin_index = 0, end_index = 0x7fffffff) {
303
- const children = this._$getChildren();
304
- if (!children.length) {
305
- return;
306
- }
307
- begin_index = $clamp(begin_index, 0, 0x7ffffffe, 0) - 1;
308
- end_index = $clamp(end_index, 1, 0x7ffffff, 0x7ffffff);
309
- for (let idx = $Math.min(end_index, children.length - 1); idx > begin_index; --idx) {
310
- this._$remove(children[idx]);
311
- }
312
- }
313
- /**
314
- * @description 表示オブジェクトコンテナの既存の子の位置を変更します。
315
- * Changes the position of an existing child in the display object container.
316
- *
317
- * @param {DisplayObject} child
318
- * @param {number} index
319
- * @return {void}
320
- * @method
321
- * @public
322
- */
323
- setChildIndex(child, index) {
324
- const currentIndex = this.getChildIndex(child);
325
- if (currentIndex === index) {
326
- return;
327
- }
328
- const children = this._$getChildren();
329
- children.splice(currentIndex, 1);
330
- children.splice(index, 0, child);
331
- if ($rendererWorker) {
332
- this._$postChildrenIds();
333
- }
334
- this._$doChanged();
335
- }
336
- /**
337
- * @description 指定された 2 つの子オブジェクトの z 順序(重ね順)を入れ替えます。
338
- * Swaps the z-order (front-to-back order) of the two specified child objects.
339
- *
340
- * @param {DisplayObject} child1
341
- * @param {DisplayObject} child2
342
- * @return {void}
343
- * @method
344
- * @public
345
- */
346
- swapChildren(child1, child2) {
347
- const children = this._$getChildren();
348
- const index1 = this.getChildIndex(child1);
349
- const index2 = this.getChildIndex(child2);
350
- children[index1] = child2;
351
- children[index2] = child1;
352
- if ($rendererWorker) {
353
- this._$postChildrenIds();
354
- }
355
- this._$doChanged();
356
- }
357
- /**
358
- * @description 子リスト内の指定されたインデックス位置に該当する 2 つの子オブジェクトの z 順序(重ね順)を入れ替えます。
359
- * Swaps the z-order (front-to-back order) of the child objects at
360
- * the two specified index positions in the child list.
361
- *
362
- * @param {number} index1
363
- * @param {number} index2
364
- * @return {void}
365
- * @method
366
- * @public
367
- */
368
- swapChildrenAt(index1, index2) {
369
- this.swapChildren(this.getChildAt(index1), this.getChildAt(index2));
370
- }
371
- /**
372
- * @param {array} [matrix=null]
373
- * @return {object}
374
- * @private
375
- */
376
- _$getBounds(matrix = null) {
377
- let multiMatrix = $MATRIX_ARRAY_IDENTITY;
378
- if (matrix) {
379
- multiMatrix = matrix;
380
- const rawMatrix = this._$transform._$rawMatrix();
381
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
382
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
383
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
384
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
385
- }
386
- }
387
- const children = this._$needsChildren
388
- ? this._$getChildren()
389
- : this._$children;
390
- // size zero
391
- if (!children.length) {
392
- const bounds = $getBoundsObject(multiMatrix[4], -multiMatrix[4], multiMatrix[5], -multiMatrix[5]);
393
- if (matrix && multiMatrix !== matrix) {
394
- $poolFloat32Array6(multiMatrix);
395
- }
396
- return bounds;
397
- }
398
- // data init
399
- const no = $Number.MAX_VALUE;
400
- let xMin = no;
401
- let xMax = -no;
402
- let yMin = no;
403
- let yMax = -no;
404
- for (let idx = 0; idx < children.length; ++idx) {
405
- const bounds = children[idx]._$getBounds(multiMatrix);
406
- xMin = $Math.min(xMin, bounds.xMin);
407
- xMax = $Math.max(xMax, bounds.xMax);
408
- yMin = $Math.min(yMin, bounds.yMin);
409
- yMax = $Math.max(yMax, bounds.yMax);
410
- $poolBoundsObject(bounds);
411
- }
412
- if (matrix && multiMatrix !== matrix) {
413
- $poolFloat32Array6(multiMatrix);
414
- }
415
- // end
416
- return $getBoundsObject(xMin, xMax, yMin, yMax);
417
- }
418
- /**
419
- * @param {Float32Array} multi_matrix
420
- * @return {object}
421
- * @private
422
- */
423
- _$getLayerBounds(multi_matrix) {
424
- const children = this._$needsChildren
425
- ? this._$getChildren()
426
- : this._$children;
427
- // size zero
428
- if (!children.length) {
429
- return $getBoundsObject(0, 0, 0, 0);
430
- }
431
- // data init
432
- const no = $Number.MAX_VALUE;
433
- let xMin = no;
434
- let xMax = -no;
435
- let yMin = no;
436
- let yMax = -no;
437
- for (let idx = 0; idx < children.length; ++idx) {
438
- const instance = children[idx];
439
- let multiMatrix = multi_matrix;
440
- const rawMatrix = instance._$transform._$rawMatrix();
441
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
442
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
443
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
444
- multiMatrix = $multiplicationMatrix(multi_matrix, rawMatrix);
445
- }
446
- const bounds = instance._$getLayerBounds(multiMatrix);
447
- xMin = $Math.min(xMin, bounds.xMin);
448
- xMax = $Math.max(xMax, bounds.xMax);
449
- yMin = $Math.min(yMin, bounds.yMin);
450
- yMax = $Math.max(yMax, bounds.yMax);
451
- $poolBoundsObject(bounds);
452
- if (multiMatrix !== multi_matrix) {
453
- $poolFloat32Array6(multiMatrix);
454
- }
455
- }
456
- const filters = this._$filters || this.filters;
457
- if (!filters.length) {
458
- return $getBoundsObject(xMin, xMax, yMin, yMax);
459
- }
460
- let filterBounds = $getBoundsObject(0, xMax - xMin, 0, yMax - yMin);
461
- let xScale = +$Math.sqrt(multi_matrix[0] * multi_matrix[0]
462
- + multi_matrix[1] * multi_matrix[1]);
463
- let yScale = +$Math.sqrt(multi_matrix[2] * multi_matrix[2]
464
- + multi_matrix[3] * multi_matrix[3]);
465
- xScale /= $devicePixelRatio;
466
- yScale /= $devicePixelRatio;
467
- xScale *= 2;
468
- yScale *= 2;
469
- for (let idx = 0; idx < filters.length; ++idx) {
470
- filterBounds = filters[idx]
471
- ._$generateFilterRect(filterBounds, xScale, yScale);
472
- }
473
- xMax += filterBounds.xMax - (xMax - xMin);
474
- yMax += filterBounds.yMax - (yMax - yMin);
475
- xMin += filterBounds.xMin;
476
- yMin += filterBounds.yMin;
477
- $poolBoundsObject(filterBounds);
478
- return $getBoundsObject(xMin, xMax, yMin, yMax);
479
- }
480
- /**
481
- * @return {array}
482
- * @private
483
- */
484
- _$getChildren() {
485
- if (this._$needsChildren) {
486
- // set flag
487
- this._$needsChildren = false;
488
- const currentChildren = this._$children;
489
- if (!this._$controller) {
490
- return currentChildren;
491
- }
492
- const frame = "_$currentFrame" in this ? this._$currentFrame : 1;
493
- const controller = this._$controller[frame];
494
- // first build
495
- if (!currentChildren.length) {
496
- if (controller) {
497
- for (let idx = 0; idx < controller.length; ++idx) {
498
- const dictionaryId = controller[idx];
499
- if (typeof dictionaryId !== "number") {
500
- continue;
501
- }
502
- const instance = this._$createInstance(dictionaryId);
503
- instance._$placeId = idx;
504
- const loopConfig = instance.loopConfig;
505
- if (loopConfig) {
506
- instance._$currentFrame = instance
507
- ._$getLoopFrame(loopConfig);
508
- }
509
- currentChildren.push(instance);
510
- if (instance._$name) {
511
- this._$names.set(instance._$name, instance);
512
- }
513
- }
514
- }
515
- return currentChildren;
516
- }
517
- const useWorker = !!$rendererWorker && !!this._$stage;
518
- const skipIds = $getMap();
519
- const poolInstances = $getMap();
520
- let depth = 0;
521
- const children = $getArray();
522
- for (let idx = 0; idx < currentChildren.length; ++idx) {
523
- const instance = currentChildren[idx];
524
- const parent = instance._$parent;
525
- if (!parent || parent._$instanceId !== this._$instanceId) {
526
- continue;
527
- }
528
- const instanceId = instance._$instanceId;
529
- const startFrame = instance._$startFrame;
530
- const endFrame = instance._$endFrame;
531
- if (startFrame === 1 && endFrame === 0
532
- || startFrame <= frame && endFrame > frame) {
533
- // reset
534
- instance._$isNext = true;
535
- instance._$placeObject = null;
536
- instance._$filters = null;
537
- instance._$blendMode = null;
538
- if (instance._$id === -1) {
539
- children.push(instance);
540
- if (instance._$name) {
541
- this._$names.set(instance._$name, instance);
542
- }
543
- continue;
544
- }
545
- const id = controller[depth];
546
- if (instance._$id === id) {
547
- instance._$placeId = depth;
548
- children.push(instance);
549
- if (instance._$name) {
550
- this._$names.set(instance._$name, instance);
551
- }
552
- if (poolInstances.has(id)) {
553
- poolInstances.delete(id);
554
- }
555
- skipIds.set(id, true);
556
- depth++;
557
- if (useWorker) {
558
- instance._$postProperty();
559
- }
560
- continue;
561
- }
562
- poolInstances.set(instance._$id, instance);
563
- continue;
564
- }
565
- if (useWorker) {
566
- instance._$removeWorkerInstance();
567
- }
568
- $cacheStore.setRemoveTimer(instanceId);
569
- if (instance._$loaderInfo && instance._$characterId) {
570
- $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
571
- }
572
- if (instance._$graphics) {
573
- $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
574
- }
575
- // remove event
576
- if (instance.willTrigger(Next2DEvent.REMOVED)) {
577
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
578
- }
579
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
580
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE, true));
581
- }
582
- // reset
583
- instance._$added = false;
584
- instance._$addedStage = false;
585
- instance._$active = false;
586
- instance._$updated = true;
587
- instance._$filters = null;
588
- instance._$blendMode = null;
589
- instance._$isNext = true;
590
- instance._$placeObject = null;
591
- instance._$created = false;
592
- instance._$posted = false;
593
- if (instance instanceof DisplayObjectContainer) {
594
- instance._$executeRemovedFromStage();
595
- instance._$removeParentAndStage();
596
- }
597
- }
598
- if (controller) {
599
- for (let idx = 0; idx < controller.length; ++idx) {
600
- const dictionaryId = controller[idx];
601
- if (typeof dictionaryId !== "number" || skipIds.has(dictionaryId)) {
602
- continue;
603
- }
604
- const instance = poolInstances.has(dictionaryId)
605
- ? poolInstances.get(dictionaryId)
606
- : this._$createInstance(dictionaryId);
607
- instance._$placeId = idx;
608
- const loopConfig = instance.loopConfig;
609
- if (loopConfig) {
610
- instance._$currentFrame = instance
611
- ._$getLoopFrame(loopConfig);
612
- }
613
- children.push(instance);
614
- if (instance._$name) {
615
- this._$names.set(instance._$name, instance);
616
- }
617
- }
618
- }
619
- // object pool
620
- $poolMap(skipIds);
621
- $poolMap(poolInstances);
622
- // update
623
- currentChildren.length = 0;
624
- currentChildren.push(...children);
625
- $poolArray(children);
626
- }
627
- return this._$children;
628
- }
629
- /**
630
- * @return void
631
- * @private
632
- */
633
- _$clearChildren() {
634
- this._$doChanged();
635
- $doUpdated();
636
- // reset
637
- this._$names.clear();
638
- // clear
639
- this._$needsChildren = true;
640
- }
641
- /**
642
- * @param {DisplayObject} child
643
- * @returns {DisplayObject}
644
- * @private
645
- */
646
- _$addChild(child) {
647
- // init
648
- child._$parent = this;
649
- if (!child._$stage || !child._$root) {
650
- child._$stage = this._$stage;
651
- child._$root = this._$root;
652
- }
653
- // setup
654
- if (child instanceof DisplayObjectContainer) {
655
- child._$setParentAndStage();
656
- child._$wait = true;
657
- }
658
- // added event
659
- if (!child._$added) {
660
- if (child.willTrigger(Next2DEvent.ADDED)) {
661
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED, true));
662
- }
663
- child._$added = true;
664
- }
665
- if (this._$stage !== null && !child._$addedStage) {
666
- if (child.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
667
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
668
- }
669
- child._$addedStage = true;
670
- // set params
671
- if (child instanceof DisplayObjectContainer) {
672
- child._$executeAddedToStage();
673
- }
674
- if ($rendererWorker) {
675
- child._$createWorkerInstance();
676
- this._$postChildrenIds();
677
- }
678
- }
679
- this._$doChanged();
680
- child._$active = true;
681
- child._$updated = true;
682
- child._$isNext = true;
683
- return child;
684
- }
685
- /**
686
- * @return {void}
687
- * @method
688
- * @private
689
- */
690
- _$setParentAndStage() {
691
- const children = this._$needsChildren
692
- ? this._$getChildren()
693
- : this._$children;
694
- for (let idx = 0; idx < children.length; ++idx) {
695
- const instance = children[idx];
696
- instance._$root = this._$root;
697
- instance._$stage = this._$stage;
698
- if (instance instanceof DisplayObjectContainer) {
699
- instance._$setParentAndStage();
700
- instance._$wait = true;
701
- }
702
- }
703
- }
704
- /**
705
- * @return {void}
706
- * @method
707
- * @private
708
- */
709
- _$executeAddedToStage() {
710
- const children = this._$needsChildren
711
- ? this._$getChildren()
712
- : this._$children;
713
- const childrenIds = $getArray();
714
- for (let idx = 0; idx < children.length; ++idx) {
715
- const instance = children[idx];
716
- if (!instance) {
717
- continue;
718
- }
719
- childrenIds.push(instance._$instanceId);
720
- if (!instance._$addedStage) {
721
- if ($rendererWorker) {
722
- instance._$createWorkerInstance();
723
- }
724
- if (instance.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
725
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
726
- }
727
- instance._$addedStage = true;
728
- }
729
- if (instance instanceof DisplayObjectContainer) {
730
- instance._$executeAddedToStage();
731
- }
732
- }
733
- if ($rendererWorker) {
734
- this._$postChildrenIds(childrenIds);
735
- }
736
- $poolArray(childrenIds);
737
- }
738
- /**
739
- * @param {DisplayObject} child
740
- * @param {boolean} do_event
741
- * @return {DisplayObject}
742
- * @private
743
- */
744
- _$remove(child, do_event = true) {
745
- child._$transform._$transform();
746
- // remove all broadcast events
747
- if (child.hasEventListener(Next2DEvent.ENTER_FRAME)) {
748
- child.removeAllEventListener(Next2DEvent.ENTER_FRAME);
749
- }
750
- if (child.hasEventListener(Next2DEvent.EXIT_FRAME)) {
751
- child.removeAllEventListener(Next2DEvent.EXIT_FRAME);
752
- }
753
- if (child.hasEventListener(Next2DEvent.FRAME_CONSTRUCTED)) {
754
- child.removeAllEventListener(Next2DEvent.FRAME_CONSTRUCTED);
755
- }
756
- if (child.hasEventListener(Next2DEvent.RENDER)) {
757
- child.removeAllEventListener(Next2DEvent.RENDER);
758
- }
759
- if (child.hasEventListener(Next2DEvent.ACTIVATE)) {
760
- child.removeAllEventListener(Next2DEvent.ACTIVATE);
761
- }
762
- if (child.hasEventListener(Next2DEvent.DEACTIVATE)) {
763
- child.removeAllEventListener(Next2DEvent.DEACTIVATE);
764
- }
765
- if (child.hasEventListener("keyDown")) {
766
- child.removeAllEventListener("keyDown");
767
- }
768
- if (child.hasEventListener("keyUp")) {
769
- child.removeAllEventListener("keyUp");
770
- }
771
- // remove
772
- const children = this._$needsChildren
773
- ? this._$getChildren()
774
- : this._$children;
775
- const depth = this.getChildIndex(child);
776
- children.splice(depth, 1);
777
- this._$names.delete(child.name);
778
- if (do_event) {
779
- // event
780
- if (child.willTrigger(Next2DEvent.REMOVED)) {
781
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
782
- }
783
- // remove stage event
784
- if (this._$stage !== null) {
785
- // worker側のDisplayObjectも削除
786
- if ($rendererWorker) {
787
- child._$removeWorkerInstance();
788
- this._$postChildrenIds();
789
- }
790
- if (child.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
791
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
792
- }
793
- if (child instanceof DisplayObjectContainer) {
794
- child._$executeRemovedFromStage();
795
- }
796
- }
797
- $cacheStore.setRemoveTimer(child._$instanceId);
798
- if (child._$loaderInfo && child._$characterId) {
799
- $cacheStore.setRemoveTimer(`${child._$loaderInfo._$id}@${child._$characterId}`);
800
- }
801
- if (child._$graphics) {
802
- $cacheStore.setRemoveTimer(child._$graphics._$uniqueKey);
803
- }
804
- // reset params
805
- if (child instanceof DisplayObjectContainer) {
806
- child._$removeParentAndStage();
807
- }
808
- // reset
809
- child._$stage = null;
810
- child._$parent = null;
811
- child._$root = null;
812
- child._$active = false;
813
- child._$wait = true;
814
- child._$updated = true;
815
- child._$added = false;
816
- child._$addedStage = false;
817
- child._$created = false;
818
- child._$posted = false;
819
- this._$doChanged();
820
- }
821
- return child;
822
- }
823
- /**
824
- * @return {void}
825
- * @method
826
- * @private
827
- */
828
- _$executeRemovedFromStage() {
829
- const children = this._$getChildren().slice(0);
830
- for (let idx = 0; idx < children.length; ++idx) {
831
- const instance = children[idx];
832
- if (!instance) {
833
- continue;
834
- }
835
- if (instance._$addedStage) {
836
- // workerのDisplayObjectを削除
837
- if ($rendererWorker) {
838
- instance._$removeWorkerInstance();
839
- }
840
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
841
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
842
- }
843
- instance._$created = false;
844
- instance._$posted = false;
845
- instance._$addedStage = false;
846
- }
847
- if (instance instanceof DisplayObjectContainer) {
848
- instance._$executeRemovedFromStage();
849
- }
850
- }
851
- }
852
- /**
853
- * @return {void}
854
- * @method
855
- * @private
856
- */
857
- _$removeParentAndStage() {
858
- const children = this._$needsChildren
859
- ? this._$getChildren()
860
- : this._$children;
861
- for (let idx = 0; idx < children.length; ++idx) {
862
- const instance = children[idx];
863
- $cacheStore.setRemoveTimer(instance._$instanceId);
864
- if (instance._$loaderInfo && instance._$characterId) {
865
- $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
866
- }
867
- if (instance._$graphics) {
868
- $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
869
- }
870
- if (instance instanceof DisplayObjectContainer) {
871
- instance._$removeParentAndStage();
872
- }
873
- instance._$stage = null;
874
- instance._$root = null;
875
- instance._$addedStage = false;
876
- }
877
- if ("_$sounds" in this) {
878
- const soundsMap = this._$sounds;
879
- if (soundsMap.size) {
880
- for (const sounds of soundsMap.values()) {
881
- for (let idx = 0; idx < sounds.length; ++idx) {
882
- const sound = sounds[idx];
883
- sound.stop();
884
- }
885
- }
886
- }
887
- }
888
- this._$needsChildren = true;
889
- }
890
- /**
891
- * @return {void}
892
- * @method
893
- * @private
894
- */
895
- _$prepareActions() {
896
- const children = this._$needsChildren
897
- ? this._$getChildren()
898
- : this._$children;
899
- for (let idx = children.length - 1; idx > -1; --idx) {
900
- children[idx]._$prepareActions();
901
- }
902
- // added event
903
- this._$executeAddedEvent();
904
- }
905
- /**
906
- * @return {boolean}
907
- * @method
908
- * @private
909
- */
910
- _$nextFrame() {
911
- let isNext = false;
912
- const children = this._$getChildren();
913
- for (let idx = children.length - 1; idx > -1; --idx) {
914
- const child = children[idx];
915
- if (!child._$isNext) {
916
- continue;
917
- }
918
- if (isNext) {
919
- child._$nextFrame();
920
- }
921
- else {
922
- isNext = child._$nextFrame();
923
- }
924
- }
925
- // added event
926
- this._$executeAddedEvent();
927
- this._$isNext = isNext;
928
- if (!this._$posted && $rendererWorker) {
929
- this._$postProperty();
930
- }
931
- return this._$isNext;
932
- }
933
- /**
934
- * @param {CanvasToWebGLContext} context
935
- * @param {Float32Array} matrix
936
- * @return {void}
937
- * @method
938
- * @private
939
- */
940
- _$clip(context, matrix) {
941
- let multiMatrix = matrix;
942
- const rawMatrix = this._$transform._$rawMatrix();
943
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
944
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
945
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
946
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
947
- }
948
- const children = this._$getChildren();
949
- for (let idx = 0; idx < children.length; ++idx) {
950
- const instance = children[idx];
951
- // mask instance
952
- if (instance._$isMask) {
953
- continue;
954
- }
955
- instance._$clip(context, multiMatrix);
956
- instance._$updated = false;
957
- }
958
- if (multiMatrix !== matrix) {
959
- $poolFloat32Array6(multiMatrix);
960
- }
961
- }
962
- /**
963
- * @param {CanvasToWebGLContext} context
964
- * @param {Float32Array} matrix
965
- * @return {object}
966
- * @private
967
- */
968
- _$preDraw(context, matrix) {
969
- let multiMatrix = matrix;
970
- const rawMatrix = this._$transform._$rawMatrix();
971
- if (rawMatrix !== $MATRIX_HIT_ARRAY_IDENTITY
972
- && rawMatrix[0] !== 1 || rawMatrix[1] !== 0
973
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
974
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
975
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
976
- }
977
- // size zero
978
- if (!multiMatrix[0] && !multiMatrix[1]
979
- || !multiMatrix[2] && !multiMatrix[3]) {
980
- if (multiMatrix !== matrix) {
981
- $poolFloat32Array6(multiMatrix);
982
- }
983
- return null;
984
- }
985
- // return object
986
- const object = $getPreObject();
987
- // setup
988
- object.matrix = multiMatrix;
989
- // check
990
- const filters = this._$filters || this.filters;
991
- const blendMode = this._$blendMode || this.blendMode;
992
- if (filters.length > 0 || blendMode !== "normal") {
993
- // check size
994
- const baseBounds = this._$getBounds(null);
995
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
996
- $poolBoundsObject(baseBounds);
997
- const xMax = +bounds.xMax;
998
- const xMin = +bounds.xMin;
999
- const yMax = +bounds.yMax;
1000
- const yMin = +bounds.yMin;
1001
- $poolBoundsObject(bounds);
1002
- const width = $Math.ceil($Math.abs(xMax - xMin));
1003
- const height = $Math.ceil($Math.abs(yMax - yMin));
1004
- if (0 >= width || 0 >= height) {
1005
- $poolPreObject(object);
1006
- if (multiMatrix !== matrix) {
1007
- $poolFloat32Array6(multiMatrix);
1008
- }
1009
- return null;
1010
- }
1011
- let xScale = +$Math.sqrt(multiMatrix[0] * multiMatrix[0]
1012
- + multiMatrix[1] * multiMatrix[1]);
1013
- if (!$Number.isInteger(xScale)) {
1014
- const value = xScale.toString();
1015
- const index = value.indexOf("e");
1016
- if (index !== -1) {
1017
- xScale = +value.slice(0, index);
1018
- }
1019
- xScale = +xScale.toFixed(4);
1020
- }
1021
- let yScale = +$Math.sqrt(multiMatrix[2] * multiMatrix[2]
1022
- + multiMatrix[3] * multiMatrix[3]);
1023
- if (!$Number.isInteger(yScale)) {
1024
- const value = yScale.toString();
1025
- const index = value.indexOf("e");
1026
- if (index !== -1) {
1027
- yScale = +value.slice(0, index);
1028
- }
1029
- yScale = +yScale.toFixed(4);
1030
- }
1031
- object.canApply = this._$canApply(filters);
1032
- let filterBounds = $getBoundsObject(0, width, 0, height);
1033
- if (object.canApply && filters) {
1034
- for (let idx = 0; idx < filters.length; ++idx) {
1035
- filterBounds = filters[idx]
1036
- ._$generateFilterRect(filterBounds, xScale, yScale);
1037
- }
1038
- }
1039
- const currentAttachment = context
1040
- .frameBuffer
1041
- .currentAttachment;
1042
- if (!currentAttachment
1043
- || !currentAttachment.texture
1044
- || xMin - filterBounds.xMin > currentAttachment.width
1045
- || yMin - filterBounds.yMin > currentAttachment.height) {
1046
- $poolBoundsObject(filterBounds);
1047
- $poolPreObject(object);
1048
- if (multiMatrix !== matrix) {
1049
- $poolFloat32Array6(multiMatrix);
1050
- }
1051
- return null;
1052
- }
1053
- if (0 > xMin + filterBounds.xMax || 0 > yMin + filterBounds.yMax) {
1054
- $poolBoundsObject(filterBounds);
1055
- $poolPreObject(object);
1056
- if (multiMatrix !== matrix) {
1057
- $poolFloat32Array6(multiMatrix);
1058
- }
1059
- return null;
1060
- }
1061
- // move size
1062
- let tx = multiMatrix[4] - xMin;
1063
- let ty = multiMatrix[5] - yMin;
1064
- // start layer
1065
- context._$startLayer($getBoundsObject(xMin, xMax, yMin, yMax));
1066
- // check cache
1067
- const updated = this._$isFilterUpdated(multiMatrix, filters, object.canApply);
1068
- const layerBounds = this._$getLayerBounds(multiMatrix);
1069
- const layerWidth = $Math.ceil($Math.abs(layerBounds.xMax - layerBounds.xMin));
1070
- const layerHeight = $Math.ceil($Math.abs(layerBounds.yMax - layerBounds.yMin));
1071
- $poolBoundsObject(layerBounds);
1072
- const sw = layerWidth - filterBounds.xMax + filterBounds.xMin;
1073
- const sh = layerHeight - filterBounds.yMax + filterBounds.yMin;
1074
- tx += sw;
1075
- ty += sh;
1076
- object.sw = sw;
1077
- object.sh = sh;
1078
- if (updated) {
1079
- context._$saveAttachment($Math.ceil(width + sw), $Math.ceil(height + sh), true);
1080
- }
1081
- // setup
1082
- object.isLayer = true;
1083
- object.isUpdated = updated;
1084
- object.filters = filters;
1085
- object.blendMode = blendMode;
1086
- object.color = $getFloat32Array8();
1087
- object.matrix = $getFloat32Array6(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], tx, ty);
1088
- if (multiMatrix !== matrix) {
1089
- $poolFloat32Array6(multiMatrix);
1090
- }
1091
- $poolBoundsObject(filterBounds);
1092
- }
1093
- return object;
1094
- }
1095
- /**
1096
- * @param {CanvasToWebGLContext} context
1097
- * @param {Float32Array} matrix
1098
- * @param {Float32Array} color_transform
1099
- * @param {object} object
1100
- * @return {void}
1101
- * @method
1102
- * @private
1103
- */
1104
- _$postDraw(context, matrix, color_transform, object) {
1105
- context.drawInstacedArray();
1106
- // cache
1107
- const cacheKeys = $getArray(this._$instanceId, "f");
1108
- const manager = context.frameBuffer;
1109
- const multiMatrix = object.matrix;
1110
- let offsetX = 0;
1111
- let offsetY = 0;
1112
- let texture = $cacheStore.get(cacheKeys);
1113
- if (!texture || object.isUpdated) {
1114
- // remove
1115
- if (texture) {
1116
- $cacheStore.set(cacheKeys, null);
1117
- }
1118
- texture = manager
1119
- .getTextureFromCurrentAttachment();
1120
- const filters = object.filters;
1121
- let filterState = false;
1122
- if (filters && filters.length) {
1123
- for (let idx = 0; idx < filters.length; ++idx) {
1124
- texture = filters[idx]
1125
- ._$applyFilter(context, matrix);
1126
- }
1127
- // update
1128
- filterState = true;
1129
- offsetX = context._$offsetX;
1130
- offsetY = context._$offsetY;
1131
- // reset
1132
- context._$offsetX = 0;
1133
- context._$offsetY = 0;
1134
- }
1135
- texture.filterState = filterState;
1136
- texture.matrix = `${multiMatrix[0]}_`
1137
- + `${multiMatrix[1]}_`
1138
- + `${multiMatrix[2]}_`
1139
- + `${multiMatrix[3]}`;
1140
- texture.offsetX = offsetX;
1141
- texture.offsetY = offsetY;
1142
- $cacheStore.set(cacheKeys, texture);
1143
- context._$restoreAttachment();
1144
- }
1145
- if (texture.offsetX) {
1146
- offsetX = texture.offsetX;
1147
- }
1148
- if (texture.offsetY) {
1149
- offsetY = texture.offsetY;
1150
- }
1151
- // set
1152
- context.reset();
1153
- context.globalAlpha = $clamp(color_transform[3] + color_transform[7] / 255, 0, 1);
1154
- context.globalCompositeOperation = object.blendMode;
1155
- const bounds = context.getCurrentPosition();
1156
- context.setTransform(1, 0, 0, 1, bounds.xMin - offsetX - object.sw, bounds.yMin - offsetY - object.sh);
1157
- context.drawImage(texture, 0, 0, texture.width, texture.height, color_transform);
1158
- // end blend
1159
- context._$endLayer();
1160
- // object pool
1161
- $poolFloat32Array6(object.matrix);
1162
- $poolPreObject(object);
1163
- // reset
1164
- context.cachePosition = null;
1165
- }
1166
- /**
1167
- * @param {CanvasToWebGLContext} context
1168
- * @param {Float32Array} matrix
1169
- * @param {Float32Array} color_transform
1170
- * @return {void}
1171
- * @method
1172
- * @private
1173
- */
1174
- _$draw(context, matrix, color_transform) {
1175
- // not draw
1176
- if (!this._$visible) {
1177
- return;
1178
- }
1179
- const transform = this._$transform;
1180
- let multiColor = color_transform;
1181
- const rawColor = transform._$rawColorTransform();
1182
- if (rawColor !== $COLOR_ARRAY_IDENTITY
1183
- && rawColor[0] !== 1 || rawColor[1] !== 1
1184
- || rawColor[2] !== 1 || rawColor[3] !== 1
1185
- || rawColor[4] !== 0 || rawColor[5] !== 0
1186
- || rawColor[6] !== 0 || rawColor[7] !== 0) {
1187
- multiColor = $multiplicationColor(color_transform, rawColor);
1188
- }
1189
- // not draw
1190
- const alpha = $clamp(multiColor[3] + multiColor[7] / 255, 0, 1, 0);
1191
- if (!alpha) {
1192
- return;
1193
- }
1194
- // not draw
1195
- const children = this._$getChildren();
1196
- const length = children.length;
1197
- if (!length) {
1198
- return;
1199
- }
1200
- // pre data
1201
- const preObject = this._$preDraw(context, matrix);
1202
- if (!preObject) {
1203
- return;
1204
- }
1205
- // use cache
1206
- if (preObject.isLayer && !preObject.isUpdated) {
1207
- this._$postDraw(context, matrix, multiColor, preObject);
1208
- return;
1209
- }
1210
- const preMatrix = preObject.matrix;
1211
- const preColorTransform = preObject.isLayer && preObject.color
1212
- ? preObject.color
1213
- : multiColor;
1214
- // init clip params
1215
- let shouldClip = true;
1216
- let clipDepth = 0;
1217
- const player = $currentPlayer();
1218
- // draw children
1219
- const isLayer = context.isLayer;
1220
- const isUpdate = this._$isUpdated();
1221
- for (let idx = 0; idx < length; ++idx) {
1222
- const instance = children[idx];
1223
- if (isUpdate) {
1224
- instance._$placeObject = null;
1225
- }
1226
- // mask instance
1227
- if (instance._$isMask) {
1228
- continue;
1229
- }
1230
- // not layer mode
1231
- const blendMode = instance._$blendMode || instance.blendMode;
1232
- if ((blendMode === "alpha" || blendMode === "erase")
1233
- && !isLayer) {
1234
- continue;
1235
- }
1236
- // mask end
1237
- if (clipDepth
1238
- && (instance._$placeId > clipDepth || instance._$clipDepth > 0)) {
1239
- context.restore();
1240
- if (shouldClip) {
1241
- context._$leaveClip();
1242
- }
1243
- // clear
1244
- clipDepth = 0;
1245
- shouldClip = true;
1246
- }
1247
- // mask size 0
1248
- if (!shouldClip) {
1249
- continue;
1250
- }
1251
- // mask start
1252
- if (instance._$clipDepth > 0) {
1253
- clipDepth = instance._$clipDepth;
1254
- shouldClip = instance._$shouldClip(preMatrix);
1255
- if (shouldClip) {
1256
- context.save();
1257
- shouldClip = instance._$startClip(context, preMatrix);
1258
- }
1259
- continue;
1260
- }
1261
- // mask start
1262
- const maskInstance = instance._$mask;
1263
- if (maskInstance) {
1264
- maskInstance._$updated = false;
1265
- let maskMatrix;
1266
- if (this === maskInstance._$parent) {
1267
- maskMatrix = preMatrix;
1268
- }
1269
- else {
1270
- maskMatrix = $MATRIX_ARRAY_IDENTITY;
1271
- let parent = maskInstance._$parent;
1272
- while (parent) {
1273
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1274
- parent = parent._$parent;
1275
- }
1276
- const mScale = player.scaleX;
1277
- const playerMatrix = $getFloat32Array6(mScale, 0, 0, mScale, 0, 0);
1278
- maskMatrix = $multiplicationMatrix(playerMatrix, maskMatrix);
1279
- $poolFloat32Array6(playerMatrix);
1280
- if (context.isLayer) {
1281
- const currentPosition = context.getCurrentPosition();
1282
- maskMatrix[4] -= currentPosition.xMin;
1283
- maskMatrix[5] -= currentPosition.yMin;
1284
- }
1285
- }
1286
- if (!maskInstance._$shouldClip(maskMatrix)) {
1287
- continue;
1288
- }
1289
- const result = maskInstance._$startClip(context, maskMatrix);
1290
- context.save();
1291
- if (!result) { // fixed
1292
- context.restore();
1293
- continue;
1294
- }
1295
- }
1296
- instance._$draw(context, preMatrix, preColorTransform);
1297
- instance._$updated = false;
1298
- // mask end
1299
- if (maskInstance) {
1300
- context.restore();
1301
- context._$leaveClip();
1302
- }
1303
- }
1304
- // end mask
1305
- if (clipDepth) {
1306
- context.restore();
1307
- if (shouldClip) {
1308
- context._$leaveClip();
1309
- }
1310
- }
1311
- // filter and blend
1312
- if (preObject.isLayer) {
1313
- return this._$postDraw(context, matrix, multiColor, preObject);
1314
- }
1315
- if (preObject.matrix !== matrix) {
1316
- $poolFloat32Array6(preObject.matrix);
1317
- }
1318
- if (multiColor !== color_transform) {
1319
- $poolFloat32Array8(multiColor);
1320
- }
1321
- $poolPreObject(preObject);
1322
- }
1323
- /**
1324
- * @param {CanvasRenderingContext2D} context
1325
- * @param {Float32Array} matrix
1326
- * @param {object} options
1327
- * @param {boolean} [mouse_children=true]
1328
- * @return {boolean}
1329
- * @method
1330
- * @private
1331
- */
1332
- _$mouseHit(context, matrix, options, mouse_children = true) {
1333
- let multiMatrix = matrix;
1334
- const rawMatrix = this._$transform._$rawMatrix();
1335
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1336
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1337
- }
1338
- const children = this._$getChildren();
1339
- // mask set
1340
- const clips = $getArray();
1341
- const targets = $getArray();
1342
- const clipIndexes = $getMap();
1343
- let clipDepth = 0;
1344
- let clipIdx = 0;
1345
- for (let idx = 0; idx < children.length; ++idx) {
1346
- const instance = children[idx];
1347
- if (!instance._$visible && !instance._$hitObject) {
1348
- continue;
1349
- }
1350
- if (instance._$clipDepth) {
1351
- clipIdx = clips.length;
1352
- clipDepth = instance._$clipDepth;
1353
- clips.push(instance);
1354
- continue;
1355
- }
1356
- // clip end
1357
- if (clipDepth && instance._$placeId > clipDepth) {
1358
- clipIdx = 0;
1359
- clipDepth = 0;
1360
- }
1361
- // clip check on
1362
- if (clipIdx) {
1363
- clipIndexes.set(instance._$instanceId, clipIdx);
1364
- }
1365
- targets.push(instance);
1366
- }
1367
- // setup
1368
- const mouseChildren = this._$mouseChildren && mouse_children;
1369
- let hit = false;
1370
- const isRoot = this._$root === this;
1371
- while (targets.length) {
1372
- const instance = targets.pop();
1373
- if (instance._$isMask) {
1374
- continue;
1375
- }
1376
- if (isRoot && !(instance instanceof InteractiveObject)) {
1377
- continue;
1378
- }
1379
- // mask target
1380
- if (clipIndexes.has(instance._$instanceId)) {
1381
- const index = clipIndexes.get(instance._$instanceId);
1382
- if (!index) {
1383
- continue;
1384
- }
1385
- const clip = clips[index];
1386
- if (!clip._$hit(context, multiMatrix, options, true)) {
1387
- continue;
1388
- }
1389
- }
1390
- // mask hit test
1391
- const maskInstance = instance._$mask;
1392
- if (maskInstance) {
1393
- if (this === maskInstance._$parent) {
1394
- if (!maskInstance._$hit(context, multiMatrix, options, true)) {
1395
- continue;
1396
- }
1397
- }
1398
- else {
1399
- let maskMatrix = $MATRIX_ARRAY_IDENTITY;
1400
- let parent = maskInstance._$parent;
1401
- while (parent) {
1402
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1403
- parent = parent._$parent;
1404
- }
1405
- if (!maskInstance._$hit(context, maskMatrix, options, true)) {
1406
- continue;
1407
- }
1408
- }
1409
- }
1410
- if (instance._$mouseHit(context, multiMatrix, options, mouseChildren)
1411
- || instance._$hitArea
1412
- && instance
1413
- ._$hitArea
1414
- ._$mouseHit(context, multiMatrix, options, mouseChildren)) {
1415
- if (instance._$root === instance) {
1416
- return true;
1417
- }
1418
- if (!mouseChildren) {
1419
- return true;
1420
- }
1421
- hit = true;
1422
- if (instance instanceof InteractiveObject) {
1423
- if (!instance.mouseEnabled && !instance._$hitObject) {
1424
- continue;
1425
- }
1426
- if (!$isTouch && !options.pointer) {
1427
- if ("_$text" in instance
1428
- && "type" in instance
1429
- && instance.type === "input") {
1430
- options.pointer = "text";
1431
- }
1432
- if ("buttonMode" in instance
1433
- && "useHandCursor" in instance
1434
- && instance.buttonMode
1435
- && instance.useHandCursor) {
1436
- options.pointer = "pointer";
1437
- }
1438
- }
1439
- if (!options.hit) {
1440
- options.hit = !instance.mouseEnabled && instance._$hitObject
1441
- ? instance._$hitObject
1442
- : instance;
1443
- }
1444
- return true;
1445
- }
1446
- }
1447
- }
1448
- // pool
1449
- $poolArray(clips);
1450
- $poolArray(targets);
1451
- $poolMap(clipIndexes);
1452
- if (multiMatrix !== matrix) {
1453
- $poolFloat32Array6(multiMatrix);
1454
- }
1455
- // not found
1456
- return hit;
1457
- }
1458
- /**
1459
- * @param {CanvasRenderingContext2D} context
1460
- * @param {Float32Array} matrix
1461
- * @param {object} options
1462
- * @param {boolean} [is_clip=false]
1463
- * @return {boolean}
1464
- * @method
1465
- * @private
1466
- */
1467
- _$hit(context, matrix, options, is_clip = false) {
1468
- let multiMatrix = matrix;
1469
- const rawMatrix = this._$transform._$rawMatrix();
1470
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1471
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1472
- }
1473
- const children = this._$getChildren();
1474
- for (let idx = children.length; idx > -1; --idx) {
1475
- const instance = children[idx];
1476
- if (instance._$isMask) {
1477
- continue;
1478
- }
1479
- if (instance._$hit(context, multiMatrix, options, is_clip)) {
1480
- return true;
1481
- }
1482
- }
1483
- if (multiMatrix !== matrix) {
1484
- $poolFloat32Array6(multiMatrix);
1485
- }
1486
- return false;
1487
- }
1488
- /**
1489
- * @param {number} index
1490
- * @return {DisplayObject}
1491
- * @method
1492
- * @private
1493
- */
1494
- _$createInstance(index) {
1495
- if (!this._$dictionary) {
1496
- throw new Error("the dictionary is null.");
1497
- }
1498
- // build
1499
- const tag = this._$dictionary[index];
1500
- const loaderInfo = this._$loaderInfo;
1501
- if (!loaderInfo || !loaderInfo._$data) {
1502
- throw new Error("the loaderInfo or data is null.");
1503
- }
1504
- const character = loaderInfo._$data.characters[tag.characterId];
1505
- // symbol class
1506
- const instance = $createInstance(character.extends);
1507
- instance._$build(tag, this);
1508
- instance._$id = index;
1509
- return instance;
1510
- }
1511
- /**
1512
- * @param {number} x
1513
- * @param {number} y
1514
- * @return {boolean}
1515
- * @method
1516
- * @private
1517
- */
1518
- _$outCheck(x, y) {
1519
- let matrix = $MATRIX_ARRAY_IDENTITY;
1520
- let parent = this._$parent;
1521
- while (parent) {
1522
- matrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), matrix);
1523
- parent = parent._$parent;
1524
- }
1525
- $hitContext.setTransform(1, 0, 0, 1, 0, 0);
1526
- $hitContext.beginPath();
1527
- const options = {
1528
- "x": x,
1529
- "y": y,
1530
- "pointer": "",
1531
- "hit": null
1532
- };
1533
- return this._$mouseHit($hitContext, matrix, options);
1534
- }
1535
- /**
1536
- * @return {void}
1537
- * @method
1538
- * @private
1539
- */
1540
- _$createWorkerInstance() {
1541
- if (this._$created || !$rendererWorker) {
1542
- return;
1543
- }
1544
- this._$created = true;
1545
- this._$posted = true;
1546
- this._$updated = false;
1547
- let index = 0;
1548
- const buffer = $getRenderBufferArray();
1549
- buffer[index++] = this._$instanceId;
1550
- buffer[index++] = this._$parent ? this._$parent._$instanceId : -1;
1551
- this._$registerProperty(buffer, index);
1552
- const message = $getRenderMessageObject();
1553
- message.command = "createDisplayObjectContainer";
1554
- message.buffer = buffer;
1555
- const options = $getArray(buffer.buffer);
1556
- $rendererWorker.postMessage(message, options);
1557
- $poolRenderMessageObject(message);
1558
- $poolArray(options);
1559
- this._$postChildrenIds();
1560
- }
1561
- /**
1562
- * @return {void}
1563
- * @method
1564
- * @private
1565
- */
1566
- _$postProperty() {
1567
- if (!$rendererWorker) {
1568
- return;
1569
- }
1570
- this._$postChildrenIds();
1571
- const options = $getArray();
1572
- const message = this._$createMessage();
1573
- $rendererWorker
1574
- .postMessage(message, options);
1575
- $poolArray(options);
1576
- this._$posted = true;
1577
- this._$updated = false;
1578
- }
1579
- /**
1580
- * @param {array} [childrenIds=null]
1581
- * @return {void}
1582
- * @method
1583
- * @private
1584
- */
1585
- _$postChildrenIds(childrenIds = null) {
1586
- if (!$rendererWorker || !this._$created) {
1587
- return;
1588
- }
1589
- let poolIds = false;
1590
- if (!childrenIds) {
1591
- const children = this._$getChildren();
1592
- childrenIds = $getArray();
1593
- for (let idx = 0; idx < children.length; ++idx) {
1594
- childrenIds.push(children[idx]._$instanceId);
1595
- }
1596
- poolIds = true;
1597
- }
1598
- const buffer = new Int32Array(childrenIds.length + 1);
1599
- buffer[0] = this._$instanceId;
1600
- buffer.set(childrenIds, 1);
1601
- const message = $getRenderMessageObject();
1602
- message.command = "setChildren";
1603
- message.buffer = buffer;
1604
- const options = $getArray(buffer.buffer);
1605
- $rendererWorker.postMessage(message, options);
1606
- $poolRenderMessageObject(message);
1607
- $poolArray(options);
1608
- if (poolIds) {
1609
- $poolArray(childrenIds);
1610
- }
1611
- }
1612
- }