@next2d/display 1.18.11 → 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 -416
  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 -1608
  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,1608 +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 instance = this._$createInstance(controller[idx]);
499
- instance._$placeId = idx;
500
- const loopConfig = instance.loopConfig;
501
- if (loopConfig) {
502
- instance._$currentFrame = instance
503
- ._$getLoopFrame(loopConfig);
504
- }
505
- currentChildren.push(instance);
506
- if (instance._$name) {
507
- this._$names.set(instance._$name, instance);
508
- }
509
- }
510
- }
511
- return currentChildren;
512
- }
513
- const useWorker = !!$rendererWorker && !!this._$stage;
514
- const skipIds = $getMap();
515
- const poolInstances = $getMap();
516
- let depth = 0;
517
- const children = $getArray();
518
- for (let idx = 0; idx < currentChildren.length; ++idx) {
519
- const instance = currentChildren[idx];
520
- const parent = instance._$parent;
521
- if (!parent || parent._$instanceId !== this._$instanceId) {
522
- continue;
523
- }
524
- const instanceId = instance._$instanceId;
525
- const startFrame = instance._$startFrame;
526
- const endFrame = instance._$endFrame;
527
- if (startFrame === 1 && endFrame === 0
528
- || startFrame <= frame && endFrame > frame) {
529
- // reset
530
- instance._$isNext = true;
531
- instance._$placeObject = null;
532
- instance._$filters = null;
533
- instance._$blendMode = null;
534
- if (instance._$id === -1) {
535
- children.push(instance);
536
- if (instance._$name) {
537
- this._$names.set(instance._$name, instance);
538
- }
539
- continue;
540
- }
541
- const id = controller[depth];
542
- if (instance._$id === id) {
543
- instance._$placeId = depth;
544
- children.push(instance);
545
- if (instance._$name) {
546
- this._$names.set(instance._$name, instance);
547
- }
548
- if (poolInstances.has(id)) {
549
- poolInstances.delete(id);
550
- }
551
- skipIds.set(id, true);
552
- depth++;
553
- if (useWorker) {
554
- instance._$postProperty();
555
- }
556
- continue;
557
- }
558
- poolInstances.set(instance._$id, instance);
559
- continue;
560
- }
561
- if (useWorker) {
562
- instance._$removeWorkerInstance();
563
- }
564
- $cacheStore.setRemoveTimer(instanceId);
565
- if (instance._$loaderInfo && instance._$characterId) {
566
- $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
567
- }
568
- if (instance._$graphics) {
569
- $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
570
- }
571
- // remove event
572
- if (instance.willTrigger(Next2DEvent.REMOVED)) {
573
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
574
- }
575
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
576
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE, true));
577
- }
578
- // reset
579
- instance._$added = false;
580
- instance._$addedStage = false;
581
- instance._$active = false;
582
- instance._$updated = true;
583
- instance._$filters = null;
584
- instance._$blendMode = null;
585
- instance._$isNext = true;
586
- instance._$placeObject = null;
587
- instance._$created = false;
588
- instance._$posted = false;
589
- if (instance instanceof DisplayObjectContainer) {
590
- instance._$executeRemovedFromStage();
591
- instance._$removeParentAndStage();
592
- }
593
- }
594
- if (controller) {
595
- for (let idx = 0; idx < controller.length; ++idx) {
596
- const id = controller[idx];
597
- if (skipIds.has(id)) {
598
- continue;
599
- }
600
- const instance = poolInstances.has(id)
601
- ? poolInstances.get(id)
602
- : this._$createInstance(id);
603
- instance._$placeId = idx;
604
- const loopConfig = instance.loopConfig;
605
- if (loopConfig) {
606
- instance._$currentFrame = instance
607
- ._$getLoopFrame(loopConfig);
608
- }
609
- children.push(instance);
610
- if (instance._$name) {
611
- this._$names.set(instance._$name, instance);
612
- }
613
- }
614
- }
615
- // object pool
616
- $poolMap(skipIds);
617
- $poolMap(poolInstances);
618
- // update
619
- currentChildren.length = 0;
620
- currentChildren.push(...children);
621
- $poolArray(children);
622
- }
623
- return this._$children;
624
- }
625
- /**
626
- * @return void
627
- * @private
628
- */
629
- _$clearChildren() {
630
- this._$doChanged();
631
- $doUpdated();
632
- // reset
633
- this._$names.clear();
634
- // clear
635
- this._$needsChildren = true;
636
- }
637
- /**
638
- * @param {DisplayObject} child
639
- * @returns {DisplayObject}
640
- * @private
641
- */
642
- _$addChild(child) {
643
- // init
644
- child._$parent = this;
645
- if (!child._$stage || !child._$root) {
646
- child._$stage = this._$stage;
647
- child._$root = this._$root;
648
- }
649
- // setup
650
- if (child instanceof DisplayObjectContainer) {
651
- child._$setParentAndStage();
652
- child._$wait = true;
653
- }
654
- // added event
655
- if (!child._$added) {
656
- if (child.willTrigger(Next2DEvent.ADDED)) {
657
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED, true));
658
- }
659
- child._$added = true;
660
- }
661
- if (this._$stage !== null && !child._$addedStage) {
662
- if (child.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
663
- child.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
664
- }
665
- child._$addedStage = true;
666
- // set params
667
- if (child instanceof DisplayObjectContainer) {
668
- child._$executeAddedToStage();
669
- }
670
- if ($rendererWorker) {
671
- child._$createWorkerInstance();
672
- this._$postChildrenIds();
673
- }
674
- }
675
- this._$doChanged();
676
- child._$active = true;
677
- child._$updated = true;
678
- child._$isNext = true;
679
- return child;
680
- }
681
- /**
682
- * @return {void}
683
- * @method
684
- * @private
685
- */
686
- _$setParentAndStage() {
687
- const children = this._$needsChildren
688
- ? this._$getChildren()
689
- : this._$children;
690
- for (let idx = 0; idx < children.length; ++idx) {
691
- const instance = children[idx];
692
- instance._$root = this._$root;
693
- instance._$stage = this._$stage;
694
- if (instance instanceof DisplayObjectContainer) {
695
- instance._$setParentAndStage();
696
- instance._$wait = true;
697
- }
698
- }
699
- }
700
- /**
701
- * @return {void}
702
- * @method
703
- * @private
704
- */
705
- _$executeAddedToStage() {
706
- const children = this._$needsChildren
707
- ? this._$getChildren()
708
- : this._$children;
709
- const childrenIds = $getArray();
710
- for (let idx = 0; idx < children.length; ++idx) {
711
- const instance = children[idx];
712
- if (!instance) {
713
- continue;
714
- }
715
- childrenIds.push(instance._$instanceId);
716
- if (!instance._$addedStage) {
717
- if ($rendererWorker) {
718
- instance._$createWorkerInstance();
719
- }
720
- if (instance.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
721
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
722
- }
723
- instance._$addedStage = true;
724
- }
725
- if (instance instanceof DisplayObjectContainer) {
726
- instance._$executeAddedToStage();
727
- }
728
- }
729
- if ($rendererWorker) {
730
- this._$postChildrenIds(childrenIds);
731
- }
732
- $poolArray(childrenIds);
733
- }
734
- /**
735
- * @param {DisplayObject} child
736
- * @param {boolean} do_event
737
- * @return {DisplayObject}
738
- * @private
739
- */
740
- _$remove(child, do_event = true) {
741
- child._$transform._$transform();
742
- // remove all broadcast events
743
- if (child.hasEventListener(Next2DEvent.ENTER_FRAME)) {
744
- child.removeAllEventListener(Next2DEvent.ENTER_FRAME);
745
- }
746
- if (child.hasEventListener(Next2DEvent.EXIT_FRAME)) {
747
- child.removeAllEventListener(Next2DEvent.EXIT_FRAME);
748
- }
749
- if (child.hasEventListener(Next2DEvent.FRAME_CONSTRUCTED)) {
750
- child.removeAllEventListener(Next2DEvent.FRAME_CONSTRUCTED);
751
- }
752
- if (child.hasEventListener(Next2DEvent.RENDER)) {
753
- child.removeAllEventListener(Next2DEvent.RENDER);
754
- }
755
- if (child.hasEventListener(Next2DEvent.ACTIVATE)) {
756
- child.removeAllEventListener(Next2DEvent.ACTIVATE);
757
- }
758
- if (child.hasEventListener(Next2DEvent.DEACTIVATE)) {
759
- child.removeAllEventListener(Next2DEvent.DEACTIVATE);
760
- }
761
- if (child.hasEventListener("keyDown")) {
762
- child.removeAllEventListener("keyDown");
763
- }
764
- if (child.hasEventListener("keyUp")) {
765
- child.removeAllEventListener("keyUp");
766
- }
767
- // remove
768
- const children = this._$needsChildren
769
- ? this._$getChildren()
770
- : this._$children;
771
- const depth = this.getChildIndex(child);
772
- children.splice(depth, 1);
773
- this._$names.delete(child.name);
774
- if (do_event) {
775
- // event
776
- if (child.willTrigger(Next2DEvent.REMOVED)) {
777
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED, true));
778
- }
779
- // remove stage event
780
- if (this._$stage !== null) {
781
- // worker側のDisplayObjectも削除
782
- if ($rendererWorker) {
783
- child._$removeWorkerInstance();
784
- this._$postChildrenIds();
785
- }
786
- if (child.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
787
- child.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
788
- }
789
- if (child instanceof DisplayObjectContainer) {
790
- child._$executeRemovedFromStage();
791
- }
792
- }
793
- $cacheStore.setRemoveTimer(child._$instanceId);
794
- if (child._$loaderInfo && child._$characterId) {
795
- $cacheStore.setRemoveTimer(`${child._$loaderInfo._$id}@${child._$characterId}`);
796
- }
797
- if (child._$graphics) {
798
- $cacheStore.setRemoveTimer(child._$graphics._$uniqueKey);
799
- }
800
- // reset params
801
- if (child instanceof DisplayObjectContainer) {
802
- child._$removeParentAndStage();
803
- }
804
- // reset
805
- child._$stage = null;
806
- child._$parent = null;
807
- child._$root = null;
808
- child._$active = false;
809
- child._$wait = true;
810
- child._$updated = true;
811
- child._$added = false;
812
- child._$addedStage = false;
813
- child._$created = false;
814
- child._$posted = false;
815
- this._$doChanged();
816
- }
817
- return child;
818
- }
819
- /**
820
- * @return {void}
821
- * @method
822
- * @private
823
- */
824
- _$executeRemovedFromStage() {
825
- const children = this._$getChildren().slice(0);
826
- for (let idx = 0; idx < children.length; ++idx) {
827
- const instance = children[idx];
828
- if (!instance) {
829
- continue;
830
- }
831
- if (instance._$addedStage) {
832
- // workerのDisplayObjectを削除
833
- if ($rendererWorker) {
834
- instance._$removeWorkerInstance();
835
- }
836
- if (instance.willTrigger(Next2DEvent.REMOVED_FROM_STAGE)) {
837
- instance.dispatchEvent(new Next2DEvent(Next2DEvent.REMOVED_FROM_STAGE));
838
- }
839
- instance._$created = false;
840
- instance._$posted = false;
841
- instance._$addedStage = false;
842
- }
843
- if (instance instanceof DisplayObjectContainer) {
844
- instance._$executeRemovedFromStage();
845
- }
846
- }
847
- }
848
- /**
849
- * @return {void}
850
- * @method
851
- * @private
852
- */
853
- _$removeParentAndStage() {
854
- const children = this._$needsChildren
855
- ? this._$getChildren()
856
- : this._$children;
857
- for (let idx = 0; idx < children.length; ++idx) {
858
- const instance = children[idx];
859
- $cacheStore.setRemoveTimer(instance._$instanceId);
860
- if (instance._$loaderInfo && instance._$characterId) {
861
- $cacheStore.setRemoveTimer(`${instance._$loaderInfo._$id}@${instance._$characterId}`);
862
- }
863
- if (instance._$graphics) {
864
- $cacheStore.setRemoveTimer(instance._$graphics._$uniqueKey);
865
- }
866
- if (instance instanceof DisplayObjectContainer) {
867
- instance._$removeParentAndStage();
868
- }
869
- instance._$stage = null;
870
- instance._$root = null;
871
- instance._$addedStage = false;
872
- }
873
- if ("_$sounds" in this) {
874
- const soundsMap = this._$sounds;
875
- if (soundsMap.size) {
876
- for (const sounds of soundsMap.values()) {
877
- for (let idx = 0; idx < sounds.length; ++idx) {
878
- const sound = sounds[idx];
879
- sound.stop();
880
- }
881
- }
882
- }
883
- }
884
- this._$needsChildren = true;
885
- }
886
- /**
887
- * @return {void}
888
- * @method
889
- * @private
890
- */
891
- _$prepareActions() {
892
- const children = this._$needsChildren
893
- ? this._$getChildren()
894
- : this._$children;
895
- for (let idx = children.length - 1; idx > -1; --idx) {
896
- children[idx]._$prepareActions();
897
- }
898
- // added event
899
- this._$executeAddedEvent();
900
- }
901
- /**
902
- * @return {boolean}
903
- * @method
904
- * @private
905
- */
906
- _$nextFrame() {
907
- let isNext = false;
908
- const children = this._$getChildren();
909
- for (let idx = children.length - 1; idx > -1; --idx) {
910
- const child = children[idx];
911
- if (!child._$isNext) {
912
- continue;
913
- }
914
- if (isNext) {
915
- child._$nextFrame();
916
- }
917
- else {
918
- isNext = child._$nextFrame();
919
- }
920
- }
921
- // added event
922
- this._$executeAddedEvent();
923
- this._$isNext = isNext;
924
- if (!this._$posted && $rendererWorker) {
925
- this._$postProperty();
926
- }
927
- return this._$isNext;
928
- }
929
- /**
930
- * @param {CanvasToWebGLContext} context
931
- * @param {Float32Array} matrix
932
- * @return {void}
933
- * @method
934
- * @private
935
- */
936
- _$clip(context, matrix) {
937
- let multiMatrix = matrix;
938
- const rawMatrix = this._$transform._$rawMatrix();
939
- if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
940
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
941
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
942
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
943
- }
944
- const children = this._$getChildren();
945
- for (let idx = 0; idx < children.length; ++idx) {
946
- const instance = children[idx];
947
- // mask instance
948
- if (instance._$isMask) {
949
- continue;
950
- }
951
- instance._$clip(context, multiMatrix);
952
- instance._$updated = false;
953
- }
954
- if (multiMatrix !== matrix) {
955
- $poolFloat32Array6(multiMatrix);
956
- }
957
- }
958
- /**
959
- * @param {CanvasToWebGLContext} context
960
- * @param {Float32Array} matrix
961
- * @return {object}
962
- * @private
963
- */
964
- _$preDraw(context, matrix) {
965
- let multiMatrix = matrix;
966
- const rawMatrix = this._$transform._$rawMatrix();
967
- if (rawMatrix !== $MATRIX_HIT_ARRAY_IDENTITY
968
- && rawMatrix[0] !== 1 || rawMatrix[1] !== 0
969
- || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
970
- || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
971
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
972
- }
973
- // size zero
974
- if (!multiMatrix[0] && !multiMatrix[1]
975
- || !multiMatrix[2] && !multiMatrix[3]) {
976
- if (multiMatrix !== matrix) {
977
- $poolFloat32Array6(multiMatrix);
978
- }
979
- return null;
980
- }
981
- // return object
982
- const object = $getPreObject();
983
- // setup
984
- object.matrix = multiMatrix;
985
- // check
986
- const filters = this._$filters || this.filters;
987
- const blendMode = this._$blendMode || this.blendMode;
988
- if (filters.length > 0 || blendMode !== "normal") {
989
- // check size
990
- const baseBounds = this._$getBounds(null);
991
- const bounds = $boundsMatrix(baseBounds, multiMatrix);
992
- $poolBoundsObject(baseBounds);
993
- const xMax = +bounds.xMax;
994
- const xMin = +bounds.xMin;
995
- const yMax = +bounds.yMax;
996
- const yMin = +bounds.yMin;
997
- $poolBoundsObject(bounds);
998
- const width = $Math.ceil($Math.abs(xMax - xMin));
999
- const height = $Math.ceil($Math.abs(yMax - yMin));
1000
- if (0 >= width || 0 >= height) {
1001
- $poolPreObject(object);
1002
- if (multiMatrix !== matrix) {
1003
- $poolFloat32Array6(multiMatrix);
1004
- }
1005
- return null;
1006
- }
1007
- let xScale = +$Math.sqrt(multiMatrix[0] * multiMatrix[0]
1008
- + multiMatrix[1] * multiMatrix[1]);
1009
- if (!$Number.isInteger(xScale)) {
1010
- const value = xScale.toString();
1011
- const index = value.indexOf("e");
1012
- if (index !== -1) {
1013
- xScale = +value.slice(0, index);
1014
- }
1015
- xScale = +xScale.toFixed(4);
1016
- }
1017
- let yScale = +$Math.sqrt(multiMatrix[2] * multiMatrix[2]
1018
- + multiMatrix[3] * multiMatrix[3]);
1019
- if (!$Number.isInteger(yScale)) {
1020
- const value = yScale.toString();
1021
- const index = value.indexOf("e");
1022
- if (index !== -1) {
1023
- yScale = +value.slice(0, index);
1024
- }
1025
- yScale = +yScale.toFixed(4);
1026
- }
1027
- object.canApply = this._$canApply(filters);
1028
- let filterBounds = $getBoundsObject(0, width, 0, height);
1029
- if (object.canApply && filters) {
1030
- for (let idx = 0; idx < filters.length; ++idx) {
1031
- filterBounds = filters[idx]
1032
- ._$generateFilterRect(filterBounds, xScale, yScale);
1033
- }
1034
- }
1035
- const currentAttachment = context
1036
- .frameBuffer
1037
- .currentAttachment;
1038
- if (!currentAttachment
1039
- || !currentAttachment.texture
1040
- || xMin - filterBounds.xMin > currentAttachment.width
1041
- || yMin - filterBounds.yMin > currentAttachment.height) {
1042
- $poolBoundsObject(filterBounds);
1043
- $poolPreObject(object);
1044
- if (multiMatrix !== matrix) {
1045
- $poolFloat32Array6(multiMatrix);
1046
- }
1047
- return null;
1048
- }
1049
- if (0 > xMin + filterBounds.xMax || 0 > yMin + filterBounds.yMax) {
1050
- $poolBoundsObject(filterBounds);
1051
- $poolPreObject(object);
1052
- if (multiMatrix !== matrix) {
1053
- $poolFloat32Array6(multiMatrix);
1054
- }
1055
- return null;
1056
- }
1057
- // move size
1058
- let tx = multiMatrix[4] - xMin;
1059
- let ty = multiMatrix[5] - yMin;
1060
- // start layer
1061
- context._$startLayer($getBoundsObject(xMin, xMax, yMin, yMax));
1062
- // check cache
1063
- const updated = this._$isFilterUpdated(multiMatrix, filters, object.canApply);
1064
- const layerBounds = this._$getLayerBounds(multiMatrix);
1065
- const layerWidth = $Math.ceil($Math.abs(layerBounds.xMax - layerBounds.xMin));
1066
- const layerHeight = $Math.ceil($Math.abs(layerBounds.yMax - layerBounds.yMin));
1067
- $poolBoundsObject(layerBounds);
1068
- const sw = layerWidth - filterBounds.xMax + filterBounds.xMin;
1069
- const sh = layerHeight - filterBounds.yMax + filterBounds.yMin;
1070
- tx += sw;
1071
- ty += sh;
1072
- object.sw = sw;
1073
- object.sh = sh;
1074
- if (updated) {
1075
- context._$saveAttachment($Math.ceil(width + sw), $Math.ceil(height + sh), true);
1076
- }
1077
- // setup
1078
- object.isLayer = true;
1079
- object.isUpdated = updated;
1080
- object.filters = filters;
1081
- object.blendMode = blendMode;
1082
- object.color = $getFloat32Array8();
1083
- object.matrix = $getFloat32Array6(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], tx, ty);
1084
- if (multiMatrix !== matrix) {
1085
- $poolFloat32Array6(multiMatrix);
1086
- }
1087
- $poolBoundsObject(filterBounds);
1088
- }
1089
- return object;
1090
- }
1091
- /**
1092
- * @param {CanvasToWebGLContext} context
1093
- * @param {Float32Array} matrix
1094
- * @param {Float32Array} color_transform
1095
- * @param {object} object
1096
- * @return {void}
1097
- * @method
1098
- * @private
1099
- */
1100
- _$postDraw(context, matrix, color_transform, object) {
1101
- context.drawInstacedArray();
1102
- // cache
1103
- const cacheKeys = $getArray(this._$instanceId, "f");
1104
- const manager = context.frameBuffer;
1105
- const multiMatrix = object.matrix;
1106
- let offsetX = 0;
1107
- let offsetY = 0;
1108
- let texture = $cacheStore.get(cacheKeys);
1109
- if (!texture || object.isUpdated) {
1110
- // remove
1111
- if (texture) {
1112
- $cacheStore.set(cacheKeys, null);
1113
- }
1114
- texture = manager
1115
- .getTextureFromCurrentAttachment();
1116
- const filters = object.filters;
1117
- let filterState = false;
1118
- if (filters && filters.length) {
1119
- for (let idx = 0; idx < filters.length; ++idx) {
1120
- texture = filters[idx]
1121
- ._$applyFilter(context, matrix);
1122
- }
1123
- // update
1124
- filterState = true;
1125
- offsetX = context._$offsetX;
1126
- offsetY = context._$offsetY;
1127
- // reset
1128
- context._$offsetX = 0;
1129
- context._$offsetY = 0;
1130
- }
1131
- texture.filterState = filterState;
1132
- texture.matrix = `${multiMatrix[0]}_`
1133
- + `${multiMatrix[1]}_`
1134
- + `${multiMatrix[2]}_`
1135
- + `${multiMatrix[3]}`;
1136
- texture.offsetX = offsetX;
1137
- texture.offsetY = offsetY;
1138
- $cacheStore.set(cacheKeys, texture);
1139
- context._$restoreAttachment();
1140
- }
1141
- if (texture.offsetX) {
1142
- offsetX = texture.offsetX;
1143
- }
1144
- if (texture.offsetY) {
1145
- offsetY = texture.offsetY;
1146
- }
1147
- // set
1148
- context.reset();
1149
- context.globalAlpha = $clamp(color_transform[3] + color_transform[7] / 255, 0, 1);
1150
- context.globalCompositeOperation = object.blendMode;
1151
- const bounds = context.getCurrentPosition();
1152
- context.setTransform(1, 0, 0, 1, bounds.xMin - offsetX - object.sw, bounds.yMin - offsetY - object.sh);
1153
- context.drawImage(texture, 0, 0, texture.width, texture.height, color_transform);
1154
- // end blend
1155
- context._$endLayer();
1156
- // object pool
1157
- $poolFloat32Array6(object.matrix);
1158
- $poolPreObject(object);
1159
- // reset
1160
- context.cachePosition = null;
1161
- }
1162
- /**
1163
- * @param {CanvasToWebGLContext} context
1164
- * @param {Float32Array} matrix
1165
- * @param {Float32Array} color_transform
1166
- * @return {void}
1167
- * @method
1168
- * @private
1169
- */
1170
- _$draw(context, matrix, color_transform) {
1171
- // not draw
1172
- if (!this._$visible) {
1173
- return;
1174
- }
1175
- const transform = this._$transform;
1176
- let multiColor = color_transform;
1177
- const rawColor = transform._$rawColorTransform();
1178
- if (rawColor !== $COLOR_ARRAY_IDENTITY
1179
- && rawColor[0] !== 1 || rawColor[1] !== 1
1180
- || rawColor[2] !== 1 || rawColor[3] !== 1
1181
- || rawColor[4] !== 0 || rawColor[5] !== 0
1182
- || rawColor[6] !== 0 || rawColor[7] !== 0) {
1183
- multiColor = $multiplicationColor(color_transform, rawColor);
1184
- }
1185
- // not draw
1186
- const alpha = $clamp(multiColor[3] + multiColor[7] / 255, 0, 1, 0);
1187
- if (!alpha) {
1188
- return;
1189
- }
1190
- // not draw
1191
- const children = this._$getChildren();
1192
- const length = children.length;
1193
- if (!length) {
1194
- return;
1195
- }
1196
- // pre data
1197
- const preObject = this._$preDraw(context, matrix);
1198
- if (!preObject) {
1199
- return;
1200
- }
1201
- // use cache
1202
- if (preObject.isLayer && !preObject.isUpdated) {
1203
- this._$postDraw(context, matrix, multiColor, preObject);
1204
- return;
1205
- }
1206
- const preMatrix = preObject.matrix;
1207
- const preColorTransform = preObject.isLayer && preObject.color
1208
- ? preObject.color
1209
- : multiColor;
1210
- // init clip params
1211
- let shouldClip = true;
1212
- let clipDepth = 0;
1213
- const player = $currentPlayer();
1214
- // draw children
1215
- const isLayer = context.isLayer;
1216
- const isUpdate = this._$isUpdated();
1217
- for (let idx = 0; idx < length; ++idx) {
1218
- const instance = children[idx];
1219
- if (isUpdate) {
1220
- instance._$placeObject = null;
1221
- }
1222
- // mask instance
1223
- if (instance._$isMask) {
1224
- continue;
1225
- }
1226
- // not layer mode
1227
- const blendMode = instance._$blendMode || instance.blendMode;
1228
- if ((blendMode === "alpha" || blendMode === "erase")
1229
- && !isLayer) {
1230
- continue;
1231
- }
1232
- // mask end
1233
- if (clipDepth
1234
- && (instance._$placeId > clipDepth || instance._$clipDepth > 0)) {
1235
- context.restore();
1236
- if (shouldClip) {
1237
- context._$leaveClip();
1238
- }
1239
- // clear
1240
- clipDepth = 0;
1241
- shouldClip = true;
1242
- }
1243
- // mask size 0
1244
- if (!shouldClip) {
1245
- continue;
1246
- }
1247
- // mask start
1248
- if (instance._$clipDepth > 0) {
1249
- clipDepth = instance._$clipDepth;
1250
- shouldClip = instance._$shouldClip(preMatrix);
1251
- if (shouldClip) {
1252
- context.save();
1253
- shouldClip = instance._$startClip(context, preMatrix);
1254
- }
1255
- continue;
1256
- }
1257
- // mask start
1258
- const maskInstance = instance._$mask;
1259
- if (maskInstance) {
1260
- maskInstance._$updated = false;
1261
- let maskMatrix;
1262
- if (this === maskInstance._$parent) {
1263
- maskMatrix = preMatrix;
1264
- }
1265
- else {
1266
- maskMatrix = $MATRIX_ARRAY_IDENTITY;
1267
- let parent = maskInstance._$parent;
1268
- while (parent) {
1269
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1270
- parent = parent._$parent;
1271
- }
1272
- const mScale = player.scaleX;
1273
- const playerMatrix = $getFloat32Array6(mScale, 0, 0, mScale, 0, 0);
1274
- maskMatrix = $multiplicationMatrix(playerMatrix, maskMatrix);
1275
- $poolFloat32Array6(playerMatrix);
1276
- if (context.isLayer) {
1277
- const currentPosition = context.getCurrentPosition();
1278
- maskMatrix[4] -= currentPosition.xMin;
1279
- maskMatrix[5] -= currentPosition.yMin;
1280
- }
1281
- }
1282
- if (!maskInstance._$shouldClip(maskMatrix)) {
1283
- continue;
1284
- }
1285
- const result = maskInstance._$startClip(context, maskMatrix);
1286
- context.save();
1287
- if (!result) { // fixed
1288
- context.restore();
1289
- continue;
1290
- }
1291
- }
1292
- instance._$draw(context, preMatrix, preColorTransform);
1293
- instance._$updated = false;
1294
- // mask end
1295
- if (maskInstance) {
1296
- context.restore();
1297
- context._$leaveClip();
1298
- }
1299
- }
1300
- // end mask
1301
- if (clipDepth) {
1302
- context.restore();
1303
- if (shouldClip) {
1304
- context._$leaveClip();
1305
- }
1306
- }
1307
- // filter and blend
1308
- if (preObject.isLayer) {
1309
- return this._$postDraw(context, matrix, multiColor, preObject);
1310
- }
1311
- if (preObject.matrix !== matrix) {
1312
- $poolFloat32Array6(preObject.matrix);
1313
- }
1314
- if (multiColor !== color_transform) {
1315
- $poolFloat32Array8(multiColor);
1316
- }
1317
- $poolPreObject(preObject);
1318
- }
1319
- /**
1320
- * @param {CanvasRenderingContext2D} context
1321
- * @param {Float32Array} matrix
1322
- * @param {object} options
1323
- * @param {boolean} [mouse_children=true]
1324
- * @return {boolean}
1325
- * @method
1326
- * @private
1327
- */
1328
- _$mouseHit(context, matrix, options, mouse_children = true) {
1329
- let multiMatrix = matrix;
1330
- const rawMatrix = this._$transform._$rawMatrix();
1331
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1332
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1333
- }
1334
- const children = this._$getChildren();
1335
- // mask set
1336
- const clips = $getArray();
1337
- const targets = $getArray();
1338
- const clipIndexes = $getMap();
1339
- let clipDepth = 0;
1340
- let clipIdx = 0;
1341
- for (let idx = 0; idx < children.length; ++idx) {
1342
- const instance = children[idx];
1343
- if (!instance._$visible && !instance._$hitObject) {
1344
- continue;
1345
- }
1346
- if (instance._$clipDepth) {
1347
- clipIdx = clips.length;
1348
- clipDepth = instance._$clipDepth;
1349
- clips.push(instance);
1350
- continue;
1351
- }
1352
- // clip end
1353
- if (clipDepth && instance._$placeId > clipDepth) {
1354
- clipIdx = 0;
1355
- clipDepth = 0;
1356
- }
1357
- // clip check on
1358
- if (clipIdx) {
1359
- clipIndexes.set(instance._$instanceId, clipIdx);
1360
- }
1361
- targets.push(instance);
1362
- }
1363
- // setup
1364
- const mouseChildren = this._$mouseChildren && mouse_children;
1365
- let hit = false;
1366
- const isRoot = this._$root === this;
1367
- while (targets.length) {
1368
- const instance = targets.pop();
1369
- if (instance._$isMask) {
1370
- continue;
1371
- }
1372
- if (isRoot && !(instance instanceof InteractiveObject)) {
1373
- continue;
1374
- }
1375
- // mask target
1376
- if (clipIndexes.has(instance._$instanceId)) {
1377
- const index = clipIndexes.get(instance._$instanceId);
1378
- if (!index) {
1379
- continue;
1380
- }
1381
- const clip = clips[index];
1382
- if (!clip._$hit(context, multiMatrix, options, true)) {
1383
- continue;
1384
- }
1385
- }
1386
- // mask hit test
1387
- const maskInstance = instance._$mask;
1388
- if (maskInstance) {
1389
- if (this === maskInstance._$parent) {
1390
- if (!maskInstance._$hit(context, multiMatrix, options, true)) {
1391
- continue;
1392
- }
1393
- }
1394
- else {
1395
- let maskMatrix = $MATRIX_ARRAY_IDENTITY;
1396
- let parent = maskInstance._$parent;
1397
- while (parent) {
1398
- maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1399
- parent = parent._$parent;
1400
- }
1401
- if (!maskInstance._$hit(context, maskMatrix, options, true)) {
1402
- continue;
1403
- }
1404
- }
1405
- }
1406
- if (instance._$mouseHit(context, multiMatrix, options, mouseChildren)
1407
- || instance._$hitArea
1408
- && instance
1409
- ._$hitArea
1410
- ._$mouseHit(context, multiMatrix, options, mouseChildren)) {
1411
- if (instance._$root === instance) {
1412
- return true;
1413
- }
1414
- if (!mouseChildren) {
1415
- return true;
1416
- }
1417
- hit = true;
1418
- if (instance instanceof InteractiveObject) {
1419
- if (!instance.mouseEnabled && !instance._$hitObject) {
1420
- continue;
1421
- }
1422
- if (!$isTouch && !options.pointer) {
1423
- if ("_$text" in instance
1424
- && "type" in instance
1425
- && instance.type === "input") {
1426
- options.pointer = "text";
1427
- }
1428
- if ("buttonMode" in instance
1429
- && "useHandCursor" in instance
1430
- && instance.buttonMode
1431
- && instance.useHandCursor) {
1432
- options.pointer = "pointer";
1433
- }
1434
- }
1435
- if (!options.hit) {
1436
- options.hit = !instance.mouseEnabled && instance._$hitObject
1437
- ? instance._$hitObject
1438
- : instance;
1439
- }
1440
- return true;
1441
- }
1442
- }
1443
- }
1444
- // pool
1445
- $poolArray(clips);
1446
- $poolArray(targets);
1447
- $poolMap(clipIndexes);
1448
- if (multiMatrix !== matrix) {
1449
- $poolFloat32Array6(multiMatrix);
1450
- }
1451
- // not found
1452
- return hit;
1453
- }
1454
- /**
1455
- * @param {CanvasRenderingContext2D} context
1456
- * @param {Float32Array} matrix
1457
- * @param {object} options
1458
- * @param {boolean} [is_clip=false]
1459
- * @return {boolean}
1460
- * @method
1461
- * @private
1462
- */
1463
- _$hit(context, matrix, options, is_clip = false) {
1464
- let multiMatrix = matrix;
1465
- const rawMatrix = this._$transform._$rawMatrix();
1466
- if (rawMatrix !== $MATRIX_ARRAY_IDENTITY) {
1467
- multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1468
- }
1469
- const children = this._$getChildren();
1470
- for (let idx = children.length; idx > -1; --idx) {
1471
- const instance = children[idx];
1472
- if (instance._$isMask) {
1473
- continue;
1474
- }
1475
- if (instance._$hit(context, multiMatrix, options, is_clip)) {
1476
- return true;
1477
- }
1478
- }
1479
- if (multiMatrix !== matrix) {
1480
- $poolFloat32Array6(multiMatrix);
1481
- }
1482
- return false;
1483
- }
1484
- /**
1485
- * @param {number} index
1486
- * @return {DisplayObject}
1487
- * @method
1488
- * @private
1489
- */
1490
- _$createInstance(index) {
1491
- if (!this._$dictionary) {
1492
- throw new Error("the dictionary is null.");
1493
- }
1494
- // build
1495
- const tag = this._$dictionary[index];
1496
- const loaderInfo = this._$loaderInfo;
1497
- if (!loaderInfo || !loaderInfo._$data) {
1498
- throw new Error("the loaderInfo or data is null.");
1499
- }
1500
- const character = loaderInfo._$data.characters[tag.characterId];
1501
- // symbol class
1502
- const instance = $createInstance(character.extends);
1503
- instance._$build(tag, this);
1504
- instance._$id = index;
1505
- return instance;
1506
- }
1507
- /**
1508
- * @param {number} x
1509
- * @param {number} y
1510
- * @return {boolean}
1511
- * @method
1512
- * @private
1513
- */
1514
- _$outCheck(x, y) {
1515
- let matrix = $MATRIX_ARRAY_IDENTITY;
1516
- let parent = this._$parent;
1517
- while (parent) {
1518
- matrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), matrix);
1519
- parent = parent._$parent;
1520
- }
1521
- $hitContext.setTransform(1, 0, 0, 1, 0, 0);
1522
- $hitContext.beginPath();
1523
- const options = {
1524
- "x": x,
1525
- "y": y,
1526
- "pointer": "",
1527
- "hit": null
1528
- };
1529
- return this._$mouseHit($hitContext, matrix, options);
1530
- }
1531
- /**
1532
- * @return {void}
1533
- * @method
1534
- * @private
1535
- */
1536
- _$createWorkerInstance() {
1537
- if (this._$created || !$rendererWorker) {
1538
- return;
1539
- }
1540
- this._$created = true;
1541
- this._$posted = true;
1542
- this._$updated = false;
1543
- let index = 0;
1544
- const buffer = $getRenderBufferArray();
1545
- buffer[index++] = this._$instanceId;
1546
- buffer[index++] = this._$parent ? this._$parent._$instanceId : -1;
1547
- this._$registerProperty(buffer, index);
1548
- const message = $getRenderMessageObject();
1549
- message.command = "createDisplayObjectContainer";
1550
- message.buffer = buffer;
1551
- const options = $getArray(buffer.buffer);
1552
- $rendererWorker.postMessage(message, options);
1553
- $poolRenderMessageObject(message);
1554
- $poolArray(options);
1555
- this._$postChildrenIds();
1556
- }
1557
- /**
1558
- * @return {void}
1559
- * @method
1560
- * @private
1561
- */
1562
- _$postProperty() {
1563
- if (!$rendererWorker) {
1564
- return;
1565
- }
1566
- this._$postChildrenIds();
1567
- const options = $getArray();
1568
- const message = this._$createMessage();
1569
- $rendererWorker
1570
- .postMessage(message, options);
1571
- $poolArray(options);
1572
- this._$posted = true;
1573
- this._$updated = false;
1574
- }
1575
- /**
1576
- * @param {array} [childrenIds=null]
1577
- * @return {void}
1578
- * @method
1579
- * @private
1580
- */
1581
- _$postChildrenIds(childrenIds = null) {
1582
- if (!$rendererWorker || !this._$created) {
1583
- return;
1584
- }
1585
- let poolIds = false;
1586
- if (!childrenIds) {
1587
- const children = this._$getChildren();
1588
- childrenIds = $getArray();
1589
- for (let idx = 0; idx < children.length; ++idx) {
1590
- childrenIds.push(children[idx]._$instanceId);
1591
- }
1592
- poolIds = true;
1593
- }
1594
- const buffer = new Int32Array(childrenIds.length + 1);
1595
- buffer[0] = this._$instanceId;
1596
- buffer.set(childrenIds, 1);
1597
- const message = $getRenderMessageObject();
1598
- message.command = "setChildren";
1599
- message.buffer = buffer;
1600
- const options = $getArray(buffer.buffer);
1601
- $rendererWorker.postMessage(message, options);
1602
- $poolRenderMessageObject(message);
1603
- $poolArray(options);
1604
- if (poolIds) {
1605
- $poolArray(childrenIds);
1606
- }
1607
- }
1608
- }