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