@next2d/player 1.14.7 → 1.14.8

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 (415) hide show
  1. package/@types/next2d.d.ts +4 -0
  2. package/@types/window.d.ts +74 -0
  3. package/README.ja.md +8 -7
  4. package/README.md +17 -12
  5. package/dist/interface/AjaxEventImpl.d.ts +5 -0
  6. package/dist/interface/AjaxEventImpl.js +1 -0
  7. package/dist/interface/AjaxOptionImpl.d.ts +13 -0
  8. package/dist/interface/AjaxOptionImpl.js +1 -0
  9. package/dist/interface/AttachmentImpl.d.ts +11 -0
  10. package/dist/interface/AttachmentImpl.js +1 -0
  11. package/dist/interface/BitmapDataChannelImpl.d.ts +1 -0
  12. package/dist/interface/BitmapDataChannelImpl.js +1 -0
  13. package/dist/interface/BitmapDrawObjectImpl.d.ts +6 -0
  14. package/dist/interface/BitmapDrawObjectImpl.js +1 -0
  15. package/dist/interface/BitmapFilterTypeImpl.d.ts +1 -0
  16. package/dist/interface/BitmapFilterTypeImpl.js +1 -0
  17. package/dist/interface/BlendModeImpl.d.ts +1 -0
  18. package/dist/interface/BlendModeImpl.js +1 -0
  19. package/dist/interface/BoundsImpl.d.ts +6 -0
  20. package/dist/interface/BoundsImpl.js +1 -0
  21. package/dist/interface/Character.d.ts +2 -0
  22. package/dist/interface/Character.js +1 -0
  23. package/dist/interface/CharacterImpl.d.ts +2 -0
  24. package/dist/interface/CharacterImpl.js +1 -0
  25. package/dist/interface/ClassNameMap.d.ts +4 -0
  26. package/dist/interface/ClassNameMap.js +1 -0
  27. package/dist/interface/ClipObjectImpl.d.ts +14 -0
  28. package/dist/interface/ClipObjectImpl.js +1 -0
  29. package/dist/interface/ColorStopImpl.d.ts +7 -0
  30. package/dist/interface/ColorStopImpl.js +1 -0
  31. package/dist/interface/DictionaryTagImpl.d.ts +7 -0
  32. package/dist/interface/DictionaryTagImpl.js +1 -0
  33. package/dist/interface/DisplacementMapFilterModeImpl.d.ts +1 -0
  34. package/dist/interface/DisplacementMapFilterModeImpl.js +1 -0
  35. package/dist/interface/DisplayImpl.d.ts +28 -0
  36. package/dist/interface/DisplayImpl.js +1 -0
  37. package/dist/interface/DisplayObjectImpl.d.ts +2 -0
  38. package/dist/interface/DisplayObjectImpl.js +1 -0
  39. package/dist/interface/DragRulesImpl.d.ts +7 -0
  40. package/dist/interface/DragRulesImpl.js +1 -0
  41. package/dist/interface/DropTargetImpl.d.ts +2 -0
  42. package/dist/interface/DropTargetImpl.js +1 -0
  43. package/dist/interface/EventDispatcherImpl.d.ts +2 -0
  44. package/dist/interface/EventDispatcherImpl.js +1 -0
  45. package/dist/interface/EventListenerImpl.d.ts +6 -0
  46. package/dist/interface/EventListenerImpl.js +1 -0
  47. package/dist/interface/EventsImpl.d.ts +20 -0
  48. package/dist/interface/EventsImpl.js +1 -0
  49. package/dist/interface/FillMeshImpl.d.ts +5 -0
  50. package/dist/interface/FillMeshImpl.js +1 -0
  51. package/dist/interface/FilterArrayImpl.d.ts +10 -0
  52. package/dist/interface/FilterArrayImpl.js +1 -0
  53. package/dist/interface/FilterQualityImpl.d.ts +1 -0
  54. package/dist/interface/FilterQualityImpl.js +1 -0
  55. package/dist/interface/FiltersImpl.d.ts +20 -0
  56. package/dist/interface/FiltersImpl.js +1 -0
  57. package/dist/interface/GeomImpl.d.ts +12 -0
  58. package/dist/interface/GeomImpl.js +1 -0
  59. package/dist/interface/GradientTypeImpl.d.ts +3 -0
  60. package/dist/interface/GradientTypeImpl.js +1 -0
  61. package/dist/interface/GraphicsParentImpl.d.ts +2 -0
  62. package/dist/interface/GraphicsParentImpl.js +1 -0
  63. package/dist/interface/GridImpl.d.ts +6 -0
  64. package/dist/interface/GridImpl.js +1 -0
  65. package/dist/interface/ImageTypeImpl.d.ts +1 -0
  66. package/dist/interface/ImageTypeImpl.js +1 -0
  67. package/dist/interface/IndexRangeImpl.d.ts +4 -0
  68. package/dist/interface/IndexRangeImpl.js +1 -0
  69. package/dist/interface/LoaderInfoDataImpl.d.ts +7 -0
  70. package/dist/interface/LoaderInfoDataImpl.js +1 -0
  71. package/dist/interface/LoopConfigImpl.d.ts +8 -0
  72. package/dist/interface/LoopConfigImpl.js +1 -0
  73. package/dist/interface/LoopTypeImpl.d.ts +1 -0
  74. package/dist/interface/LoopTypeImpl.js +1 -0
  75. package/dist/interface/MediaImpl.d.ts +10 -0
  76. package/dist/interface/MediaImpl.js +1 -0
  77. package/dist/interface/MovieClipActionObjectImpl.d.ts +5 -0
  78. package/dist/interface/MovieClipActionObjectImpl.js +1 -0
  79. package/dist/interface/MovieClipCharacterImpl.d.ts +18 -0
  80. package/dist/interface/MovieClipCharacterImpl.js +1 -0
  81. package/dist/interface/MovieClipLabelObjectImpl.d.ts +4 -0
  82. package/dist/interface/MovieClipLabelObjectImpl.js +1 -0
  83. package/dist/interface/MovieClipSoundObjectImpl.d.ts +5 -0
  84. package/dist/interface/MovieClipSoundObjectImpl.js +1 -0
  85. package/dist/interface/NetImpl.d.ts +6 -0
  86. package/dist/interface/NetImpl.js +1 -0
  87. package/dist/interface/NoCodeDataImpl.d.ts +7 -0
  88. package/dist/interface/NoCodeDataImpl.js +1 -0
  89. package/dist/interface/NoCodeDataZlibImpl.d.ts +4 -0
  90. package/dist/interface/NoCodeDataZlibImpl.js +1 -0
  91. package/dist/interface/ParentImpl.d.ts +2 -0
  92. package/dist/interface/ParentImpl.js +1 -0
  93. package/dist/interface/PlaceObjectImpl.d.ts +12 -0
  94. package/dist/interface/PlaceObjectImpl.js +1 -0
  95. package/dist/interface/PlayerHitObjectImpl.d.ts +7 -0
  96. package/dist/interface/PlayerHitObjectImpl.js +1 -0
  97. package/dist/interface/PlayerModeImpl.d.ts +1 -0
  98. package/dist/interface/PlayerModeImpl.js +1 -0
  99. package/dist/interface/PlayerOptionsImpl.d.ts +8 -0
  100. package/dist/interface/PlayerOptionsImpl.js +1 -0
  101. package/dist/interface/PointImpl.d.ts +4 -0
  102. package/dist/interface/PointImpl.js +1 -0
  103. package/dist/interface/PreObjectImpl.d.ts +23 -0
  104. package/dist/interface/PreObjectImpl.js +1 -0
  105. package/dist/interface/PropertyContainerMessageImpl.d.ts +6 -0
  106. package/dist/interface/PropertyContainerMessageImpl.js +1 -0
  107. package/dist/interface/PropertyMessageImpl.d.ts +41 -0
  108. package/dist/interface/PropertyMessageImpl.js +1 -0
  109. package/dist/interface/PropertyMessageMapImpl.d.ts +2 -0
  110. package/dist/interface/PropertyMessageMapImpl.js +1 -0
  111. package/dist/interface/PropertyShapeMessageImpl.d.ts +6 -0
  112. package/dist/interface/PropertyShapeMessageImpl.js +1 -0
  113. package/dist/interface/PropertyTextMessageImpl.d.ts +25 -0
  114. package/dist/interface/PropertyTextMessageImpl.js +1 -0
  115. package/dist/interface/PropertyVideoMessageImpl.d.ts +5 -0
  116. package/dist/interface/PropertyVideoMessageImpl.js +1 -0
  117. package/dist/interface/RGBAImpl.d.ts +6 -0
  118. package/dist/interface/RGBAImpl.js +1 -0
  119. package/dist/interface/RenderDisplayObjectImpl.d.ts +2 -0
  120. package/dist/interface/RenderDisplayObjectImpl.js +1 -0
  121. package/dist/interface/ShapeCharacterImpl.d.ts +14 -0
  122. package/dist/interface/ShapeCharacterImpl.js +1 -0
  123. package/dist/interface/SoundCharacterImpl.d.ts +5 -0
  124. package/dist/interface/SoundCharacterImpl.js +1 -0
  125. package/dist/interface/SoundTagImpl.d.ts +6 -0
  126. package/dist/interface/SoundTagImpl.js +1 -0
  127. package/dist/interface/SpriteImpl.d.ts +2 -0
  128. package/dist/interface/SpriteImpl.js +1 -0
  129. package/dist/interface/StageDataImpl.d.ts +6 -0
  130. package/dist/interface/StageDataImpl.js +1 -0
  131. package/dist/interface/StageQualityImpl.d.ts +1 -0
  132. package/dist/interface/StageQualityImpl.js +1 -0
  133. package/dist/interface/StrokeMethImpl.d.ts +4 -0
  134. package/dist/interface/StrokeMethImpl.js +1 -0
  135. package/dist/interface/StrokeTypeImpl.d.ts +2 -0
  136. package/dist/interface/StrokeTypeImpl.js +1 -0
  137. package/dist/interface/SurfaceFilterImpl.d.ts +6 -0
  138. package/dist/interface/SurfaceFilterImpl.js +1 -0
  139. package/dist/interface/TextBreakObjectImpl.d.ts +9 -0
  140. package/dist/interface/TextBreakObjectImpl.js +1 -0
  141. package/dist/interface/TextCharacterImpl.d.ts +27 -0
  142. package/dist/interface/TextCharacterImpl.js +1 -0
  143. package/dist/interface/TextDataImpl.d.ts +2 -0
  144. package/dist/interface/TextDataImpl.js +1 -0
  145. package/dist/interface/TextFieldAutoSizeImpl.d.ts +1 -0
  146. package/dist/interface/TextFieldAutoSizeImpl.js +1 -0
  147. package/dist/interface/TextFieldTypeImpl.d.ts +1 -0
  148. package/dist/interface/TextFieldTypeImpl.js +1 -0
  149. package/dist/interface/TextFormatAlignImpl.d.ts +1 -0
  150. package/dist/interface/TextFormatAlignImpl.js +1 -0
  151. package/dist/interface/TextFormatImpl.d.ts +16 -0
  152. package/dist/interface/TextFormatImpl.js +1 -0
  153. package/dist/interface/TextFormatVerticalAlignImpl.d.ts +1 -0
  154. package/dist/interface/TextFormatVerticalAlignImpl.js +1 -0
  155. package/dist/interface/TextImageObjectImpl.d.ts +11 -0
  156. package/dist/interface/TextImageObjectImpl.js +1 -0
  157. package/dist/interface/TextImpl.d.ts +6 -0
  158. package/dist/interface/TextImpl.js +1 -0
  159. package/dist/interface/TextModeImpl.d.ts +1 -0
  160. package/dist/interface/TextModeImpl.js +1 -0
  161. package/dist/interface/TextObjectImpl.d.ts +7 -0
  162. package/dist/interface/TextObjectImpl.js +1 -0
  163. package/dist/interface/TextObjectModeImpl.d.ts +1 -0
  164. package/dist/interface/TextObjectModeImpl.js +1 -0
  165. package/dist/interface/TextStringObjectImpl.d.ts +7 -0
  166. package/dist/interface/TextStringObjectImpl.js +1 -0
  167. package/dist/interface/UIImpl.d.ts +8 -0
  168. package/dist/interface/UIImpl.js +1 -0
  169. package/dist/interface/URLLoaderDataFormatImpl.d.ts +1 -0
  170. package/dist/interface/URLLoaderDataFormatImpl.js +1 -0
  171. package/dist/interface/URLRequestMethodImpl.d.ts +1 -0
  172. package/dist/interface/URLRequestMethodImpl.js +1 -0
  173. package/dist/interface/UniformDataImpl.d.ts +5 -0
  174. package/dist/interface/UniformDataImpl.js +1 -0
  175. package/dist/interface/UnzipQueueImpl.d.ts +6 -0
  176. package/dist/interface/UnzipQueueImpl.js +1 -0
  177. package/dist/interface/VerticesImpl.d.ts +1 -0
  178. package/dist/interface/VerticesImpl.js +1 -0
  179. package/dist/interface/VideoCharacterImpl.d.ts +12 -0
  180. package/dist/interface/VideoCharacterImpl.js +1 -0
  181. package/dist/player/index.d.ts +1 -0
  182. package/dist/player/index.js +40 -0
  183. package/dist/player/next2d/display/BitmapData.d.ts +143 -0
  184. package/dist/player/next2d/display/BitmapData.js +390 -0
  185. package/dist/player/next2d/display/BlendMode.d.ts +204 -0
  186. package/dist/player/next2d/display/BlendMode.js +240 -0
  187. package/dist/player/next2d/display/DisplayObject.d.ts +571 -0
  188. package/dist/player/next2d/display/DisplayObject.js +1733 -0
  189. package/dist/player/next2d/display/DisplayObjectContainer.d.ts +351 -0
  190. package/dist/player/next2d/display/DisplayObjectContainer.js +1765 -0
  191. package/dist/player/next2d/display/FrameLabel.d.ts +98 -0
  192. package/dist/player/next2d/display/FrameLabel.js +122 -0
  193. package/dist/player/next2d/display/Graphics.d.ts +577 -0
  194. package/dist/player/next2d/display/Graphics.js +2193 -0
  195. package/dist/player/next2d/display/GraphicsBitmapFill.d.ts +49 -0
  196. package/dist/player/next2d/display/GraphicsBitmapFill.js +90 -0
  197. package/dist/player/next2d/display/GraphicsGradientFill.d.ts +66 -0
  198. package/dist/player/next2d/display/GraphicsGradientFill.js +162 -0
  199. package/dist/player/next2d/display/InteractiveObject.d.ts +32 -0
  200. package/dist/player/next2d/display/InteractiveObject.js +44 -0
  201. package/dist/player/next2d/display/Loader.d.ts +131 -0
  202. package/dist/player/next2d/display/Loader.js +324 -0
  203. package/dist/player/next2d/display/LoaderInfo.d.ts +122 -0
  204. package/dist/player/next2d/display/LoaderInfo.js +191 -0
  205. package/dist/player/next2d/display/LoopConfig.d.ts +108 -0
  206. package/dist/player/next2d/display/LoopConfig.js +160 -0
  207. package/dist/player/next2d/display/LoopType.d.ts +104 -0
  208. package/dist/player/next2d/display/LoopType.js +122 -0
  209. package/dist/player/next2d/display/MovieClip.d.ts +312 -0
  210. package/dist/player/next2d/display/MovieClip.js +959 -0
  211. package/dist/player/next2d/display/Shape.d.ts +167 -0
  212. package/dist/player/next2d/display/Shape.js +514 -0
  213. package/dist/player/next2d/display/Sprite.d.ts +174 -0
  214. package/dist/player/next2d/display/Sprite.js +288 -0
  215. package/dist/player/next2d/display/Stage.d.ts +164 -0
  216. package/dist/player/next2d/display/Stage.js +255 -0
  217. package/dist/player/next2d/events/Event.d.ts +424 -0
  218. package/dist/player/next2d/events/Event.js +569 -0
  219. package/dist/player/next2d/events/EventDispatcher.d.ts +138 -0
  220. package/dist/player/next2d/events/EventDispatcher.js +624 -0
  221. package/dist/player/next2d/events/EventPhase.d.ts +80 -0
  222. package/dist/player/next2d/events/EventPhase.js +94 -0
  223. package/dist/player/next2d/events/FocusEvent.d.ts +89 -0
  224. package/dist/player/next2d/events/FocusEvent.js +103 -0
  225. package/dist/player/next2d/events/HTTPStatusEvent.d.ts +107 -0
  226. package/dist/player/next2d/events/HTTPStatusEvent.js +142 -0
  227. package/dist/player/next2d/events/IOErrorEvent.d.ts +82 -0
  228. package/dist/player/next2d/events/IOErrorEvent.js +102 -0
  229. package/dist/player/next2d/events/MouseEvent.d.ts +163 -0
  230. package/dist/player/next2d/events/MouseEvent.js +207 -0
  231. package/dist/player/next2d/events/ProgressEvent.d.ts +97 -0
  232. package/dist/player/next2d/events/ProgressEvent.js +125 -0
  233. package/dist/player/next2d/events/VideoEvent.d.ts +145 -0
  234. package/dist/player/next2d/events/VideoEvent.js +183 -0
  235. package/dist/player/next2d/filters/BevelFilter.d.ts +254 -0
  236. package/dist/player/next2d/filters/BevelFilter.js +501 -0
  237. package/dist/player/next2d/filters/BitmapFilter.d.ts +75 -0
  238. package/dist/player/next2d/filters/BitmapFilter.js +96 -0
  239. package/dist/player/next2d/filters/BlurFilter.d.ts +150 -0
  240. package/dist/player/next2d/filters/BlurFilter.js +373 -0
  241. package/dist/player/next2d/filters/ColorMatrixFilter.d.ts +116 -0
  242. package/dist/player/next2d/filters/ColorMatrixFilter.js +180 -0
  243. package/dist/player/next2d/filters/ConvolutionFilter.d.ts +210 -0
  244. package/dist/player/next2d/filters/ConvolutionFilter.js +375 -0
  245. package/dist/player/next2d/filters/DisplacementMapFilter.d.ts +212 -0
  246. package/dist/player/next2d/filters/DisplacementMapFilter.js +381 -0
  247. package/dist/player/next2d/filters/DropShadowFilter.d.ts +240 -0
  248. package/dist/player/next2d/filters/DropShadowFilter.js +470 -0
  249. package/dist/player/next2d/filters/GlowFilter.d.ts +204 -0
  250. package/dist/player/next2d/filters/GlowFilter.js +362 -0
  251. package/dist/player/next2d/filters/GradientBevelFilter.d.ts +243 -0
  252. package/dist/player/next2d/filters/GradientBevelFilter.js +483 -0
  253. package/dist/player/next2d/filters/GradientGlowFilter.d.ts +243 -0
  254. package/dist/player/next2d/filters/GradientGlowFilter.js +473 -0
  255. package/dist/player/next2d/geom/ColorTransform.d.ts +201 -0
  256. package/dist/player/next2d/geom/ColorTransform.js +279 -0
  257. package/dist/player/next2d/geom/Matrix.d.ts +299 -0
  258. package/dist/player/next2d/geom/Matrix.js +455 -0
  259. package/dist/player/next2d/geom/Point.d.ts +213 -0
  260. package/dist/player/next2d/geom/Point.js +276 -0
  261. package/dist/player/next2d/geom/Rectangle.d.ts +364 -0
  262. package/dist/player/next2d/geom/Rectangle.js +517 -0
  263. package/dist/player/next2d/geom/Transform.d.ts +213 -0
  264. package/dist/player/next2d/geom/Transform.js +497 -0
  265. package/dist/player/next2d/media/Sound.d.ts +208 -0
  266. package/dist/player/next2d/media/Sound.js +515 -0
  267. package/dist/player/next2d/media/SoundMixer.d.ts +68 -0
  268. package/dist/player/next2d/media/SoundMixer.js +115 -0
  269. package/dist/player/next2d/media/SoundTransform.d.ts +80 -0
  270. package/dist/player/next2d/media/SoundTransform.js +113 -0
  271. package/dist/player/next2d/media/Video.d.ts +329 -0
  272. package/dist/player/next2d/media/Video.js +871 -0
  273. package/dist/player/next2d/net/URLRequest.d.ts +143 -0
  274. package/dist/player/next2d/net/URLRequest.js +239 -0
  275. package/dist/player/next2d/net/URLRequestHeader.d.ts +82 -0
  276. package/dist/player/next2d/net/URLRequestHeader.js +107 -0
  277. package/dist/player/next2d/text/TextField.d.ts +642 -0
  278. package/dist/player/next2d/text/TextField.js +2707 -0
  279. package/dist/player/next2d/text/TextFormat.d.ts +250 -0
  280. package/dist/player/next2d/text/TextFormat.js +473 -0
  281. package/dist/player/next2d/ui/Easing.d.ts +359 -0
  282. package/dist/player/next2d/ui/Easing.js +481 -0
  283. package/dist/player/next2d/ui/Job.d.ts +155 -0
  284. package/dist/player/next2d/ui/Job.js +344 -0
  285. package/dist/player/next2d/ui/Tween.d.ts +62 -0
  286. package/dist/player/next2d/ui/Tween.js +72 -0
  287. package/dist/player/packages/Display.d.ts +3 -0
  288. package/dist/player/packages/Display.js +36 -0
  289. package/dist/player/packages/Events.d.ts +3 -0
  290. package/dist/player/packages/Events.js +28 -0
  291. package/dist/player/packages/Filters.d.ts +3 -0
  292. package/dist/player/packages/Filters.js +28 -0
  293. package/dist/player/packages/Geom.d.ts +3 -0
  294. package/dist/player/packages/Geom.js +20 -0
  295. package/dist/player/packages/Media.d.ts +3 -0
  296. package/dist/player/packages/Media.js +18 -0
  297. package/dist/player/packages/Net.d.ts +3 -0
  298. package/dist/player/packages/Net.js +14 -0
  299. package/dist/player/packages/Text.d.ts +3 -0
  300. package/dist/player/packages/Text.js +14 -0
  301. package/dist/player/packages/UI.d.ts +3 -0
  302. package/dist/player/packages/UI.js +16 -0
  303. package/dist/player/player/Next2D.d.ts +71 -0
  304. package/dist/player/player/Next2D.js +206 -0
  305. package/dist/player/player/Player.d.ts +334 -0
  306. package/dist/player/player/Player.js +1912 -0
  307. package/dist/player/util/CacheStore.d.ts +115 -0
  308. package/dist/player/util/CacheStore.js +280 -0
  309. package/dist/player/util/Global.d.ts +23 -0
  310. package/dist/player/util/Global.js +67 -0
  311. package/dist/player/util/RenderUtil.d.ts +472 -0
  312. package/dist/player/util/RenderUtil.js +686 -0
  313. package/dist/player/util/Shortcut.d.ts +28 -0
  314. package/dist/player/util/Shortcut.js +28 -0
  315. package/dist/player/util/Util.d.ts +337 -0
  316. package/dist/player/util/Util.js +841 -0
  317. package/dist/renderer/RenderDisplayObject.d.ts +129 -0
  318. package/dist/renderer/RenderDisplayObject.js +567 -0
  319. package/dist/renderer/RenderDisplayObjectContainer.d.ts +70 -0
  320. package/dist/renderer/RenderDisplayObjectContainer.js +670 -0
  321. package/dist/renderer/RenderGlobal.d.ts +76 -0
  322. package/dist/renderer/RenderGlobal.js +88 -0
  323. package/dist/renderer/RenderGraphics.d.ts +90 -0
  324. package/dist/renderer/RenderGraphics.js +597 -0
  325. package/dist/renderer/RenderPlayer.d.ts +164 -0
  326. package/dist/renderer/RenderPlayer.js +421 -0
  327. package/dist/renderer/RenderShape.d.ts +32 -0
  328. package/dist/renderer/RenderShape.js +104 -0
  329. package/dist/renderer/RenderTextField.d.ts +119 -0
  330. package/dist/renderer/RenderTextField.js +709 -0
  331. package/dist/renderer/RenderVideo.d.ts +59 -0
  332. package/dist/renderer/RenderVideo.js +272 -0
  333. package/dist/webgl/BezierConverter.d.ts +59 -0
  334. package/dist/webgl/BezierConverter.js +107 -0
  335. package/dist/webgl/CanvasGradientToWebGL.d.ts +94 -0
  336. package/dist/webgl/CanvasGradientToWebGL.js +187 -0
  337. package/dist/webgl/CanvasPatternToWebGL.d.ts +39 -0
  338. package/dist/webgl/CanvasPatternToWebGL.js +70 -0
  339. package/dist/webgl/CanvasToWebGLContext.d.ts +596 -0
  340. package/dist/webgl/CanvasToWebGLContext.js +1453 -0
  341. package/dist/webgl/CanvasToWebGLContextBlend.d.ts +97 -0
  342. package/dist/webgl/CanvasToWebGLContextBlend.js +303 -0
  343. package/dist/webgl/CanvasToWebGLContextGrid.d.ts +74 -0
  344. package/dist/webgl/CanvasToWebGLContextGrid.js +314 -0
  345. package/dist/webgl/CanvasToWebGLContextMask.d.ts +113 -0
  346. package/dist/webgl/CanvasToWebGLContextMask.js +443 -0
  347. package/dist/webgl/CanvasToWebGLContextPath.d.ts +111 -0
  348. package/dist/webgl/CanvasToWebGLContextPath.js +213 -0
  349. package/dist/webgl/CanvasToWebGLContextStyle.d.ts +77 -0
  350. package/dist/webgl/CanvasToWebGLContextStyle.js +145 -0
  351. package/dist/webgl/ColorBufferPool.d.ts +58 -0
  352. package/dist/webgl/ColorBufferPool.js +137 -0
  353. package/dist/webgl/FrameBufferManager.d.ts +135 -0
  354. package/dist/webgl/FrameBufferManager.js +367 -0
  355. package/dist/webgl/StencilBufferPool.d.ts +56 -0
  356. package/dist/webgl/StencilBufferPool.js +147 -0
  357. package/dist/webgl/TextureManager.d.ts +130 -0
  358. package/dist/webgl/TextureManager.js +303 -0
  359. package/dist/webgl/VertexArrayObjectManager.d.ts +95 -0
  360. package/dist/webgl/VertexArrayObjectManager.js +289 -0
  361. package/dist/webgl/WebGLFillMeshGenerator.d.ts +31 -0
  362. package/dist/webgl/WebGLFillMeshGenerator.js +104 -0
  363. package/dist/webgl/WebGLStrokeMeshGenerator.d.ts +182 -0
  364. package/dist/webgl/WebGLStrokeMeshGenerator.js +510 -0
  365. package/dist/webgl/shader/CanvasToWebGLShader.d.ts +85 -0
  366. package/dist/webgl/shader/CanvasToWebGLShader.js +196 -0
  367. package/dist/webgl/shader/CanvasToWebGLShaderList.d.ts +70 -0
  368. package/dist/webgl/shader/CanvasToWebGLShaderList.js +115 -0
  369. package/dist/webgl/shader/GradientLUTGenerator.d.ts +36 -0
  370. package/dist/webgl/shader/GradientLUTGenerator.js +129 -0
  371. package/dist/webgl/shader/WebGLShaderUniform.d.ts +52 -0
  372. package/dist/webgl/shader/WebGLShaderUniform.js +168 -0
  373. package/dist/webgl/shader/fragment/FragmentShaderLibrary.d.ts +18 -0
  374. package/dist/webgl/shader/fragment/FragmentShaderLibrary.js +35 -0
  375. package/dist/webgl/shader/fragment/FragmentShaderSource.d.ts +29 -0
  376. package/dist/webgl/shader/fragment/FragmentShaderSource.js +99 -0
  377. package/dist/webgl/shader/fragment/FragmentShaderSourceBlend.d.ts +67 -0
  378. package/dist/webgl/shader/fragment/FragmentShaderSourceBlend.js +319 -0
  379. package/dist/webgl/shader/fragment/FragmentShaderSourceGradient.d.ts +44 -0
  380. package/dist/webgl/shader/fragment/FragmentShaderSourceGradient.js +114 -0
  381. package/dist/webgl/shader/fragment/FragmentShaderSourceGradientLUT.d.ts +14 -0
  382. package/dist/webgl/shader/fragment/FragmentShaderSourceGradientLUT.js +58 -0
  383. package/dist/webgl/shader/fragment/FragmentShaderSourceTexture.d.ts +12 -0
  384. package/dist/webgl/shader/fragment/FragmentShaderSourceTexture.js +36 -0
  385. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.d.ts +12 -0
  386. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.js +42 -0
  387. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.d.ts +11 -0
  388. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.js +35 -0
  389. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.d.ts +16 -0
  390. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.js +80 -0
  391. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.d.ts +15 -0
  392. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.js +106 -0
  393. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceFilter.d.ts +112 -0
  394. package/dist/webgl/shader/fragment/filter/FragmentShaderSourceFilter.js +275 -0
  395. package/dist/webgl/shader/variants/BlendShaderVariantCollection.d.ts +99 -0
  396. package/dist/webgl/shader/variants/BlendShaderVariantCollection.js +242 -0
  397. package/dist/webgl/shader/variants/FilterShaderVariantCollection.d.ts +150 -0
  398. package/dist/webgl/shader/variants/FilterShaderVariantCollection.js +398 -0
  399. package/dist/webgl/shader/variants/GradientLUTShaderVariantCollection.d.ts +49 -0
  400. package/dist/webgl/shader/variants/GradientLUTShaderVariantCollection.js +110 -0
  401. package/dist/webgl/shader/variants/GradientShapeShaderVariantCollection.d.ts +61 -0
  402. package/dist/webgl/shader/variants/GradientShapeShaderVariantCollection.js +199 -0
  403. package/dist/webgl/shader/variants/ShapeShaderVariantCollection.d.ts +117 -0
  404. package/dist/webgl/shader/variants/ShapeShaderVariantCollection.js +430 -0
  405. package/dist/webgl/shader/vertex/VertexShaderLibrary.d.ts +18 -0
  406. package/dist/webgl/shader/vertex/VertexShaderLibrary.js +75 -0
  407. package/dist/webgl/shader/vertex/VertexShaderSource.d.ts +23 -0
  408. package/dist/webgl/shader/vertex/VertexShaderSource.js +92 -0
  409. package/dist/webgl/shader/vertex/VertexShaderSourceFill.d.ts +45 -0
  410. package/dist/webgl/shader/vertex/VertexShaderSourceFill.js +112 -0
  411. package/dist/webgl/shader/vertex/VertexShaderSourceStroke.d.ts +27 -0
  412. package/dist/webgl/shader/vertex/VertexShaderSourceStroke.js +149 -0
  413. package/package.json +31 -25
  414. package/SECURITY.md +0 -3
  415. package/next2d.js +0 -7
@@ -0,0 +1,1733 @@
1
+ import { Event as Next2DEvent } from "../events/Event";
2
+ import { EventDispatcher } from "../events/EventDispatcher";
3
+ import { Transform } from "../geom/Transform";
4
+ import { Rectangle } from "../geom/Rectangle";
5
+ import { Point } from "../geom/Point";
6
+ import { $window } from "../../util/Shortcut";
7
+ import { $doUpdated, $getCurrentLoaderInfo, $getInstanceId } from "../../util/Global";
8
+ import { $currentMousePoint, $currentPlayer, $poolColorTransform, $rendererWorker, $event, $poolMatrix, $hitContext, $variables } from "../../util/Util";
9
+ import { $clamp, $getArray, $boundsMatrix, $Math, $poolBoundsObject, $Infinity, $getBoundsObject, $isNaN, $Deg2Rad, $Number, $Rad2Deg, $SHORT_INT_MIN, $SHORT_INT_MAX, $MATRIX_ARRAY_IDENTITY, $multiplicationMatrix, $poolFloat32Array6, $getMap, $poolMap, $getFloat32Array6 } from "../../util/RenderUtil";
10
+ /**
11
+ * DisplayObject クラスは、表示リストに含めることのできるすべてのオブジェクトに関する基本クラスです。
12
+ * DisplayObject クラス自体は、画面上でのコンテンツの描画のための API を含みません。
13
+ * そのため、DisplayObject クラスのカスタムサブクラスを作成する場合は、
14
+ * Shape、Sprite、Bitmap、TextField または MovieClip など、
15
+ * 画面上にコンテンツを描画する API を持つサブクラスの 1 つを拡張する必要があります。
16
+ *
17
+ * The DisplayObject class is the base class for all objects that can be placed on the display list.
18
+ * The DisplayObject class itself does not include any APIs for rendering content onscreen.
19
+ * For that reason, if you want create a custom subclass of the DisplayObject class,
20
+ * you will want to extend one of its subclasses that do have APIs for rendering content onscreen,
21
+ * such as the Shape, Sprite, Bitmap, TextField, or MovieClip class.
22
+ *
23
+ * @class
24
+ * @memberOf next2d.display
25
+ * @extends EventDispatcher
26
+ */
27
+ export class DisplayObject extends EventDispatcher {
28
+ _$instanceId;
29
+ _$id;
30
+ _$stage;
31
+ _$parent;
32
+ _$scale9Grid;
33
+ _$characterId;
34
+ _$active;
35
+ _$isMask;
36
+ _$updated;
37
+ _$added;
38
+ _$addedStage;
39
+ _$filters;
40
+ _$blendMode;
41
+ _$transform;
42
+ _$hitObject;
43
+ _$isNext;
44
+ _$created;
45
+ _$posted;
46
+ _$clipDepth;
47
+ _$name;
48
+ _$mask;
49
+ _$visible;
50
+ _$root;
51
+ _$loaderInfo;
52
+ _$scaleX;
53
+ _$scaleY;
54
+ _$variables;
55
+ _$placeObject;
56
+ _$rotation;
57
+ _$changePlace;
58
+ _$currentPlaceId;
59
+ _$placeId;
60
+ _$startFrame;
61
+ _$endFrame;
62
+ /**
63
+ * @constructor
64
+ * @public
65
+ */
66
+ constructor() {
67
+ super();
68
+ /**
69
+ * @type {number}
70
+ * @private
71
+ */
72
+ this._$id = -1;
73
+ /**
74
+ * @type {number}
75
+ * @private
76
+ */
77
+ this._$instanceId = $getInstanceId();
78
+ /**
79
+ * @type {number}
80
+ * @private
81
+ */
82
+ this._$characterId = 0;
83
+ /**
84
+ * @type {boolean}
85
+ * @default false
86
+ * @private
87
+ */
88
+ this._$active = false;
89
+ /**
90
+ * @type {boolean}
91
+ * @default false
92
+ * @private
93
+ */
94
+ this._$isMask = false;
95
+ /**
96
+ * @type {boolean}
97
+ * @default false
98
+ * @private
99
+ */
100
+ this._$updated = true;
101
+ /**
102
+ * @type {boolean}
103
+ * @default false
104
+ * @private
105
+ */
106
+ this._$added = false;
107
+ /**
108
+ * @type {boolean}
109
+ * @default false
110
+ * @private
111
+ */
112
+ this._$addedStage = false;
113
+ /**
114
+ * @type {array|null}
115
+ * @default null
116
+ * @private
117
+ */
118
+ this._$filters = null;
119
+ /**
120
+ * @type {string|null}
121
+ * @default null
122
+ * @private
123
+ */
124
+ this._$blendMode = null;
125
+ /**
126
+ * @type {Sprite|null}
127
+ * @default null
128
+ * @private
129
+ */
130
+ this._$hitObject = null;
131
+ /**
132
+ * @type {boolean}
133
+ * @default true
134
+ * @private
135
+ */
136
+ this._$isNext = true;
137
+ /**
138
+ * @type {boolean}
139
+ * @default false
140
+ * @private
141
+ */
142
+ this._$created = false;
143
+ /**
144
+ * @type {boolean}
145
+ * @default false
146
+ * @private
147
+ */
148
+ this._$posted = false;
149
+ /**
150
+ * @type {number}
151
+ * @default 0
152
+ * @private
153
+ */
154
+ this._$clipDepth = 0;
155
+ /**
156
+ * @type {string}
157
+ * @default ""
158
+ * @private
159
+ */
160
+ this._$name = "";
161
+ /**
162
+ * @type {boolean}
163
+ * @default true
164
+ * @private
165
+ */
166
+ this._$visible = true;
167
+ /**
168
+ * @type {DisplayObject|null}
169
+ * @default null
170
+ * @private
171
+ */
172
+ this._$mask = null;
173
+ /**
174
+ * @type {Rectangle|null}
175
+ * @default null
176
+ * @private
177
+ */
178
+ this._$scale9Grid = null;
179
+ /**
180
+ * @type {Sprite | null}
181
+ * @default null
182
+ * @private
183
+ */
184
+ this._$parent = null;
185
+ /**
186
+ * @type {Stage|null}
187
+ * @default null
188
+ * @private
189
+ */
190
+ this._$stage = null;
191
+ /**
192
+ * @type {Sprite|null}
193
+ * @default null
194
+ * @private
195
+ */
196
+ this._$root = null;
197
+ /**
198
+ * @type {number|null}
199
+ * @default null
200
+ * @private
201
+ */
202
+ this._$loaderInfo = null;
203
+ /**
204
+ * @type {number|null}
205
+ * @default null
206
+ * @private
207
+ */
208
+ this._$placeId = -1;
209
+ /**
210
+ * @type {number}
211
+ * @default null
212
+ * @private
213
+ */
214
+ this._$startFrame = 1;
215
+ /**
216
+ * @type {number}
217
+ * @default 0
218
+ * @private
219
+ */
220
+ this._$endFrame = 0;
221
+ /**
222
+ * @type {Transform}
223
+ * @private
224
+ */
225
+ this._$transform = new Transform(this);
226
+ /**
227
+ * @type {Map}
228
+ * @default null
229
+ * @private
230
+ */
231
+ this._$variables = null;
232
+ /**
233
+ * @type {object}
234
+ * @default null
235
+ * @private
236
+ */
237
+ this._$placeObject = null;
238
+ /**
239
+ * @type {number}
240
+ * @default -1
241
+ * @private
242
+ */
243
+ this._$currentPlaceId = -1;
244
+ /**
245
+ * @type {boolean}
246
+ * @default false
247
+ * @private
248
+ */
249
+ this._$changePlace = false;
250
+ /**
251
+ * @type {number}
252
+ * @default null
253
+ * @private
254
+ */
255
+ this._$scaleX = null;
256
+ /**
257
+ * @type {number}
258
+ * @default null
259
+ * @private
260
+ */
261
+ this._$scaleY = null;
262
+ /**
263
+ * @type {number}
264
+ * @default null
265
+ * @private
266
+ */
267
+ this._$rotation = null;
268
+ }
269
+ /**
270
+ * @description 指定されたオブジェクトのアルファ透明度値を示します。
271
+ * 有効な値は 0.0(完全な透明)~ 1.0(完全な不透明)です。
272
+ * デフォルト値は 1.0 です。alpha が 0.0 に設定されている表示オブジェクトは、
273
+ * 表示されない場合でも、アクティブです。
274
+ * Indicates the alpha transparency value of the object specified.
275
+ * Valid values are 0.0 (fully transparent) to 1.0 (fully opaque).
276
+ * The default value is 1.0. Display objects with alpha set to 0.0 are active,
277
+ * even though they are invisible.
278
+ *
279
+ * @member {number}
280
+ * @default 1
281
+ * @public
282
+ */
283
+ get alpha() {
284
+ const colorTransform = this
285
+ ._$transform
286
+ ._$rawColorTransform();
287
+ return colorTransform[3] + colorTransform[7] / 255;
288
+ }
289
+ set alpha(alpha) {
290
+ alpha = $clamp(alpha, 0, 1, 0);
291
+ // clone
292
+ const colorTransform = this
293
+ ._$transform
294
+ .colorTransform;
295
+ colorTransform._$colorTransform[3] = alpha;
296
+ colorTransform._$colorTransform[7] = 0;
297
+ this._$transform.colorTransform = colorTransform;
298
+ $poolColorTransform(colorTransform);
299
+ }
300
+ /**
301
+ * @description 使用するブレンドモードを指定する BlendMode クラスの値です。
302
+ * A value from the BlendMode class that specifies which blend mode to use.
303
+ *
304
+ * @member {string}
305
+ * @default BlendMode.NORMAL
306
+ * @public
307
+ */
308
+ get blendMode() {
309
+ // use cache
310
+ if (this._$blendMode) {
311
+ return this._$blendMode;
312
+ }
313
+ const transform = this._$transform;
314
+ if (transform._$blendMode) {
315
+ // cache
316
+ this._$blendMode = transform._$blendMode;
317
+ return transform._$blendMode;
318
+ }
319
+ const placeObject = this._$getPlaceObject();
320
+ if (placeObject && placeObject.blendMode) {
321
+ // cache
322
+ this._$blendMode = placeObject.blendMode;
323
+ return placeObject.blendMode;
324
+ }
325
+ // cache
326
+ this._$blendMode = "normal";
327
+ return "normal";
328
+ }
329
+ set blendMode(blend_mode) {
330
+ this._$transform._$transform(null, null, null, blend_mode);
331
+ this._$blendMode = blend_mode;
332
+ }
333
+ /**
334
+ * @description 表示オブジェクトに現在関連付けられている各フィルターオブジェクトが
335
+ * 格納されているインデックス付きの配列です。
336
+ * An indexed array that contains each filter object
337
+ * currently associated with the display object.
338
+ *
339
+ * @member {array}
340
+ * @default {array}
341
+ * @public
342
+ */
343
+ get filters() {
344
+ // use cache
345
+ if (this._$filters) {
346
+ const filters = $getArray();
347
+ for (let idx = 0; idx < this._$filters.length; ++idx) {
348
+ filters[idx] = this._$filters[idx].clone();
349
+ }
350
+ return filters;
351
+ }
352
+ const transform = this._$transform;
353
+ if (transform._$filters) {
354
+ const clone = $getArray();
355
+ const filters = $getArray();
356
+ for (let idx = 0; idx < transform._$filters.length; ++idx) {
357
+ const filter = transform._$filters[idx];
358
+ clone[idx] = filter.clone();
359
+ filters[idx] = filter.clone();
360
+ }
361
+ // cache
362
+ this._$filters = clone;
363
+ return filters;
364
+ }
365
+ const placeObject = this._$getPlaceObject();
366
+ if (placeObject && placeObject.surfaceFilterList) {
367
+ // create filter
368
+ if (!placeObject.filters) {
369
+ placeObject.filters = transform
370
+ ._$buildFilter(placeObject.surfaceFilterList);
371
+ }
372
+ const clone = $getArray();
373
+ // @ts-ignore
374
+ const filters = $getArray();
375
+ for (let idx = 0; idx < placeObject.filters.length; ++idx) {
376
+ const filter = placeObject.filters[idx];
377
+ clone[idx] = filter.clone();
378
+ filters[idx] = filter.clone();
379
+ }
380
+ // cache
381
+ this._$filters = clone;
382
+ return filters;
383
+ }
384
+ const filters = $getArray();
385
+ // cache
386
+ this._$filters = filters;
387
+ return filters;
388
+ }
389
+ set filters(filters) {
390
+ if (!filters) {
391
+ filters = $getArray();
392
+ }
393
+ this._$transform._$transform(null, null, filters);
394
+ this._$filters = filters;
395
+ }
396
+ /**
397
+ * @description 表示オブジェクトの高さを示します(ピクセル単位)。
398
+ * Indicates the height of the display object, in pixels.
399
+ *
400
+ * @member {number}
401
+ * @public
402
+ */
403
+ get height() {
404
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
405
+ ? this._$getBounds()
406
+ : $getBoundsObject();
407
+ const bounds = $boundsMatrix(baseBounds, this._$transform._$rawMatrix());
408
+ $poolBoundsObject(baseBounds);
409
+ const height = $Math.abs(bounds.yMax - bounds.yMin);
410
+ // object pool
411
+ $poolBoundsObject(bounds);
412
+ switch (height) {
413
+ case 0:
414
+ case $Infinity:
415
+ case -$Infinity:
416
+ return 0;
417
+ default:
418
+ return +height.toFixed(2);
419
+ }
420
+ }
421
+ set height(height) {
422
+ height = +height;
423
+ if (!$isNaN(height) && height > -1) {
424
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
425
+ ? this._$getBounds()
426
+ : $getBoundsObject();
427
+ const rotation = this.rotation;
428
+ const bounds = rotation
429
+ ? $boundsMatrix(baseBounds, this._$transform._$rawMatrix())
430
+ : baseBounds;
431
+ if (rotation) {
432
+ $poolBoundsObject(baseBounds);
433
+ }
434
+ const exHeight = $Math.abs(bounds.yMax - bounds.yMin);
435
+ $poolBoundsObject(bounds);
436
+ switch (exHeight) {
437
+ case 0:
438
+ case $Infinity:
439
+ case -$Infinity:
440
+ this.scaleY = 0;
441
+ break;
442
+ default:
443
+ this.scaleY = height / exHeight;
444
+ break;
445
+ }
446
+ }
447
+ }
448
+ /**
449
+ * @description この表示オブジェクトが属するファイルの読み込み情報を含む LoaderInfo オブジェクトを返します。
450
+ * Returns a LoaderInfo object containing information
451
+ * about loading the file to which this display object belongs.
452
+ *
453
+ * @member {LoaderInfo}
454
+ * @default null
455
+ * @readonly
456
+ * @public
457
+ */
458
+ get loaderInfo() {
459
+ return this._$loaderInfo;
460
+ }
461
+ /**
462
+ * @description 呼び出し元の表示オブジェクトは、指定された mask オブジェクトによってマスクされます。
463
+ * The calling display object is masked by the specified mask object.
464
+ *
465
+ * @member {DisplayObject|null}
466
+ * @public
467
+ */
468
+ get mask() {
469
+ return this._$mask;
470
+ }
471
+ set mask(mask) {
472
+ if (mask === this._$mask) {
473
+ return;
474
+ }
475
+ // reset
476
+ if (this._$mask) {
477
+ if ($rendererWorker && this._$mask.stage) {
478
+ this._$mask._$removeWorkerInstance();
479
+ }
480
+ this._$mask._$isMask = false;
481
+ this._$mask = null;
482
+ }
483
+ if (mask) {
484
+ if ($rendererWorker
485
+ && "_$createWorkerInstance" in mask
486
+ && typeof mask._$createWorkerInstance === "function") {
487
+ mask._$createWorkerInstance();
488
+ }
489
+ mask._$isMask = true;
490
+ this._$mask = mask;
491
+ }
492
+ this._$doChanged();
493
+ }
494
+ /**
495
+ * @description マウスまたはユーザー入力デバイスの x 軸の位置をピクセルで示します。
496
+ * Indicates the x coordinate of the mouse or user input device position, in pixels.
497
+ *
498
+ * @member {number}
499
+ * @default 0
500
+ * @readonly
501
+ * @public
502
+ */
503
+ get mouseX() {
504
+ return $event
505
+ ? this.globalToLocal($currentMousePoint()).x
506
+ : 0;
507
+ }
508
+ /**
509
+ * @description マウスまたはユーザー入力デバイスの y 軸の位置をピクセルで示します。
510
+ * Indicates the y coordinate of the mouse or user input device position, in pixels.
511
+ *
512
+ * @member {number}
513
+ * @default 0
514
+ * @readonly
515
+ * @public
516
+ */
517
+ get mouseY() {
518
+ return $event
519
+ ? this.globalToLocal($currentMousePoint()).y
520
+ : 0;
521
+ }
522
+ /**
523
+ * @description DisplayObject のインスタンス名を示します。
524
+ * Indicates the instance name of the DisplayObject.
525
+ *
526
+ * @member {string}
527
+ * @public
528
+ */
529
+ get name() {
530
+ if (this._$name) {
531
+ return this._$name;
532
+ }
533
+ return `instance${this._$instanceId}`;
534
+ }
535
+ set name(name) {
536
+ this._$name = `${name}`;
537
+ const parent = this._$parent;
538
+ if (parent && parent._$names) {
539
+ parent._$names.clear();
540
+ const children = parent._$getChildren();
541
+ for (let idx = 0; idx < children.length; ++idx) {
542
+ const child = children[idx];
543
+ if (child._$name) {
544
+ parent._$names.set(child.name, child);
545
+ }
546
+ }
547
+ }
548
+ }
549
+ /**
550
+ * @description この表示オブジェクトを含む DisplayObjectContainer オブジェクトを示します。
551
+ * Indicates the DisplayObjectContainer object that contains this display object.
552
+ *
553
+ * @member {DisplayObjectContainer | null}
554
+ * @readonly
555
+ * @public
556
+ */
557
+ get parent() {
558
+ return this._$parent;
559
+ }
560
+ /**
561
+ * @description 読み込まれた SWF ファイル内の表示オブジェクトの場合、
562
+ * root プロパティはその SWF ファイルが表す表示リストのツリー構造部分の一番上にある表示オブジェクトとなります。
563
+ * For a display object in a loaded SWF file,
564
+ * the root property is the top-most display object
565
+ * in the portion of the display list's tree structure represented by that SWF file.
566
+ *
567
+ * @member {DisplayObject|null}
568
+ * @readonly
569
+ * @public
570
+ */
571
+ get root() {
572
+ return this._$root;
573
+ }
574
+ /**
575
+ * @description DisplayObject インスタンスの元の位置からの回転角を度単位で示します。
576
+ * Indicates the rotation of the DisplayObject instance,
577
+ * in degrees, from its original orientation.
578
+ *
579
+ * @member {number}
580
+ * @public
581
+ */
582
+ get rotation() {
583
+ if (this._$rotation !== null) {
584
+ return this._$rotation;
585
+ }
586
+ const matrix = this._$transform._$rawMatrix();
587
+ return $Math.atan2(matrix[1], matrix[0]) * $Rad2Deg;
588
+ }
589
+ set rotation(rotation) {
590
+ rotation = $clamp(rotation % 360, 0 - 360, 360, 0);
591
+ if (this._$rotation === rotation) {
592
+ return;
593
+ }
594
+ const transform = this._$transform;
595
+ const matrix = transform.matrix;
596
+ const scaleX = $Math.sqrt(matrix.a * matrix.a + matrix.b * matrix.b);
597
+ const scaleY = $Math.sqrt(matrix.c * matrix.c + matrix.d * matrix.d);
598
+ if (rotation === 0) {
599
+ matrix.a = scaleX;
600
+ matrix.b = 0;
601
+ matrix.c = 0;
602
+ matrix.d = scaleY;
603
+ }
604
+ else {
605
+ let radianX = $Math.atan2(matrix.b, matrix.a);
606
+ let radianY = $Math.atan2(0 - matrix.c, matrix.d);
607
+ const radian = rotation * $Deg2Rad;
608
+ radianY = radianY + radian - radianX;
609
+ radianX = radian;
610
+ matrix.b = scaleX * $Math.sin(radianX);
611
+ if (matrix.b === 1 || matrix.b === -1) {
612
+ matrix.a = 0;
613
+ }
614
+ else {
615
+ matrix.a = scaleX * $Math.cos(radianX);
616
+ }
617
+ matrix.c = -scaleY * $Math.sin(radianY);
618
+ if (matrix.c === 1 || matrix.c === -1) {
619
+ matrix.d = 0;
620
+ }
621
+ else {
622
+ matrix.d = scaleY * $Math.cos(radianY);
623
+ }
624
+ }
625
+ transform.matrix = matrix;
626
+ $poolMatrix(matrix);
627
+ this._$rotation = rotation;
628
+ }
629
+ /**
630
+ * @description 現在有効な拡大 / 縮小グリッドです。
631
+ * The current scaling grid that is in effect.
632
+ *
633
+ * @member {Rectangle}
634
+ * @public
635
+ */
636
+ get scale9Grid() {
637
+ return this._$scale9Grid;
638
+ }
639
+ set scale9Grid(scale_9_grid) {
640
+ if (this._$scale9Grid !== scale_9_grid) {
641
+ this._$scale9Grid = scale_9_grid;
642
+ this._$doChanged();
643
+ $doUpdated();
644
+ }
645
+ }
646
+ /**
647
+ * @description 基準点から適用されるオブジェクトの水平スケール(パーセンテージ)を示します。
648
+ * Indicates the horizontal scale (percentage)
649
+ * of the object as applied from the registration point.
650
+ *
651
+ * @member {number}
652
+ * @public
653
+ */
654
+ get scaleX() {
655
+ if (this._$scaleX !== null) {
656
+ return this._$scaleX;
657
+ }
658
+ const matrix = this._$transform._$rawMatrix();
659
+ let xScale = $Math.sqrt(matrix[0] * matrix[0]
660
+ + matrix[1] * matrix[1]);
661
+ if (!$Number.isInteger(xScale)) {
662
+ const value = xScale.toString();
663
+ const index = value.indexOf("e");
664
+ if (index !== -1) {
665
+ xScale = +value.slice(0, index);
666
+ }
667
+ xScale = +xScale.toFixed(4);
668
+ }
669
+ return 0 > matrix[0] ? xScale * -1 : xScale;
670
+ }
671
+ set scaleX(scale_x) {
672
+ scale_x = $clamp(+scale_x, $SHORT_INT_MIN, $SHORT_INT_MAX);
673
+ if (!$Number.isInteger(scale_x)) {
674
+ const value = scale_x.toString();
675
+ const index = value.indexOf("e");
676
+ if (index !== -1) {
677
+ scale_x = +value.slice(0, index);
678
+ }
679
+ scale_x = +scale_x.toFixed(4);
680
+ }
681
+ if (this._$scaleX === scale_x) {
682
+ return;
683
+ }
684
+ const transform = this._$transform;
685
+ const matrix = transform.matrix;
686
+ if (matrix.b === 0 || $isNaN(matrix.b)) {
687
+ matrix.a = scale_x;
688
+ }
689
+ else {
690
+ let radianX = $Math.atan2(matrix.b, matrix.a);
691
+ if (radianX === -$Math.PI) {
692
+ radianX = 0;
693
+ }
694
+ matrix.b = scale_x * $Math.sin(radianX);
695
+ matrix.a = scale_x * $Math.cos(radianX);
696
+ }
697
+ transform.matrix = matrix;
698
+ $poolMatrix(matrix);
699
+ this._$scaleX = scale_x;
700
+ }
701
+ /**
702
+ * @description 基準点から適用されるオブジェクトの垂直スケール(パーセンテージ)を示します。
703
+ * IIndicates the vertical scale (percentage)
704
+ * of an object as applied from the registration point.
705
+ *
706
+ * @member {number}
707
+ * @public
708
+ */
709
+ get scaleY() {
710
+ if (this._$scaleY !== null) {
711
+ return this._$scaleY;
712
+ }
713
+ const matrix = this._$transform._$rawMatrix();
714
+ let yScale = $Math.sqrt(matrix[2] * matrix[2]
715
+ + matrix[3] * matrix[3]);
716
+ if (!$Number.isInteger(yScale)) {
717
+ const value = yScale.toString();
718
+ const index = value.indexOf("e");
719
+ if (index !== -1) {
720
+ yScale = +value.slice(0, index);
721
+ }
722
+ yScale = +yScale.toFixed(4);
723
+ }
724
+ return 0 > matrix[3] ? yScale * -1 : yScale;
725
+ }
726
+ set scaleY(scale_y) {
727
+ scale_y = $clamp(+scale_y, $SHORT_INT_MIN, $SHORT_INT_MAX);
728
+ if (!$Number.isInteger(scale_y)) {
729
+ const value = scale_y.toString();
730
+ const index = value.indexOf("e");
731
+ if (index !== -1) {
732
+ scale_y = +value.slice(0, index);
733
+ }
734
+ scale_y = +scale_y.toFixed(4);
735
+ }
736
+ if (this._$scaleY === scale_y) {
737
+ return;
738
+ }
739
+ const transform = this._$transform;
740
+ const matrix = transform.matrix;
741
+ if (matrix.c === 0 || $isNaN(matrix.c)) {
742
+ matrix.d = scale_y;
743
+ }
744
+ else {
745
+ let radianY = $Math.atan2(-matrix.c, matrix.d);
746
+ if (radianY === -$Math.PI) {
747
+ radianY = 0;
748
+ }
749
+ matrix.c = -scale_y * $Math.sin(radianY);
750
+ matrix.d = scale_y * $Math.cos(radianY);
751
+ }
752
+ transform.matrix = matrix;
753
+ $poolMatrix(matrix);
754
+ this._$scaleY = scale_y;
755
+ }
756
+ /**
757
+ * @description 表示オブジェクトのステージです。
758
+ * The Stage of the display object.
759
+ *
760
+ * @member {Stage}
761
+ * @readonly
762
+ * @public
763
+ */
764
+ get stage() {
765
+ if (this._$stage) {
766
+ return this._$stage;
767
+ }
768
+ // find parent
769
+ const parent = this._$parent;
770
+ if (parent) {
771
+ return parent._$stage;
772
+ }
773
+ return null;
774
+ }
775
+ /**
776
+ * @description 表示オブジェクトのマトリックス、カラー変換、
777
+ * ピクセル境界に関係するプロパティを持つオブジェクトです。
778
+ * An object with properties pertaining
779
+ * to a display object's matrix, color transform, and pixel bounds.
780
+ *
781
+ * @member {Transform}
782
+ * @public
783
+ */
784
+ get transform() {
785
+ return this._$transform;
786
+ }
787
+ set transform(transform) {
788
+ this._$transform = transform;
789
+ }
790
+ /**
791
+ * @description 表示オブジェクトが可視かどうかを示します。
792
+ * Whether or not the display object is visible.
793
+ *
794
+ * @member {boolean}
795
+ * @public
796
+ */
797
+ get visible() {
798
+ return this._$visible;
799
+ }
800
+ set visible(visible) {
801
+ if (this._$visible !== visible) {
802
+ this._$visible = !!visible;
803
+ this._$doChanged();
804
+ $doUpdated();
805
+ }
806
+ }
807
+ /**
808
+ * @description 表示オブジェクトの幅を示します(ピクセル単位)。
809
+ * Indicates the width of the display object, in pixels.
810
+ *
811
+ * @member {number}
812
+ * @public
813
+ */
814
+ get width() {
815
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
816
+ ? this._$getBounds()
817
+ : $getBoundsObject();
818
+ const bounds = $boundsMatrix(baseBounds, this._$transform._$rawMatrix());
819
+ $poolBoundsObject(baseBounds);
820
+ const width = $Math.abs(bounds.xMax - bounds.xMin);
821
+ $poolBoundsObject(bounds);
822
+ switch (true) {
823
+ case width === 0:
824
+ case width === $Infinity:
825
+ case width === 0 - $Infinity:
826
+ return 0;
827
+ default:
828
+ return +width.toFixed(2);
829
+ }
830
+ }
831
+ set width(width) {
832
+ width = +width;
833
+ if (!$isNaN(width) && width > -1) {
834
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
835
+ ? this._$getBounds()
836
+ : $getBoundsObject();
837
+ const rotation = this.rotation;
838
+ const bounds = rotation
839
+ ? $boundsMatrix(baseBounds, this._$transform._$rawMatrix())
840
+ : baseBounds;
841
+ if (rotation) {
842
+ $poolBoundsObject(baseBounds);
843
+ }
844
+ const exWidth = $Math.abs(bounds.xMax - bounds.xMin);
845
+ $poolBoundsObject(bounds);
846
+ switch (true) {
847
+ case exWidth === 0:
848
+ case exWidth === $Infinity:
849
+ case exWidth === -$Infinity:
850
+ this.scaleX = 0;
851
+ break;
852
+ default:
853
+ this.scaleX = width / exWidth;
854
+ break;
855
+ }
856
+ }
857
+ }
858
+ /**
859
+ * @description 親 DisplayObjectContainer のローカル座標を基準にした
860
+ * DisplayObject インスタンスの x 座標を示します。
861
+ * Indicates the x coordinate
862
+ * of the DisplayObject instance relative to the local coordinates
863
+ * of the parent DisplayObjectContainer.
864
+ *
865
+ * @member {number}
866
+ * @public
867
+ */
868
+ get x() {
869
+ return this._$transform._$rawMatrix()[4];
870
+ }
871
+ set x(x) {
872
+ const transform = this._$transform;
873
+ const matrix = transform.matrix;
874
+ matrix.tx = x;
875
+ transform.matrix = matrix;
876
+ $poolMatrix(matrix);
877
+ }
878
+ /**
879
+ * @description 親 DisplayObjectContainer のローカル座標を基準にした
880
+ * DisplayObject インスタンスの y 座標を示します。
881
+ * Indicates the y coordinate
882
+ * of the DisplayObject instance relative to the local coordinates
883
+ * of the parent DisplayObjectContainer.
884
+ *
885
+ * @member {number}
886
+ * @public
887
+ */
888
+ get y() {
889
+ return this._$transform._$rawMatrix()[5];
890
+ }
891
+ set y(y) {
892
+ const transform = this._$transform;
893
+ const matrix = transform.matrix;
894
+ matrix.ty = y;
895
+ transform.matrix = matrix;
896
+ $poolMatrix(matrix);
897
+ }
898
+ /**
899
+ * @description targetCoordinateSpace オブジェクトの座標系を基準にして、
900
+ * 表示オブジェクトの領域を定義する矩形を返します。
901
+ * Returns a rectangle that defines the area
902
+ * of the display object relative to the coordinate system
903
+ * of the targetCoordinateSpace object.
904
+ *
905
+ * @param {DisplayObject} [target=null]
906
+ * @return {Rectangle}
907
+ */
908
+ getBounds(target = null) {
909
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
910
+ ? this._$getBounds()
911
+ : $getBoundsObject();
912
+ const matrix = this._$transform.concatenatedMatrix;
913
+ // to global
914
+ const bounds = $boundsMatrix(baseBounds, matrix._$matrix);
915
+ // pool
916
+ $poolMatrix(matrix);
917
+ $poolBoundsObject(baseBounds);
918
+ // create bounds object
919
+ const targetBaseBounds = $getBoundsObject(bounds.xMin, bounds.xMax, bounds.yMin, bounds.yMax);
920
+ // pool
921
+ $poolBoundsObject(bounds);
922
+ if (!target) {
923
+ target = this;
924
+ }
925
+ const targetMatrix = target._$transform.concatenatedMatrix;
926
+ targetMatrix.invert();
927
+ const resultBounds = $boundsMatrix(targetBaseBounds, targetMatrix._$matrix);
928
+ $poolBoundsObject(targetBaseBounds);
929
+ $poolMatrix(targetMatrix);
930
+ const xMin = resultBounds.xMin;
931
+ const yMin = resultBounds.yMin;
932
+ const xMax = resultBounds.xMax;
933
+ const yMax = resultBounds.yMax;
934
+ // pool
935
+ $poolBoundsObject(resultBounds);
936
+ return new Rectangle(xMin, yMin, $Math.abs(xMax - xMin), $Math.abs(yMax - yMin));
937
+ }
938
+ /**
939
+ * @description point オブジェクトをステージ(グローバル)座標から
940
+ * 表示オブジェクトの(ローカル)座標に変換します。
941
+ * Converts the point object from the Stage (global) coordinates
942
+ * to the display object's (local) coordinates.
943
+ *
944
+ * @param {Point} point
945
+ * @return {Point}
946
+ * @public
947
+ */
948
+ globalToLocal(point) {
949
+ const matrix = this._$transform.concatenatedMatrix;
950
+ matrix.invert();
951
+ const newPoint = new Point(point.x * matrix.a + point.y * matrix.c + matrix.tx, point.x * matrix.b + point.y * matrix.d + matrix.ty);
952
+ $poolMatrix(matrix);
953
+ return newPoint;
954
+ }
955
+ /**
956
+ * @description 表示オブジェクトの境界ボックスを評価して、
957
+ * obj 表示オブジェクトの境界ボックスと重複または交差するかどうかを調べます。
958
+ * Evaluates the bounding box of the display object to see
959
+ * if it overlaps or intersects with the bounding box of the obj display object.
960
+ *
961
+ * @param {DisplayObject} object
962
+ * @returns {boolean}
963
+ * @public
964
+ */
965
+ hitTestObject(object) {
966
+ const baseBounds1 = "_$getBounds" in this && typeof this._$getBounds === "function"
967
+ ? this._$getBounds()
968
+ : $getBoundsObject();
969
+ const matrix1 = this._$transform.concatenatedMatrix;
970
+ const bounds1 = $boundsMatrix(baseBounds1, matrix1._$matrix);
971
+ // pool
972
+ $poolMatrix(matrix1);
973
+ $poolBoundsObject(baseBounds1);
974
+ const baseBounds2 = object._$getBounds(null);
975
+ const matrix2 = object._$transform.concatenatedMatrix;
976
+ const bounds2 = $boundsMatrix(baseBounds2, matrix2._$matrix);
977
+ // pool
978
+ $poolMatrix(matrix2);
979
+ $poolBoundsObject(baseBounds2);
980
+ // calc
981
+ const sx = $Math.max(bounds1.xMin, bounds2.xMin);
982
+ const sy = $Math.max(bounds1.yMin, bounds2.yMin);
983
+ const ex = $Math.min(bounds1.xMax, bounds2.xMax);
984
+ const ey = $Math.min(bounds1.yMax, bounds2.yMax);
985
+ // pool
986
+ $poolBoundsObject(bounds1);
987
+ $poolBoundsObject(bounds2);
988
+ return ex - sx >= 0 && ey - sy >= 0;
989
+ }
990
+ /**
991
+ * @description 表示オブジェクトを評価して、x および y パラメーターで指定された
992
+ * ポイントと重複または交差するかどうかを調べます。
993
+ * Evaluates the display object to see if it overlaps
994
+ * or intersects with the point specified by the x and y parameters.
995
+ *
996
+ * @param {number} x
997
+ * @param {number} y
998
+ * @param {boolean} [shape_flag=false]
999
+ * @returns {boolean}
1000
+ * @public
1001
+ */
1002
+ hitTestPoint(x, y, shape_flag = false) {
1003
+ if (shape_flag) {
1004
+ let matrix = $MATRIX_ARRAY_IDENTITY;
1005
+ let parent = this._$parent;
1006
+ while (parent) {
1007
+ matrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), matrix);
1008
+ parent = parent._$parent;
1009
+ }
1010
+ $hitContext.setTransform(1, 0, 0, 1, 0, 0);
1011
+ $hitContext.beginPath();
1012
+ let result = false;
1013
+ if ("_$hit" in this && typeof this._$hit === "function") {
1014
+ result = this._$hit($hitContext, matrix, { "x": x, "y": y }, true);
1015
+ }
1016
+ if (matrix !== $MATRIX_ARRAY_IDENTITY) {
1017
+ $poolFloat32Array6(matrix);
1018
+ }
1019
+ return result;
1020
+ }
1021
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
1022
+ ? this._$getBounds()
1023
+ : $getBoundsObject();
1024
+ const bounds = $boundsMatrix(baseBounds, this._$transform._$rawMatrix());
1025
+ $poolBoundsObject(baseBounds);
1026
+ const rectangle = new Rectangle(bounds.xMin, bounds.yMin, bounds.xMax - bounds.xMin, bounds.yMax - bounds.yMin);
1027
+ // pool
1028
+ $poolBoundsObject(bounds);
1029
+ const point = this._$parent
1030
+ ? this._$parent.globalToLocal(new Point(x, y))
1031
+ : new Point(x, y);
1032
+ return rectangle.containsPoint(point);
1033
+ }
1034
+ /**
1035
+ * @description point オブジェクトを表示オブジェクトの(ローカル)座標から
1036
+ * ステージ(グローバル)座標に変換します。
1037
+ * Converts the point object from the display object's (local) coordinates
1038
+ * to the Stage (global) coordinates.
1039
+ *
1040
+ *
1041
+ * @param {Point} point
1042
+ * @returns {Point}
1043
+ * @public
1044
+ */
1045
+ localToGlobal(point) {
1046
+ const matrix = this
1047
+ ._$transform
1048
+ .concatenatedMatrix;
1049
+ const newPoint = new Point(point.x * matrix.a + point.y * matrix.c + matrix.tx, point.x * matrix.b + point.y * matrix.d + matrix.ty);
1050
+ $poolMatrix(matrix);
1051
+ return newPoint;
1052
+ }
1053
+ /**
1054
+ * @description クラスのローカル変数空間から値を取得
1055
+ * Get a value from the local variable space of the class
1056
+ *
1057
+ * @param {*} key
1058
+ * @return {*}
1059
+ * @method
1060
+ * @public
1061
+ */
1062
+ getLocalVariable(key) {
1063
+ if (!this._$variables) {
1064
+ return null;
1065
+ }
1066
+ if (this._$variables.has(key)) {
1067
+ return this._$variables.get(key);
1068
+ }
1069
+ }
1070
+ /**
1071
+ * @description クラスのローカル変数空間へ値を保存
1072
+ * Store values in the local variable space of the class
1073
+ *
1074
+ * @param {*} key
1075
+ * @param {*} value
1076
+ * @return {void}
1077
+ * @method
1078
+ * @public
1079
+ */
1080
+ setLocalVariable(key, value) {
1081
+ if (!this._$variables) {
1082
+ this._$variables = $getMap();
1083
+ }
1084
+ this._$variables.set(key, value);
1085
+ }
1086
+ /**
1087
+ * @description クラスのローカル変数空間に値があるかどうかを判断します。
1088
+ * Determines if there is a value in the local variable space of the class.
1089
+ *
1090
+ * @param {*} key
1091
+ * @return {boolean}
1092
+ * @method
1093
+ * @public
1094
+ */
1095
+ hasLocalVariable(key) {
1096
+ return this._$variables
1097
+ ? this._$variables.has(key)
1098
+ : false;
1099
+ }
1100
+ /**
1101
+ * @description クラスのローカル変数空間の値を削除
1102
+ * Remove values from the local variable space of a class
1103
+ *
1104
+ * @param {*} key
1105
+ * @return {void}
1106
+ * @method
1107
+ * @public
1108
+ */
1109
+ deleteLocalVariable(key) {
1110
+ if (this._$variables && this._$variables.has(key)) {
1111
+ this._$variables.delete(key);
1112
+ if (!this._$variables.size) {
1113
+ $poolMap(this._$variables);
1114
+ this._$variables = null;
1115
+ }
1116
+ }
1117
+ }
1118
+ /**
1119
+ * @description グローバル変数空間から値を取得
1120
+ * Get a value from the global variable space
1121
+ *
1122
+ * @param {*} key
1123
+ * @return {*}
1124
+ * @method
1125
+ * @public
1126
+ */
1127
+ getGlobalVariable(key) {
1128
+ if ($variables.has(key)) {
1129
+ return $variables.get(key);
1130
+ }
1131
+ return null;
1132
+ }
1133
+ /**
1134
+ * @description グローバル変数空間へ値を保存
1135
+ * Save values to global variable space
1136
+ *
1137
+ * @param {*} key
1138
+ * @param {*} value
1139
+ * @return {void}
1140
+ * @method
1141
+ * @public
1142
+ */
1143
+ setGlobalVariable(key, value) {
1144
+ $variables.set(key, value);
1145
+ }
1146
+ /**
1147
+ * @description グローバル変数空間に値があるかどうかを判断します。
1148
+ * Determines if there is a value in the global variable space.
1149
+ *
1150
+ * @param {*} key
1151
+ * @return {boolean}
1152
+ * @method
1153
+ * @public
1154
+ */
1155
+ hasGlobalVariable(key) {
1156
+ return $variables.has(key);
1157
+ }
1158
+ /**
1159
+ * @description グローバル変数空間の値を削除
1160
+ * Remove values from global variable space.
1161
+ *
1162
+ * @param {*} key
1163
+ * @return {void}
1164
+ * @method
1165
+ * @public
1166
+ */
1167
+ deleteGlobalVariable(key) {
1168
+ if ($variables.has(key)) {
1169
+ $variables.delete(key);
1170
+ }
1171
+ }
1172
+ /**
1173
+ * @description グローバル変数空間に値を全てクリアします。
1174
+ * Clear all values in the global variable space.
1175
+ *
1176
+ * @return {void}
1177
+ * @method
1178
+ * @public
1179
+ */
1180
+ clearGlobalVariable() {
1181
+ return $variables.clear();
1182
+ }
1183
+ /**
1184
+ * @return {object}
1185
+ * @method
1186
+ * @private
1187
+ */
1188
+ _$getPlaceObject() {
1189
+ if (!this._$placeObject) {
1190
+ const placeId = this._$placeId;
1191
+ if (placeId === -1) {
1192
+ return null;
1193
+ }
1194
+ const parent = this._$parent;
1195
+ if (!parent || !parent._$placeObjects) {
1196
+ return null;
1197
+ }
1198
+ const placeMap = parent._$placeMap;
1199
+ if (!placeMap || !placeMap.length) {
1200
+ return null;
1201
+ }
1202
+ const frame = "currentFrame" in parent ? parent.currentFrame : 1;
1203
+ const places = placeMap[frame];
1204
+ if (!places) {
1205
+ return null;
1206
+ }
1207
+ const currentPlaceId = places[placeId] | 0;
1208
+ const placeObject = parent._$placeObjects[currentPlaceId];
1209
+ if (!placeObject) {
1210
+ return null;
1211
+ }
1212
+ this._$changePlace = currentPlaceId !== this._$currentPlaceId;
1213
+ this._$currentPlaceId = currentPlaceId;
1214
+ this._$placeObject = placeObject;
1215
+ return placeObject;
1216
+ }
1217
+ return this._$placeObject;
1218
+ }
1219
+ /**
1220
+ * @return {object}
1221
+ * @method
1222
+ * @private
1223
+ */
1224
+ _$sync() {
1225
+ const name = this.namespace;
1226
+ let loaderInfo = null;
1227
+ if ($window.next2d.fw && $window.next2d.fw.loaderInfo.has(name)) {
1228
+ loaderInfo = $window.next2d.fw.loaderInfo.get(name)._$loaderInfo;
1229
+ }
1230
+ if (!loaderInfo) {
1231
+ loaderInfo = this._$loaderInfo || $getCurrentLoaderInfo();
1232
+ }
1233
+ if (!loaderInfo || !loaderInfo._$data) {
1234
+ return null;
1235
+ }
1236
+ const characterId = loaderInfo._$data.symbols.get(name);
1237
+ if (!characterId) {
1238
+ return null;
1239
+ }
1240
+ const character = loaderInfo._$data.characters[characterId];
1241
+ if (!character) {
1242
+ return null;
1243
+ }
1244
+ this._$characterId = characterId;
1245
+ this._$loaderInfo = loaderInfo;
1246
+ return character;
1247
+ }
1248
+ /**
1249
+ * @param {object} tag
1250
+ * @param {DisplayObjectContainer} parent
1251
+ * @return {object}
1252
+ * @method
1253
+ * @private
1254
+ */
1255
+ _$baseBuild(tag, parent) {
1256
+ const loaderInfo = parent._$loaderInfo;
1257
+ if (!loaderInfo || !loaderInfo._$data) {
1258
+ throw new Error("the loaderInfo or data is nul.");
1259
+ }
1260
+ // setup
1261
+ this._$parent = parent;
1262
+ this._$root = parent._$root;
1263
+ this._$stage = parent._$stage;
1264
+ this._$loaderInfo = loaderInfo;
1265
+ // bind tag data
1266
+ this._$characterId = tag.characterId | 0;
1267
+ this._$clipDepth = tag.clipDepth | 0;
1268
+ this._$startFrame = tag.startFrame | 0;
1269
+ this._$endFrame = tag.endFrame | 0;
1270
+ this._$name = tag.name || "";
1271
+ return loaderInfo._$data.characters[tag.characterId];
1272
+ }
1273
+ /**
1274
+ * @return {boolean}
1275
+ * @method
1276
+ * @private
1277
+ */
1278
+ _$isUpdated() {
1279
+ return this._$updated;
1280
+ }
1281
+ /**
1282
+ * @return {void}
1283
+ * @method
1284
+ * @private
1285
+ */
1286
+ _$updateState() {
1287
+ this._$isNext = true;
1288
+ const parent = this._$parent;
1289
+ if (parent) {
1290
+ parent._$updateState();
1291
+ }
1292
+ }
1293
+ /**
1294
+ * @return {object}
1295
+ * @method
1296
+ * @private
1297
+ */
1298
+ _$doChanged() {
1299
+ if ($rendererWorker && this._$created) {
1300
+ $rendererWorker.postMessage({
1301
+ "command": "doChanged",
1302
+ "instanceId": this._$instanceId
1303
+ });
1304
+ }
1305
+ this._$posted = false;
1306
+ this._$isNext = true;
1307
+ this._$updated = true;
1308
+ const parent = this._$parent;
1309
+ if (parent) {
1310
+ parent._$doChanged();
1311
+ }
1312
+ }
1313
+ /**
1314
+ * @param {CanvasToWebGLContext} context
1315
+ * @param {WebGLTexture} target_texture
1316
+ * @param {Float32Array} matrix
1317
+ * @param {array} filters
1318
+ * @param {number} width
1319
+ * @param {number} height
1320
+ * @return {WebGLTexture}
1321
+ * @method
1322
+ * @private
1323
+ */
1324
+ _$drawFilter(context, target_texture, matrix, filters, width, height) {
1325
+ const player = $currentPlayer();
1326
+ const cacheStore = player.cacheStore;
1327
+ const cacheKeys = [this._$instanceId, "f"];
1328
+ const cache = cacheStore.get(cacheKeys);
1329
+ const updated = this._$isFilterUpdated(width, height, matrix, filters, true);
1330
+ if (cache && !updated) {
1331
+ return cache;
1332
+ }
1333
+ // cache clear
1334
+ if (cache) {
1335
+ cacheStore.set(cacheKeys, null);
1336
+ cache.layerWidth = 0;
1337
+ cache.layerHeight = 0;
1338
+ cache._$offsetX = 0;
1339
+ cache._$offsetY = 0;
1340
+ cache.matrix = null;
1341
+ cache.colorTransform = null;
1342
+ context
1343
+ .frameBuffer
1344
+ .releaseTexture(cache);
1345
+ }
1346
+ if (!cache || updated) {
1347
+ const texture = this._$applyFilter(context, filters, target_texture, matrix, width, height);
1348
+ cacheStore.set(cacheKeys, texture);
1349
+ return texture;
1350
+ }
1351
+ return cache;
1352
+ }
1353
+ /**
1354
+ * @param {array} [matrix=null]
1355
+ * @returns {object}
1356
+ * @private
1357
+ */
1358
+ _$getLayerBounds(matrix = null) {
1359
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
1360
+ ? this._$getBounds(matrix)
1361
+ : $getBoundsObject();
1362
+ if (!matrix) {
1363
+ return baseBounds;
1364
+ }
1365
+ const filters = this._$filters || this.filters;
1366
+ if (!filters.length) {
1367
+ return baseBounds;
1368
+ }
1369
+ let rect = new Rectangle(baseBounds.xMin, baseBounds.yMin, baseBounds.xMax - baseBounds.xMin, baseBounds.yMax - baseBounds.yMin);
1370
+ $poolBoundsObject(baseBounds);
1371
+ for (let idx = 0; idx < filters.length; ++idx) {
1372
+ rect = filters[idx]
1373
+ ._$generateFilterRect(rect, 0, 0);
1374
+ }
1375
+ return $getBoundsObject(rect.x, rect.x + rect.width, rect.y, rect.y + rect.height);
1376
+ }
1377
+ /**
1378
+ * @return {void}
1379
+ * @method
1380
+ * @private
1381
+ */
1382
+ _$executeAddedEvent() {
1383
+ if (!this._$parent) {
1384
+ return;
1385
+ }
1386
+ // add event
1387
+ if (!this._$added) {
1388
+ // added event
1389
+ if (this.willTrigger(Next2DEvent.ADDED)) {
1390
+ this.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED, true));
1391
+ }
1392
+ // update
1393
+ this._$added = true;
1394
+ }
1395
+ if (!this._$addedStage && this._$stage !== null) {
1396
+ if (this.willTrigger(Next2DEvent.ADDED_TO_STAGE)) {
1397
+ this.dispatchEvent(new Next2DEvent(Next2DEvent.ADDED_TO_STAGE));
1398
+ }
1399
+ // update
1400
+ this._$addedStage = true;
1401
+ }
1402
+ }
1403
+ /**
1404
+ * @return {void}
1405
+ * @method
1406
+ * @private
1407
+ */
1408
+ _$prepareActions() {
1409
+ this._$nextFrame();
1410
+ }
1411
+ /**
1412
+ * @return {boolean}
1413
+ * @method
1414
+ * @private
1415
+ */
1416
+ _$nextFrame() {
1417
+ // added event
1418
+ this._$executeAddedEvent();
1419
+ this._$isNext = false;
1420
+ if (!this._$posted && $rendererWorker) {
1421
+ // @ts-ignore
1422
+ this._$postProperty();
1423
+ }
1424
+ return false;
1425
+ }
1426
+ /**
1427
+ * @param {array} [filters=null]
1428
+ * @return {boolean}
1429
+ * @private
1430
+ */
1431
+ _$canApply(filters = null) {
1432
+ if (filters) {
1433
+ for (let idx = 0; idx < filters.length; ++idx) {
1434
+ if (filters[idx]._$canApply()) {
1435
+ return true;
1436
+ }
1437
+ }
1438
+ }
1439
+ return false;
1440
+ }
1441
+ /**
1442
+ * @param {number} width
1443
+ * @param {number} height
1444
+ * @param {Float32Array} matrix
1445
+ * @param {array} [filters=null]
1446
+ * @param {boolean} [can_apply=false]
1447
+ * @param {number} [position_x=0]
1448
+ * @param {number} [position_y=0]
1449
+ * @return {boolean}
1450
+ * @private
1451
+ */
1452
+ _$isFilterUpdated(width, height, matrix, filters = null, can_apply = false, position_x = 0, position_y = 0) {
1453
+ // cache flag
1454
+ if (this._$isUpdated()) {
1455
+ return true;
1456
+ }
1457
+ // check filter data
1458
+ if (can_apply && filters) {
1459
+ for (let idx = 0; idx < filters.length; ++idx) {
1460
+ if (!filters[idx]._$isUpdated()) {
1461
+ continue;
1462
+ }
1463
+ return true;
1464
+ }
1465
+ }
1466
+ // check status
1467
+ const player = $currentPlayer();
1468
+ const cache = player.cacheStore.get([this._$instanceId, "f"]);
1469
+ switch (true) {
1470
+ case cache === null:
1471
+ case cache.filterState !== can_apply:
1472
+ case cache.layerWidth !== $Math.ceil(width):
1473
+ case cache.layerHeight !== $Math.ceil(height):
1474
+ case cache.matrix !==
1475
+ matrix[0] + "_" + matrix[1] + "_" + matrix[2] + "_" + matrix[3] + "_" +
1476
+ position_x + "_" + position_y:
1477
+ return true;
1478
+ default:
1479
+ break;
1480
+ }
1481
+ return false;
1482
+ }
1483
+ /**
1484
+ * @param {CanvasToWebGLContext} context
1485
+ * @param {array} filters
1486
+ * @param {WebGLTexture} target_texture
1487
+ * @param {Float32Array} matrix
1488
+ * @param {number} width
1489
+ * @param {number} height
1490
+ * @return {WebGLTexture}
1491
+ * @private
1492
+ */
1493
+ _$applyFilter(context, filters, target_texture, matrix, width, height) {
1494
+ const xScale = +$Math.sqrt(matrix[0] * matrix[0]
1495
+ + matrix[1] * matrix[1]);
1496
+ const yScale = +$Math.sqrt(matrix[2] * matrix[2]
1497
+ + matrix[3] * matrix[3]);
1498
+ const radianX = $Math.atan2(matrix[1], matrix[0]);
1499
+ const radianY = $Math.atan2(-matrix[2], matrix[3]);
1500
+ const parentMatrix = $getFloat32Array6($Math.cos(radianX), $Math.sin(radianX), -$Math.sin(radianY), $Math.cos(radianY), width / 2, height / 2);
1501
+ const baseMatrix = $getFloat32Array6(1, 0, 0, 1, -target_texture.width / 2, -target_texture.height / 2);
1502
+ const multiMatrix = $multiplicationMatrix(parentMatrix, baseMatrix);
1503
+ $poolFloat32Array6(parentMatrix);
1504
+ $poolFloat32Array6(baseMatrix);
1505
+ const manager = context.frameBuffer;
1506
+ const currentAttachment = manager.currentAttachment;
1507
+ const attachment = manager
1508
+ .createCacheAttachment(width, height);
1509
+ context._$bind(attachment);
1510
+ context.reset();
1511
+ context.setTransform(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], multiMatrix[4], multiMatrix[5]);
1512
+ $poolFloat32Array6(multiMatrix);
1513
+ context.drawImage(target_texture, 0, 0, target_texture.width, target_texture.height);
1514
+ // init
1515
+ context._$offsetX = 0;
1516
+ context._$offsetY = 0;
1517
+ const filterMatrix = $getFloat32Array6(xScale, 0, 0, yScale, 0, 0);
1518
+ let texture = null;
1519
+ for (let idx = 0; idx < filters.length; ++idx) {
1520
+ texture = filters[idx]._$applyFilter(context, filterMatrix);
1521
+ }
1522
+ $poolFloat32Array6(filterMatrix);
1523
+ if (!texture) {
1524
+ return target_texture;
1525
+ }
1526
+ const offsetX = context._$offsetX;
1527
+ const offsetY = context._$offsetY;
1528
+ // reset
1529
+ context._$offsetX = 0;
1530
+ context._$offsetY = 0;
1531
+ // set offset
1532
+ texture._$offsetX = offsetX;
1533
+ texture._$offsetY = offsetY;
1534
+ // cache texture
1535
+ texture.matrix =
1536
+ matrix[0] + "_" + matrix[1] + "_"
1537
+ + matrix[2] + "_" + matrix[3];
1538
+ texture.filterState = true;
1539
+ texture.layerWidth = width;
1540
+ texture.layerHeight = height;
1541
+ context._$bind(currentAttachment);
1542
+ manager.releaseAttachment(attachment, false);
1543
+ return texture;
1544
+ }
1545
+ /**
1546
+ * @param {Float32Array} matrix
1547
+ * @return {boolean}
1548
+ * @method
1549
+ * @private
1550
+ */
1551
+ _$shouldClip(matrix) {
1552
+ const bounds = "_$getBounds" in this && typeof this._$getBounds === "function"
1553
+ ? this._$getBounds(matrix)
1554
+ : $getBoundsObject();
1555
+ const width = $Math.abs(bounds.xMax - bounds.xMin);
1556
+ const height = $Math.abs(bounds.yMax - bounds.yMin);
1557
+ $poolBoundsObject(bounds);
1558
+ // size 0
1559
+ return !(!width || !height);
1560
+ }
1561
+ /**
1562
+ * @param {CanvasToWebGLContext} context
1563
+ * @param {Float32Array} matrix
1564
+ * @return {Float32Array|boolean|null}
1565
+ * @method
1566
+ * @private
1567
+ */
1568
+ _$startClip(context, matrix) {
1569
+ let clipMatrix = null;
1570
+ // ネストしてない初回のマスクだけ実行
1571
+ // ネストしてる場合は初回に作られたbufferを流用
1572
+ if (!context.cacheAttachment) {
1573
+ let multiMatrix = matrix;
1574
+ const rawMatrix = this._$transform._$rawMatrix();
1575
+ if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
1576
+ || rawMatrix[2] !== 0 || rawMatrix[3] !== 1
1577
+ || rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
1578
+ multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
1579
+ }
1580
+ const baseBounds = "_$getBounds" in this && typeof this._$getBounds === "function"
1581
+ ? this._$getBounds()
1582
+ : $getBoundsObject();
1583
+ const bounds = $boundsMatrix(baseBounds, multiMatrix);
1584
+ $poolBoundsObject(baseBounds);
1585
+ clipMatrix = context._$startClip(matrix, bounds);
1586
+ $poolBoundsObject(bounds);
1587
+ if (multiMatrix !== matrix) {
1588
+ $poolFloat32Array6(multiMatrix);
1589
+ }
1590
+ if (!clipMatrix) {
1591
+ return false;
1592
+ }
1593
+ }
1594
+ // start clip
1595
+ context._$enterClip();
1596
+ // mask start
1597
+ context._$beginClipDef();
1598
+ let containerClip = false;
1599
+ if ("_$children" in this) {
1600
+ containerClip = true;
1601
+ context._$updateContainerClipFlag(true);
1602
+ }
1603
+ // @ts-ignore
1604
+ this._$clip(context, clipMatrix || matrix);
1605
+ this._$updated = false;
1606
+ // container clip
1607
+ if (containerClip) {
1608
+ // update flag
1609
+ context._$updateContainerClipFlag(false);
1610
+ // execute clip
1611
+ context._$drawContainerClip();
1612
+ }
1613
+ // mask end
1614
+ context._$endClipDef();
1615
+ return clipMatrix;
1616
+ }
1617
+ /**
1618
+ * @return {void}
1619
+ * @method
1620
+ * @private
1621
+ */
1622
+ _$removeWorkerInstance() {
1623
+ if ($rendererWorker) {
1624
+ $rendererWorker.postMessage({
1625
+ "command": "remove",
1626
+ "instanceId": this._$instanceId
1627
+ });
1628
+ }
1629
+ }
1630
+ /**
1631
+ * @return {object}
1632
+ * @method
1633
+ * @private
1634
+ */
1635
+ _$createMessage() {
1636
+ const message = {
1637
+ "command": "setProperty",
1638
+ "instanceId": this._$instanceId,
1639
+ "parentId": this._$parent ? this._$parent._$instanceId : -1,
1640
+ "visible": this._$visible,
1641
+ "isMask": this._$isMask,
1642
+ "clipDepth": this._$clipDepth,
1643
+ "depth": this._$placeId,
1644
+ "maskId": -1
1645
+ };
1646
+ const mask = this._$mask;
1647
+ if (mask) {
1648
+ message.maskId = mask._$instanceId;
1649
+ let maskMatrix = $MATRIX_ARRAY_IDENTITY;
1650
+ let parent = mask._$parent;
1651
+ while (parent) {
1652
+ maskMatrix = $multiplicationMatrix(parent._$transform._$rawMatrix(), maskMatrix);
1653
+ parent = parent._$parent;
1654
+ }
1655
+ message.maskMatrix = maskMatrix;
1656
+ }
1657
+ if (this._$visible) {
1658
+ const transform = this._$transform;
1659
+ const matrix = transform._$rawMatrix();
1660
+ if (matrix[0] !== 1) {
1661
+ message.a = matrix[0];
1662
+ }
1663
+ if (matrix[1] !== 0) {
1664
+ message.b = matrix[1];
1665
+ }
1666
+ if (matrix[2] !== 0) {
1667
+ message.c = matrix[2];
1668
+ }
1669
+ if (matrix[3] !== 1) {
1670
+ message.d = matrix[3];
1671
+ }
1672
+ if (matrix[4] !== 0) {
1673
+ message.tx = matrix[4];
1674
+ }
1675
+ if (matrix[5] !== 0) {
1676
+ message.ty = matrix[5];
1677
+ }
1678
+ const colorTransform = transform._$rawColorTransform();
1679
+ if (colorTransform[0] !== 1) {
1680
+ message.f0 = colorTransform[0];
1681
+ }
1682
+ if (colorTransform[1] !== 1) {
1683
+ message.f1 = colorTransform[1];
1684
+ }
1685
+ if (colorTransform[2] !== 1) {
1686
+ message.f2 = colorTransform[2];
1687
+ }
1688
+ if (colorTransform[3] !== 1) {
1689
+ message.f3 = colorTransform[3];
1690
+ }
1691
+ if (colorTransform[4] !== 0) {
1692
+ message.f4 = colorTransform[4];
1693
+ }
1694
+ if (colorTransform[5] !== 0) {
1695
+ message.f5 = colorTransform[5];
1696
+ }
1697
+ if (colorTransform[6] !== 0) {
1698
+ message.f6 = colorTransform[6];
1699
+ }
1700
+ if (colorTransform[7] !== 0) {
1701
+ message.f7 = colorTransform[7];
1702
+ }
1703
+ const filters = this._$filters || this.filters;
1704
+ if (filters && filters.length) {
1705
+ const parameters = $getArray();
1706
+ for (let idx = 0; idx < filters.length; ++idx) {
1707
+ parameters.push(filters[idx]._$toArray());
1708
+ }
1709
+ message.filters = parameters;
1710
+ }
1711
+ const blendMode = this._$blendMode || this.blendMode;
1712
+ if (blendMode !== "normal") {
1713
+ message.blendMode = blendMode;
1714
+ }
1715
+ const scale9Grid = this._$scale9Grid;
1716
+ if (scale9Grid && this._$isUpdated()) {
1717
+ const baseMatrix = this
1718
+ ._$parent
1719
+ ._$transform
1720
+ .concatenatedMatrix;
1721
+ message.matrixBase = baseMatrix._$matrix.slice();
1722
+ $poolMatrix(baseMatrix);
1723
+ message.grid = {
1724
+ "x": scale9Grid.x,
1725
+ "y": scale9Grid.y,
1726
+ "w": scale9Grid.width,
1727
+ "h": scale9Grid.height
1728
+ };
1729
+ }
1730
+ }
1731
+ return message;
1732
+ }
1733
+ }