safex-webgl 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +6 -0
- package/@types/index.d.ts +36 -0
- package/README.md +152 -0
- package/bun.lock +353 -0
- package/dist/actions/Action.d.ts +27 -0
- package/dist/actions/Action.d.ts.map +1 -0
- package/dist/actions/Action.js +62 -0
- package/dist/actions/Action.js.map +1 -0
- package/dist/actions/ActionBezier.d.ts +121 -0
- package/dist/actions/ActionBezier.d.ts.map +1 -0
- package/dist/actions/ActionBezier.js +221 -0
- package/dist/actions/ActionBezier.js.map +1 -0
- package/dist/actions/ActionBlink.d.ts +62 -0
- package/dist/actions/ActionBlink.d.ts.map +1 -0
- package/dist/actions/ActionBlink.js +96 -0
- package/dist/actions/ActionBlink.js.map +1 -0
- package/dist/actions/ActionCatmullRom.d.ts +242 -0
- package/dist/actions/ActionCatmullRom.d.ts.map +1 -0
- package/dist/actions/ActionCatmullRom.js +436 -0
- package/dist/actions/ActionCatmullRom.js.map +1 -0
- package/dist/actions/ActionFade.d.ts +126 -0
- package/dist/actions/ActionFade.d.ts.map +1 -0
- package/dist/actions/ActionFade.js +190 -0
- package/dist/actions/ActionFade.js.map +1 -0
- package/dist/actions/ActionInstant.d.ts +237 -0
- package/dist/actions/ActionInstant.d.ts.map +1 -0
- package/dist/actions/ActionInstant.js +386 -0
- package/dist/actions/ActionInstant.js.map +1 -0
- package/dist/actions/ActionInterval.d.ts +132 -0
- package/dist/actions/ActionInterval.d.ts.map +1 -0
- package/dist/actions/ActionInterval.js +254 -0
- package/dist/actions/ActionInterval.js.map +1 -0
- package/dist/actions/ActionJump.d.ts +146 -0
- package/dist/actions/ActionJump.d.ts.map +1 -0
- package/dist/actions/ActionJump.js +239 -0
- package/dist/actions/ActionJump.js.map +1 -0
- package/dist/actions/ActionMove.d.ts +73 -0
- package/dist/actions/ActionMove.d.ts.map +1 -0
- package/dist/actions/ActionMove.js +164 -0
- package/dist/actions/ActionMove.js.map +1 -0
- package/dist/actions/ActionRotate.d.ts +137 -0
- package/dist/actions/ActionRotate.d.ts.map +1 -0
- package/dist/actions/ActionRotate.js +214 -0
- package/dist/actions/ActionRotate.js.map +1 -0
- package/dist/actions/ActionScale.d.ts +110 -0
- package/dist/actions/ActionScale.d.ts.map +1 -0
- package/dist/actions/ActionScale.js +157 -0
- package/dist/actions/ActionScale.js.map +1 -0
- package/dist/actions/ActionSkew.d.ts +120 -0
- package/dist/actions/ActionSkew.d.ts.map +1 -0
- package/dist/actions/ActionSkew.js +185 -0
- package/dist/actions/ActionSkew.js.map +1 -0
- package/dist/actions/ActionTint.d.ts +132 -0
- package/dist/actions/ActionTint.d.ts.map +1 -0
- package/dist/actions/ActionTint.js +193 -0
- package/dist/actions/ActionTint.js.map +1 -0
- package/dist/actions/Animate.d.ts +77 -0
- package/dist/actions/Animate.d.ts.map +1 -0
- package/dist/actions/Animate.js +177 -0
- package/dist/actions/Animate.js.map +1 -0
- package/dist/actions/DelayTime.d.ts +95 -0
- package/dist/actions/DelayTime.d.ts.map +1 -0
- package/dist/actions/DelayTime.js +145 -0
- package/dist/actions/DelayTime.js.map +1 -0
- package/dist/actions/FiniteTimeAction.d.ts +11 -0
- package/dist/actions/FiniteTimeAction.d.ts.map +1 -0
- package/dist/actions/FiniteTimeAction.js +24 -0
- package/dist/actions/FiniteTimeAction.js.map +1 -0
- package/dist/actions/Follow.d.ts +23 -0
- package/dist/actions/Follow.d.ts.map +1 -0
- package/dist/actions/Follow.js +98 -0
- package/dist/actions/Follow.js.map +1 -0
- package/dist/actions/Repeat.d.ts +151 -0
- package/dist/actions/Repeat.d.ts.map +1 -0
- package/dist/actions/Repeat.js +276 -0
- package/dist/actions/Repeat.js.map +1 -0
- package/dist/actions/Sequence.d.ts +77 -0
- package/dist/actions/Sequence.d.ts.map +1 -0
- package/dist/actions/Sequence.js +190 -0
- package/dist/actions/Sequence.js.map +1 -0
- package/dist/actions/Spawn.d.ts +63 -0
- package/dist/actions/Spawn.d.ts.map +1 -0
- package/dist/actions/Spawn.js +146 -0
- package/dist/actions/Spawn.js.map +1 -0
- package/dist/actions/Speed.d.ts +19 -0
- package/dist/actions/Speed.d.ts.map +1 -0
- package/dist/actions/Speed.js +57 -0
- package/dist/actions/Speed.js.map +1 -0
- package/dist/actions/TargetedAction.d.ts +67 -0
- package/dist/actions/TargetedAction.d.ts.map +1 -0
- package/dist/actions/TargetedAction.js +99 -0
- package/dist/actions/TargetedAction.js.map +1 -0
- package/dist/actions/easing/ActionEase.d.ts +133 -0
- package/dist/actions/easing/ActionEase.d.ts.map +1 -0
- package/dist/actions/easing/ActionEase.js +184 -0
- package/dist/actions/easing/ActionEase.js.map +1 -0
- package/dist/actions/easing/Back.d.ts +174 -0
- package/dist/actions/easing/Back.d.ts.map +1 -0
- package/dist/actions/easing/Back.js +227 -0
- package/dist/actions/easing/Back.js.map +1 -0
- package/dist/actions/easing/Bezier.d.ts +94 -0
- package/dist/actions/easing/Bezier.d.ts.map +1 -0
- package/dist/actions/easing/Bezier.js +124 -0
- package/dist/actions/easing/Bezier.js.map +1 -0
- package/dist/actions/easing/Bounce.d.ts +203 -0
- package/dist/actions/easing/Bounce.d.ts.map +1 -0
- package/dist/actions/easing/Bounce.js +288 -0
- package/dist/actions/easing/Bounce.js.map +1 -0
- package/dist/actions/easing/Circle.d.ts +177 -0
- package/dist/actions/easing/Circle.d.ts.map +1 -0
- package/dist/actions/easing/Circle.js +220 -0
- package/dist/actions/easing/Circle.js.map +1 -0
- package/dist/actions/easing/Cubic.d.ts +165 -0
- package/dist/actions/easing/Cubic.d.ts.map +1 -0
- package/dist/actions/easing/Cubic.js +209 -0
- package/dist/actions/easing/Cubic.js.map +1 -0
- package/dist/actions/easing/Elastic.d.ts +269 -0
- package/dist/actions/easing/Elastic.d.ts.map +1 -0
- package/dist/actions/easing/Elastic.js +358 -0
- package/dist/actions/easing/Elastic.js.map +1 -0
- package/dist/actions/easing/Exponential.d.ts +181 -0
- package/dist/actions/easing/Exponential.d.ts.map +1 -0
- package/dist/actions/easing/Exponential.js +214 -0
- package/dist/actions/easing/Exponential.js.map +1 -0
- package/dist/actions/easing/InOut.d.ts +191 -0
- package/dist/actions/easing/InOut.d.ts.map +1 -0
- package/dist/actions/easing/InOut.js +254 -0
- package/dist/actions/easing/InOut.js.map +1 -0
- package/dist/actions/easing/Quartic.d.ts +232 -0
- package/dist/actions/easing/Quartic.d.ts.map +1 -0
- package/dist/actions/easing/Quartic.js +313 -0
- package/dist/actions/easing/Quartic.js.map +1 -0
- package/dist/actions/easing/Quintic.d.ts +168 -0
- package/dist/actions/easing/Quintic.d.ts.map +1 -0
- package/dist/actions/easing/Quintic.js +212 -0
- package/dist/actions/easing/Quintic.js.map +1 -0
- package/dist/actions/easing/Sine.d.ts +176 -0
- package/dist/actions/easing/Sine.d.ts.map +1 -0
- package/dist/actions/easing/Sine.js +206 -0
- package/dist/actions/easing/Sine.js.map +1 -0
- package/dist/actions/index.d.ts +16 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +16 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/audio/Audio.d.ts +47 -0
- package/dist/audio/Audio.d.ts.map +1 -0
- package/dist/audio/Audio.js +255 -0
- package/dist/audio/Audio.js.map +1 -0
- package/dist/audio/engine.d.ts +171 -0
- package/dist/audio/engine.d.ts.map +1 -0
- package/dist/audio/engine.js +556 -0
- package/dist/audio/engine.js.map +1 -0
- package/dist/audio/index.d.ts +3 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +3 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/boot.d.ts +80 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/boot.js +468 -0
- package/dist/boot.js.map +1 -0
- package/dist/clipping-nodes/ClippingNode.d.ts +114 -0
- package/dist/clipping-nodes/ClippingNode.d.ts.map +1 -0
- package/dist/clipping-nodes/ClippingNode.js +177 -0
- package/dist/clipping-nodes/ClippingNode.js.map +1 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts +25 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js +157 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js.map +1 -0
- package/dist/core/ActionManager.d.ts +56 -0
- package/dist/core/ActionManager.d.ts.map +1 -0
- package/dist/core/ActionManager.js +253 -0
- package/dist/core/ActionManager.js.map +1 -0
- package/dist/core/Configuration.d.ts +108 -0
- package/dist/core/Configuration.d.ts.map +1 -0
- package/dist/core/Configuration.js +232 -0
- package/dist/core/Configuration.js.map +1 -0
- package/dist/core/Director.d.ts +130 -0
- package/dist/core/Director.d.ts.map +1 -0
- package/dist/core/Director.js +580 -0
- package/dist/core/Director.js.map +1 -0
- package/dist/core/DrawingPrimitivesWebGL.d.ts +32 -0
- package/dist/core/DrawingPrimitivesWebGL.d.ts.map +1 -0
- package/dist/core/DrawingPrimitivesWebGL.js +273 -0
- package/dist/core/DrawingPrimitivesWebGL.js.map +1 -0
- package/dist/core/Scheduler.d.ts +110 -0
- package/dist/core/Scheduler.d.ts.map +1 -0
- package/dist/core/Scheduler.js +687 -0
- package/dist/core/Scheduler.js.map +1 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts +2 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts.map +1 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.js +37 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.js.map +1 -0
- package/dist/core/base-nodes/CustomRenderCmd.d.ts +9 -0
- package/dist/core/base-nodes/CustomRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/CustomRenderCmd.js +16 -0
- package/dist/core/base-nodes/CustomRenderCmd.js.map +1 -0
- package/dist/core/base-nodes/Node.d.ts +285 -0
- package/dist/core/base-nodes/Node.d.ts.map +1 -0
- package/dist/core/base-nodes/Node.js +1112 -0
- package/dist/core/base-nodes/Node.js.map +1 -0
- package/dist/core/base-nodes/NodeRenderCmd.d.ts +65 -0
- package/dist/core/base-nodes/NodeRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/NodeRenderCmd.js +460 -0
- package/dist/core/base-nodes/NodeRenderCmd.js.map +1 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts +17 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.js +29 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.js.map +1 -0
- package/dist/core/cocoa/AffineTransform.d.ts +201 -0
- package/dist/core/cocoa/AffineTransform.d.ts.map +1 -0
- package/dist/core/cocoa/AffineTransform.js +260 -0
- package/dist/core/cocoa/AffineTransform.js.map +1 -0
- package/dist/core/cocoa/Geometry.d.ts +176 -0
- package/dist/core/cocoa/Geometry.d.ts.map +1 -0
- package/dist/core/cocoa/Geometry.js +237 -0
- package/dist/core/cocoa/Geometry.js.map +1 -0
- package/dist/core/event-manager/Event.d.ts +57 -0
- package/dist/core/event-manager/Event.d.ts.map +1 -0
- package/dist/core/event-manager/Event.js +69 -0
- package/dist/core/event-manager/Event.js.map +1 -0
- package/dist/core/event-manager/EventCustom.d.ts +22 -0
- package/dist/core/event-manager/EventCustom.d.ts.map +1 -0
- package/dist/core/event-manager/EventCustom.js +31 -0
- package/dist/core/event-manager/EventCustom.js.map +1 -0
- package/dist/core/event-manager/EventExtension.d.ts +33 -0
- package/dist/core/event-manager/EventExtension.d.ts.map +1 -0
- package/dist/core/event-manager/EventExtension.js +80 -0
- package/dist/core/event-manager/EventExtension.js.map +1 -0
- package/dist/core/event-manager/EventFocus.d.ts +17 -0
- package/dist/core/event-manager/EventFocus.d.ts.map +1 -0
- package/dist/core/event-manager/EventFocus.js +21 -0
- package/dist/core/event-manager/EventFocus.js.map +1 -0
- package/dist/core/event-manager/EventHelper.d.ts +8 -0
- package/dist/core/event-manager/EventHelper.d.ts.map +1 -0
- package/dist/core/event-manager/EventHelper.js +92 -0
- package/dist/core/event-manager/EventHelper.js.map +1 -0
- package/dist/core/event-manager/EventListener.d.ts +53 -0
- package/dist/core/event-manager/EventListener.d.ts.map +1 -0
- package/dist/core/event-manager/EventListener.js +95 -0
- package/dist/core/event-manager/EventListener.js.map +1 -0
- package/dist/core/event-manager/EventListenerCustom.d.ts +11 -0
- package/dist/core/event-manager/EventListenerCustom.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerCustom.js +37 -0
- package/dist/core/event-manager/EventListenerCustom.js.map +1 -0
- package/dist/core/event-manager/EventListenerFocus.d.ts +10 -0
- package/dist/core/event-manager/EventListenerFocus.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerFocus.js +28 -0
- package/dist/core/event-manager/EventListenerFocus.js.map +1 -0
- package/dist/core/event-manager/EventListenerMouse.d.ts +13 -0
- package/dist/core/event-manager/EventListenerMouse.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerMouse.js +49 -0
- package/dist/core/event-manager/EventListenerMouse.js.map +1 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts +12 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.js +28 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.js.map +1 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts +16 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.js +38 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.js.map +1 -0
- package/dist/core/event-manager/EventListenerVector.d.ts +15 -0
- package/dist/core/event-manager/EventListenerVector.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerVector.js +38 -0
- package/dist/core/event-manager/EventListenerVector.js.map +1 -0
- package/dist/core/event-manager/EventManager.d.ts +140 -0
- package/dist/core/event-manager/EventManager.d.ts.map +1 -0
- package/dist/core/event-manager/EventManager.js +907 -0
- package/dist/core/event-manager/EventManager.js.map +1 -0
- package/dist/core/event-manager/EventMouse.d.ts +173 -0
- package/dist/core/event-manager/EventMouse.d.ts.map +1 -0
- package/dist/core/event-manager/EventMouse.js +200 -0
- package/dist/core/event-manager/EventMouse.js.map +1 -0
- package/dist/core/event-manager/EventTouch.d.ts +24 -0
- package/dist/core/event-manager/EventTouch.d.ts.map +1 -0
- package/dist/core/event-manager/EventTouch.js +33 -0
- package/dist/core/event-manager/EventTouch.js.map +1 -0
- package/dist/core/event-manager/Touch.d.ts +60 -0
- package/dist/core/event-manager/Touch.d.ts.map +1 -0
- package/dist/core/event-manager/Touch.js +94 -0
- package/dist/core/event-manager/Touch.js.map +1 -0
- package/dist/core/event-manager/index.d.ts +6 -0
- package/dist/core/event-manager/index.d.ts.map +1 -0
- package/dist/core/event-manager/index.js +6 -0
- package/dist/core/event-manager/index.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/kazmath/gl/mat4stack.d.ts +5 -0
- package/dist/core/kazmath/gl/mat4stack.d.ts.map +1 -0
- package/dist/core/kazmath/gl/mat4stack.js +53 -0
- package/dist/core/kazmath/gl/mat4stack.js.map +1 -0
- package/dist/core/kazmath/gl/matrix.d.ts +21 -0
- package/dist/core/kazmath/gl/matrix.d.ts.map +1 -0
- package/dist/core/kazmath/gl/matrix.js +121 -0
- package/dist/core/kazmath/gl/matrix.js.map +1 -0
- package/dist/core/kazmath/index.d.ts +7 -0
- package/dist/core/kazmath/index.d.ts.map +1 -0
- package/dist/core/kazmath/index.js +7 -0
- package/dist/core/kazmath/index.js.map +1 -0
- package/dist/core/kazmath/mat3.d.ts +45 -0
- package/dist/core/kazmath/mat3.d.ts.map +1 -0
- package/dist/core/kazmath/mat3.js +297 -0
- package/dist/core/kazmath/mat3.js.map +1 -0
- package/dist/core/kazmath/mat4.d.ts +175 -0
- package/dist/core/kazmath/mat4.d.ts.map +1 -0
- package/dist/core/kazmath/mat4.func.d.ts +44 -0
- package/dist/core/kazmath/mat4.func.d.ts.map +1 -0
- package/dist/core/kazmath/mat4.func.js +210 -0
- package/dist/core/kazmath/mat4.func.js.map +1 -0
- package/dist/core/kazmath/mat4.js +671 -0
- package/dist/core/kazmath/mat4.js.map +1 -0
- package/dist/core/kazmath/plane.d.ts +24 -0
- package/dist/core/kazmath/plane.d.ts.map +1 -0
- package/dist/core/kazmath/plane.js +96 -0
- package/dist/core/kazmath/plane.js.map +1 -0
- package/dist/core/kazmath/quaternion.d.ts +135 -0
- package/dist/core/kazmath/quaternion.d.ts.map +1 -0
- package/dist/core/kazmath/quaternion.js +407 -0
- package/dist/core/kazmath/quaternion.js.map +1 -0
- package/dist/core/kazmath/utility.d.ts +8 -0
- package/dist/core/kazmath/utility.d.ts.map +1 -0
- package/dist/core/kazmath/utility.js +14 -0
- package/dist/core/kazmath/utility.js.map +1 -0
- package/dist/core/kazmath/vec3.d.ts +26 -0
- package/dist/core/kazmath/vec3.d.ts.map +1 -0
- package/dist/core/kazmath/vec3.js +170 -0
- package/dist/core/kazmath/vec3.js.map +1 -0
- package/dist/core/kazmath/vec4.d.ts +22 -0
- package/dist/core/kazmath/vec4.d.ts.map +1 -0
- package/dist/core/kazmath/vec4.js +136 -0
- package/dist/core/kazmath/vec4.js.map +1 -0
- package/dist/core/labelttf/LabelTTF.d.ts +310 -0
- package/dist/core/labelttf/LabelTTF.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTF.js +818 -0
- package/dist/core/labelttf/LabelTTF.js.map +1 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts +2 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.js +27 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.js.map +1 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts +37 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js +367 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js.map +1 -0
- package/dist/core/layers/Layer.d.ts +35 -0
- package/dist/core/layers/Layer.d.ts.map +1 -0
- package/dist/core/layers/Layer.js +93 -0
- package/dist/core/layers/Layer.js.map +1 -0
- package/dist/core/layers/LayerColor.d.ts +61 -0
- package/dist/core/layers/LayerColor.d.ts.map +1 -0
- package/dist/core/layers/LayerColor.js +144 -0
- package/dist/core/layers/LayerColor.js.map +1 -0
- package/dist/core/layers/LayerGradient.d.ts +196 -0
- package/dist/core/layers/LayerGradient.d.ts.map +1 -0
- package/dist/core/layers/LayerGradient.js +482 -0
- package/dist/core/layers/LayerGradient.js.map +1 -0
- package/dist/core/layers/LayerMultiplex.d.ts +47 -0
- package/dist/core/layers/LayerMultiplex.d.ts.map +1 -0
- package/dist/core/layers/LayerMultiplex.js +87 -0
- package/dist/core/layers/LayerMultiplex.js.map +1 -0
- package/dist/core/layers/LayerWebGLRenderCmd.d.ts +26 -0
- package/dist/core/layers/LayerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/layers/LayerWebGLRenderCmd.js +100 -0
- package/dist/core/layers/LayerWebGLRenderCmd.js.map +1 -0
- package/dist/core/layers/index.d.ts +5 -0
- package/dist/core/layers/index.d.ts.map +1 -0
- package/dist/core/layers/index.js +5 -0
- package/dist/core/layers/index.js.map +1 -0
- package/dist/core/platform/BlendFunc.d.ts +30 -0
- package/dist/core/platform/BlendFunc.d.ts.map +1 -0
- package/dist/core/platform/BlendFunc.js +50 -0
- package/dist/core/platform/BlendFunc.js.map +1 -0
- package/dist/core/platform/Color.d.ts +31 -0
- package/dist/core/platform/Color.d.ts.map +1 -0
- package/dist/core/platform/Color.js +71 -0
- package/dist/core/platform/Color.js.map +1 -0
- package/dist/core/platform/Common.d.ts +157 -0
- package/dist/core/platform/Common.d.ts.map +1 -0
- package/dist/core/platform/Common.js +180 -0
- package/dist/core/platform/Common.js.map +1 -0
- package/dist/core/platform/Config.d.ts +230 -0
- package/dist/core/platform/Config.d.ts.map +1 -0
- package/dist/core/platform/Config.js +231 -0
- package/dist/core/platform/Config.js.map +1 -0
- package/dist/core/platform/Dictionary.d.ts +16 -0
- package/dist/core/platform/Dictionary.d.ts.map +1 -0
- package/dist/core/platform/Dictionary.js +65 -0
- package/dist/core/platform/Dictionary.js.map +1 -0
- package/dist/core/platform/EGLView/ContainerStrategy.d.ts +30 -0
- package/dist/core/platform/EGLView/ContainerStrategy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ContainerStrategy.js +121 -0
- package/dist/core/platform/EGLView/ContainerStrategy.js.map +1 -0
- package/dist/core/platform/EGLView/ContentStrategy.d.ts +56 -0
- package/dist/core/platform/EGLView/ContentStrategy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ContentStrategy.js +117 -0
- package/dist/core/platform/EGLView/ContentStrategy.js.map +1 -0
- package/dist/core/platform/EGLView/EGLInstance.d.ts +8 -0
- package/dist/core/platform/EGLView/EGLInstance.d.ts.map +1 -0
- package/dist/core/platform/EGLView/EGLInstance.js +16 -0
- package/dist/core/platform/EGLView/EGLInstance.js.map +1 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.d.ts +99 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.js +116 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.js.map +1 -0
- package/dist/core/platform/EGLView.d.ts +204 -0
- package/dist/core/platform/EGLView.d.ts.map +1 -0
- package/dist/core/platform/EGLView.js +669 -0
- package/dist/core/platform/EGLView.js.map +1 -0
- package/dist/core/platform/FontDefinition.d.ts +47 -0
- package/dist/core/platform/FontDefinition.d.ts.map +1 -0
- package/dist/core/platform/FontDefinition.js +59 -0
- package/dist/core/platform/FontDefinition.js.map +1 -0
- package/dist/core/platform/InputManager.d.ts +149 -0
- package/dist/core/platform/InputManager.d.ts.map +1 -0
- package/dist/core/platform/InputManager.js +558 -0
- package/dist/core/platform/InputManager.js.map +1 -0
- package/dist/core/platform/Loaders.d.ts +4 -0
- package/dist/core/platform/Loaders.d.ts.map +1 -0
- package/dist/core/platform/Loaders.js +141 -0
- package/dist/core/platform/Loaders.js.map +1 -0
- package/dist/core/platform/Macro.d.ts +634 -0
- package/dist/core/platform/Macro.d.ts.map +1 -0
- package/dist/core/platform/Macro.js +763 -0
- package/dist/core/platform/Macro.js.map +1 -0
- package/dist/core/platform/SAXParser.d.ts +44 -0
- package/dist/core/platform/SAXParser.d.ts.map +1 -0
- package/dist/core/platform/SAXParser.js +122 -0
- package/dist/core/platform/SAXParser.js.map +1 -0
- package/dist/core/platform/Types.d.ts +188 -0
- package/dist/core/platform/Types.d.ts.map +1 -0
- package/dist/core/platform/Types.js +425 -0
- package/dist/core/platform/Types.js.map +1 -0
- package/dist/core/platform/VisibleRect.d.ts +38 -0
- package/dist/core/platform/VisibleRect.d.ts.map +1 -0
- package/dist/core/platform/VisibleRect.js +66 -0
- package/dist/core/platform/VisibleRect.js.map +1 -0
- package/dist/core/platform/index.d.ts +7 -0
- package/dist/core/platform/index.d.ts.map +1 -0
- package/dist/core/platform/index.js +7 -0
- package/dist/core/platform/index.js.map +1 -0
- package/dist/core/platform/miniFramework.d.ts +28 -0
- package/dist/core/platform/miniFramework.d.ts.map +1 -0
- package/dist/core/platform/miniFramework.js +245 -0
- package/dist/core/platform/miniFramework.js.map +1 -0
- package/dist/core/platform/types/Quad2.d.ts +30 -0
- package/dist/core/platform/types/Quad2.d.ts.map +1 -0
- package/dist/core/platform/types/Quad2.js +62 -0
- package/dist/core/platform/types/Quad2.js.map +1 -0
- package/dist/core/platform/types/Quad3.d.ts +18 -0
- package/dist/core/platform/types/Quad3.d.ts.map +1 -0
- package/dist/core/platform/types/Quad3.js +30 -0
- package/dist/core/platform/types/Quad3.js.map +1 -0
- package/dist/core/platform/types/Tex2F.d.ts +20 -0
- package/dist/core/platform/types/Tex2F.d.ts.map +1 -0
- package/dist/core/platform/types/Tex2F.js +33 -0
- package/dist/core/platform/types/Tex2F.js.map +1 -0
- package/dist/core/platform/types/Vertex2F.d.ts +12 -0
- package/dist/core/platform/types/Vertex2F.d.ts.map +1 -0
- package/dist/core/platform/types/Vertex2F.js +25 -0
- package/dist/core/platform/types/Vertex2F.js.map +1 -0
- package/dist/core/platform/types/Vertex3F.d.ts +14 -0
- package/dist/core/platform/types/Vertex3F.d.ts.map +1 -0
- package/dist/core/platform/types/Vertex3F.js +31 -0
- package/dist/core/platform/types/Vertex3F.js.map +1 -0
- package/dist/core/platform/types/WebGLColor.d.ts +17 -0
- package/dist/core/platform/types/WebGLColor.d.ts.map +1 -0
- package/dist/core/platform/types/WebGLColor.js +40 -0
- package/dist/core/platform/types/WebGLColor.js.map +1 -0
- package/dist/core/renderer/GlobalVertexBuffer.d.ts +19 -0
- package/dist/core/renderer/GlobalVertexBuffer.d.ts.map +1 -0
- package/dist/core/renderer/GlobalVertexBuffer.js +99 -0
- package/dist/core/renderer/GlobalVertexBuffer.js.map +1 -0
- package/dist/core/renderer/RendererWebGL.d.ts +47 -0
- package/dist/core/renderer/RendererWebGL.d.ts.map +1 -0
- package/dist/core/renderer/RendererWebGL.js +389 -0
- package/dist/core/renderer/RendererWebGL.js.map +1 -0
- package/dist/core/scenes/Scene.d.ts +6 -0
- package/dist/core/scenes/Scene.d.ts.map +1 -0
- package/dist/core/scenes/Scene.js +12 -0
- package/dist/core/scenes/Scene.js.map +1 -0
- package/dist/core/sprites/Animation.d.ts +147 -0
- package/dist/core/sprites/Animation.d.ts.map +1 -0
- package/dist/core/sprites/Animation.js +277 -0
- package/dist/core/sprites/Animation.js.map +1 -0
- package/dist/core/sprites/AnimationCache.d.ts +37 -0
- package/dist/core/sprites/AnimationCache.d.ts.map +1 -0
- package/dist/core/sprites/AnimationCache.js +159 -0
- package/dist/core/sprites/AnimationCache.js.map +1 -0
- package/dist/core/sprites/Sprite.d.ts +104 -0
- package/dist/core/sprites/Sprite.d.ts.map +1 -0
- package/dist/core/sprites/Sprite.js +388 -0
- package/dist/core/sprites/Sprite.js.map +1 -0
- package/dist/core/sprites/SpriteBatchNode.d.ts +194 -0
- package/dist/core/sprites/SpriteBatchNode.d.ts.map +1 -0
- package/dist/core/sprites/SpriteBatchNode.js +332 -0
- package/dist/core/sprites/SpriteBatchNode.js.map +1 -0
- package/dist/core/sprites/SpriteFrame.d.ts +47 -0
- package/dist/core/sprites/SpriteFrame.d.ts.map +1 -0
- package/dist/core/sprites/SpriteFrame.js +223 -0
- package/dist/core/sprites/SpriteFrame.js.map +1 -0
- package/dist/core/sprites/SpriteFrameCache.d.ts +102 -0
- package/dist/core/sprites/SpriteFrameCache.d.ts.map +1 -0
- package/dist/core/sprites/SpriteFrameCache.js +333 -0
- package/dist/core/sprites/SpriteFrameCache.js.map +1 -0
- package/dist/core/sprites/SpriteLoadManager.d.ts +8 -0
- package/dist/core/sprites/SpriteLoadManager.d.ts.map +1 -0
- package/dist/core/sprites/SpriteLoadManager.js +37 -0
- package/dist/core/sprites/SpriteLoadManager.js.map +1 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts +35 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.js +286 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.js.map +1 -0
- package/dist/core/sprites/SpritesPropertyDefine.d.ts +2 -0
- package/dist/core/sprites/SpritesPropertyDefine.d.ts.map +1 -0
- package/dist/core/sprites/SpritesPropertyDefine.js +19 -0
- package/dist/core/sprites/SpritesPropertyDefine.js.map +1 -0
- package/dist/core/support/PointExtension.d.ts +296 -0
- package/dist/core/support/PointExtension.d.ts.map +1 -0
- package/dist/core/support/PointExtension.js +443 -0
- package/dist/core/support/PointExtension.js.map +1 -0
- package/dist/core/support/Vertex.d.ts +24 -0
- package/dist/core/support/Vertex.d.ts.map +1 -0
- package/dist/core/support/Vertex.js +120 -0
- package/dist/core/support/Vertex.js.map +1 -0
- package/dist/core/utils/BinaryLoader.d.ts +9 -0
- package/dist/core/utils/BinaryLoader.d.ts.map +1 -0
- package/dist/core/utils/BinaryLoader.js +116 -0
- package/dist/core/utils/BinaryLoader.js.map +1 -0
- package/dist/core/utils/Profiler.d.ts +13 -0
- package/dist/core/utils/Profiler.d.ts.map +1 -0
- package/dist/core/utils/Profiler.js +140 -0
- package/dist/core/utils/Profiler.js.map +1 -0
- package/dist/helper/AsyncPool.d.ts +22 -0
- package/dist/helper/AsyncPool.d.ts.map +1 -0
- package/dist/helper/AsyncPool.js +101 -0
- package/dist/helper/AsyncPool.js.map +1 -0
- package/dist/helper/Base64.d.ts +29 -0
- package/dist/helper/Base64.d.ts.map +1 -0
- package/dist/helper/Base64.js +71 -0
- package/dist/helper/Base64.js.map +1 -0
- package/dist/helper/Debugger.d.ts +179 -0
- package/dist/helper/Debugger.d.ts.map +1 -0
- package/dist/helper/Debugger.js +250 -0
- package/dist/helper/Debugger.js.map +1 -0
- package/dist/helper/ZipUtils.d.ts +2 -0
- package/dist/helper/ZipUtils.d.ts.map +1 -0
- package/dist/helper/ZipUtils.js +20 -0
- package/dist/helper/ZipUtils.js.map +1 -0
- package/dist/helper/async.d.ts +49 -0
- package/dist/helper/async.d.ts.map +1 -0
- package/dist/helper/async.js +95 -0
- package/dist/helper/async.js.map +1 -0
- package/dist/helper/checkType.d.ts +8 -0
- package/dist/helper/checkType.d.ts.map +1 -0
- package/dist/helper/checkType.js +31 -0
- package/dist/helper/checkType.js.map +1 -0
- package/dist/helper/engine.d.ts +6 -0
- package/dist/helper/engine.d.ts.map +1 -0
- package/dist/helper/engine.js +115 -0
- package/dist/helper/engine.js.map +1 -0
- package/dist/helper/getset.d.ts +2 -0
- package/dist/helper/getset.d.ts.map +1 -0
- package/dist/helper/getset.js +51 -0
- package/dist/helper/getset.js.map +1 -0
- package/dist/helper/global.d.ts +6 -0
- package/dist/helper/global.d.ts.map +1 -0
- package/dist/helper/global.js +6 -0
- package/dist/helper/global.js.map +1 -0
- package/dist/helper/index.d.ts +3 -0
- package/dist/helper/index.d.ts.map +1 -0
- package/dist/helper/index.js +3 -0
- package/dist/helper/index.js.map +1 -0
- package/dist/helper/loader.d.ts +102 -0
- package/dist/helper/loader.d.ts.map +1 -0
- package/dist/helper/loader.js +447 -0
- package/dist/helper/loader.js.map +1 -0
- package/dist/helper/path.d.ts +12 -0
- package/dist/helper/path.d.ts.map +1 -0
- package/dist/helper/path.js +75 -0
- package/dist/helper/path.js.map +1 -0
- package/dist/helper/string.d.ts +2 -0
- package/dist/helper/string.d.ts.map +1 -0
- package/dist/helper/string.js +32 -0
- package/dist/helper/string.js.map +1 -0
- package/dist/helper/sys.d.ts +446 -0
- package/dist/helper/sys.d.ts.map +1 -0
- package/dist/helper/sys.js +691 -0
- package/dist/helper/sys.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/motion-streak/MotionStreak.d.ts +56 -0
- package/dist/motion-streak/MotionStreak.d.ts.map +1 -0
- package/dist/motion-streak/MotionStreak.js +301 -0
- package/dist/motion-streak/MotionStreak.js.map +1 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts +9 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts.map +1 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.js +52 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.js.map +1 -0
- package/dist/motion-streak/index.d.ts +2 -0
- package/dist/motion-streak/index.d.ts.map +1 -0
- package/dist/motion-streak/index.js +2 -0
- package/dist/motion-streak/index.js.map +1 -0
- package/dist/particle/PNGReader.d.ts +30 -0
- package/dist/particle/PNGReader.d.ts.map +1 -0
- package/dist/particle/PNGReader.js +304 -0
- package/dist/particle/PNGReader.js.map +1 -0
- package/dist/particle/Particle.d.ts +27 -0
- package/dist/particle/Particle.d.ts.map +1 -0
- package/dist/particle/Particle.js +50 -0
- package/dist/particle/Particle.js.map +1 -0
- package/dist/particle/ParticleBatchNode.d.ts +163 -0
- package/dist/particle/ParticleBatchNode.d.ts.map +1 -0
- package/dist/particle/ParticleBatchNode.js +447 -0
- package/dist/particle/ParticleBatchNode.js.map +1 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts +8 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js +33 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js.map +1 -0
- package/dist/particle/ParticleSystem.d.ts +941 -0
- package/dist/particle/ParticleSystem.d.ts.map +1 -0
- package/dist/particle/ParticleSystem.js +2017 -0
- package/dist/particle/ParticleSystem.js.map +1 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts +29 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts.map +1 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.js +346 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.js.map +1 -0
- package/dist/particle/TIFFReader.d.ts +138 -0
- package/dist/particle/TIFFReader.d.ts.map +1 -0
- package/dist/particle/TIFFReader.js +596 -0
- package/dist/particle/TIFFReader.js.map +1 -0
- package/dist/particle/examples/ParticleFire.d.ts +60 -0
- package/dist/particle/examples/ParticleFire.d.ts.map +1 -0
- package/dist/particle/examples/ParticleFire.js +188 -0
- package/dist/particle/examples/ParticleFire.js.map +1 -0
- package/dist/particle/examples/ParticleGalaxy.d.ts +60 -0
- package/dist/particle/examples/ParticleGalaxy.d.ts.map +1 -0
- package/dist/particle/examples/ParticleGalaxy.js +199 -0
- package/dist/particle/examples/ParticleGalaxy.js.map +1 -0
- package/dist/particle/examples/ParticleSmoke.d.ts +60 -0
- package/dist/particle/examples/ParticleSmoke.d.ts.map +1 -0
- package/dist/particle/examples/ParticleSmoke.js +195 -0
- package/dist/particle/examples/ParticleSmoke.js.map +1 -0
- package/dist/particle/examples/ParticleSpiral.d.ts +38 -0
- package/dist/particle/examples/ParticleSpiral.d.ts.map +1 -0
- package/dist/particle/examples/ParticleSpiral.js +130 -0
- package/dist/particle/examples/ParticleSpiral.js.map +1 -0
- package/dist/particle/examples/index.d.ts +5 -0
- package/dist/particle/examples/index.d.ts.map +1 -0
- package/dist/particle/examples/index.js +5 -0
- package/dist/particle/examples/index.js.map +1 -0
- package/dist/particle/index.d.ts +2 -0
- package/dist/particle/index.d.ts.map +1 -0
- package/dist/particle/index.js +2 -0
- package/dist/particle/index.js.map +1 -0
- package/dist/polyfills.d.ts +34 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +102 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/progress-timer/ActionProgressTimer.d.ts +118 -0
- package/dist/progress-timer/ActionProgressTimer.d.ts.map +1 -0
- package/dist/progress-timer/ActionProgressTimer.js +173 -0
- package/dist/progress-timer/ActionProgressTimer.js.map +1 -0
- package/dist/progress-timer/ProgressTimer.d.ts +143 -0
- package/dist/progress-timer/ProgressTimer.d.ts.map +1 -0
- package/dist/progress-timer/ProgressTimer.js +228 -0
- package/dist/progress-timer/ProgressTimer.js.map +1 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts +56 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js +445 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js.map +1 -0
- package/dist/progress-timer/index.d.ts +3 -0
- package/dist/progress-timer/index.d.ts.map +1 -0
- package/dist/progress-timer/index.js +3 -0
- package/dist/progress-timer/index.js.map +1 -0
- package/dist/render-texture/RenderTexture.d.ts +226 -0
- package/dist/render-texture/RenderTexture.d.ts.map +1 -0
- package/dist/render-texture/RenderTexture.js +332 -0
- package/dist/render-texture/RenderTexture.js.map +1 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts +28 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts.map +1 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.js +276 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.js.map +1 -0
- package/dist/render-texture/index.d.ts +2 -0
- package/dist/render-texture/index.d.ts.map +1 -0
- package/dist/render-texture/index.js +2 -0
- package/dist/render-texture/index.js.map +1 -0
- package/dist/shaders/GLProgram.d.ts +288 -0
- package/dist/shaders/GLProgram.d.ts.map +1 -0
- package/dist/shaders/GLProgram.js +794 -0
- package/dist/shaders/GLProgram.js.map +1 -0
- package/dist/shaders/GLProgramState.d.ts +58 -0
- package/dist/shaders/GLProgramState.d.ts.map +1 -0
- package/dist/shaders/GLProgramState.js +255 -0
- package/dist/shaders/GLProgramState.js.map +1 -0
- package/dist/shaders/GLStateCache.d.ts +97 -0
- package/dist/shaders/GLStateCache.d.ts.map +1 -0
- package/dist/shaders/GLStateCache.js +255 -0
- package/dist/shaders/GLStateCache.js.map +1 -0
- package/dist/shaders/ShaderCache.d.ts +111 -0
- package/dist/shaders/ShaderCache.d.ts.map +1 -0
- package/dist/shaders/ShaderCache.js +273 -0
- package/dist/shaders/ShaderCache.js.map +1 -0
- package/dist/shaders/Shaders.d.ts +84 -0
- package/dist/shaders/Shaders.d.ts.map +1 -0
- package/dist/shaders/Shaders.js +250 -0
- package/dist/shaders/Shaders.js.map +1 -0
- package/dist/shaders/index.d.ts +5 -0
- package/dist/shaders/index.d.ts.map +1 -0
- package/dist/shaders/index.js +5 -0
- package/dist/shaders/index.js.map +1 -0
- package/dist/shape-nodes/DrawNode.d.ts +61 -0
- package/dist/shape-nodes/DrawNode.d.ts.map +1 -0
- package/dist/shape-nodes/DrawNode.js +597 -0
- package/dist/shape-nodes/DrawNode.js.map +1 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts +11 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js +27 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js.map +1 -0
- package/dist/text-input/IMEDispatcher.d.ts +180 -0
- package/dist/text-input/IMEDispatcher.d.ts.map +1 -0
- package/dist/text-input/IMEDispatcher.js +454 -0
- package/dist/text-input/IMEDispatcher.js.map +1 -0
- package/dist/text-input/TextFieldTTF.d.ts +219 -0
- package/dist/text-input/TextFieldTTF.d.ts.map +1 -0
- package/dist/text-input/TextFieldTTF.js +381 -0
- package/dist/text-input/TextFieldTTF.js.map +1 -0
- package/dist/textures/Texture2D.d.ts +10 -0
- package/dist/textures/Texture2D.d.ts.map +1 -0
- package/dist/textures/Texture2D.js +10 -0
- package/dist/textures/Texture2D.js.map +1 -0
- package/dist/textures/TextureAtlas.d.ts +204 -0
- package/dist/textures/TextureAtlas.d.ts.map +1 -0
- package/dist/textures/TextureAtlas.js +602 -0
- package/dist/textures/TextureAtlas.js.map +1 -0
- package/dist/textures/TextureCache.d.ts +147 -0
- package/dist/textures/TextureCache.d.ts.map +1 -0
- package/dist/textures/TextureCache.js +327 -0
- package/dist/textures/TextureCache.js.map +1 -0
- package/dist/textures/TexturesPropertyDefine.d.ts +2 -0
- package/dist/textures/TexturesPropertyDefine.d.ts.map +1 -0
- package/dist/textures/TexturesPropertyDefine.js +39 -0
- package/dist/textures/TexturesPropertyDefine.js.map +1 -0
- package/dist/textures/TexturesWebGL.d.ts +349 -0
- package/dist/textures/TexturesWebGL.d.ts.map +1 -0
- package/dist/textures/TexturesWebGL.js +765 -0
- package/dist/textures/TexturesWebGL.js.map +1 -0
- package/dist/textures/WebGLTextureCache.d.ts +2 -0
- package/dist/textures/WebGLTextureCache.d.ts.map +1 -0
- package/dist/textures/WebGLTextureCache.js +79 -0
- package/dist/textures/WebGLTextureCache.js.map +1 -0
- package/dist/textures/index.d.ts +3 -0
- package/dist/textures/index.d.ts.map +1 -0
- package/dist/textures/index.js +3 -0
- package/dist/textures/index.js.map +1 -0
- package/dist/tilemap/TGAlib.d.ts +103 -0
- package/dist/tilemap/TGAlib.d.ts.map +1 -0
- package/dist/tilemap/TGAlib.js +338 -0
- package/dist/tilemap/TGAlib.js.map +1 -0
- package/dist/tilemap/TMXLayer.d.ts +225 -0
- package/dist/tilemap/TMXLayer.d.ts.map +1 -0
- package/dist/tilemap/TMXLayer.js +694 -0
- package/dist/tilemap/TMXLayer.js.map +1 -0
- package/dist/tilemap/TMXLayerInfo.d.ts +42 -0
- package/dist/tilemap/TMXLayerInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXLayerInfo.js +57 -0
- package/dist/tilemap/TMXLayerInfo.js.map +1 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts +17 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.js +209 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.js.map +1 -0
- package/dist/tilemap/TMXMapInfo.d.ts +210 -0
- package/dist/tilemap/TMXMapInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXMapInfo.js +614 -0
- package/dist/tilemap/TMXMapInfo.js.map +1 -0
- package/dist/tilemap/TMXObjectGroup.d.ts +70 -0
- package/dist/tilemap/TMXObjectGroup.d.ts.map +1 -0
- package/dist/tilemap/TMXObjectGroup.js +106 -0
- package/dist/tilemap/TMXObjectGroup.js.map +1 -0
- package/dist/tilemap/TMXTiledMap.d.ts +163 -0
- package/dist/tilemap/TMXTiledMap.d.ts.map +1 -0
- package/dist/tilemap/TMXTiledMap.js +347 -0
- package/dist/tilemap/TMXTiledMap.js.map +1 -0
- package/dist/tilemap/TMXTilesetInfo.d.ts +38 -0
- package/dist/tilemap/TMXTilesetInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXTilesetInfo.js +59 -0
- package/dist/tilemap/TMXTilesetInfo.js.map +1 -0
- package/dist/tilemap/TMXXMLParser.d.ts +52 -0
- package/dist/tilemap/TMXXMLParser.d.ts.map +1 -0
- package/dist/tilemap/TMXXMLParser.js +52 -0
- package/dist/tilemap/TMXXMLParser.js.map +1 -0
- package/dist/tilemap/index.d.ts +4 -0
- package/dist/tilemap/index.d.ts.map +1 -0
- package/dist/tilemap/index.js +4 -0
- package/dist/tilemap/index.js.map +1 -0
- package/dist/ui/base/FocusNavigationController.d.ts +12 -0
- package/dist/ui/base/FocusNavigationController.d.ts.map +1 -0
- package/dist/ui/base/FocusNavigationController.js +54 -0
- package/dist/ui/base/FocusNavigationController.js.map +1 -0
- package/dist/ui/base/ProtectedNode.d.ts +66 -0
- package/dist/ui/base/ProtectedNode.d.ts.map +1 -0
- package/dist/ui/base/ProtectedNode.js +248 -0
- package/dist/ui/base/ProtectedNode.js.map +1 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts +13 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js +136 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js.map +1 -0
- package/dist/ui/base/UIHelper.d.ts +48 -0
- package/dist/ui/base/UIHelper.d.ts.map +1 -0
- package/dist/ui/base/UIHelper.js +128 -0
- package/dist/ui/base/UIHelper.js.map +1 -0
- package/dist/ui/base/UIScale9Sprite.d.ts +224 -0
- package/dist/ui/base/UIScale9Sprite.d.ts.map +1 -0
- package/dist/ui/base/UIScale9Sprite.js +825 -0
- package/dist/ui/base/UIScale9Sprite.js.map +1 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts +15 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js +119 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js.map +1 -0
- package/dist/ui/base/UIWidget.d.ts +794 -0
- package/dist/ui/base/UIWidget.d.ts.map +1 -0
- package/dist/ui/base/UIWidget.js +1634 -0
- package/dist/ui/base/UIWidget.js.map +1 -0
- package/dist/ui/base/UIWidgetRenderCmd.d.ts +9 -0
- package/dist/ui/base/UIWidgetRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/UIWidgetRenderCmd.js +41 -0
- package/dist/ui/base/UIWidgetRenderCmd.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/layout/UILayout.d.ts +486 -0
- package/dist/ui/layout/UILayout.d.ts.map +1 -0
- package/dist/ui/layout/UILayout.js +1430 -0
- package/dist/ui/layout/UILayout.js.map +1 -0
- package/dist/ui/layout/UILayoutParameter.d.ts +344 -0
- package/dist/ui/layout/UILayoutParameter.d.ts.map +1 -0
- package/dist/ui/layout/UILayoutParameter.js +444 -0
- package/dist/ui/layout/UILayoutParameter.js.map +1 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts +30 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.js +136 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.js.map +1 -0
- package/dist/ui/layout/constant.d.ts +30 -0
- package/dist/ui/layout/constant.d.ts.map +1 -0
- package/dist/ui/layout/constant.js +31 -0
- package/dist/ui/layout/constant.js.map +1 -0
- package/dist/ui/widget/UIButton.d.ts +248 -0
- package/dist/ui/widget/UIButton.d.ts.map +1 -0
- package/dist/ui/widget/UIButton.js +727 -0
- package/dist/ui/widget/UIButton.js.map +1 -0
- package/dist/ui/widget/UIRichText.d.ts +216 -0
- package/dist/ui/widget/UIRichText.d.ts.map +1 -0
- package/dist/ui/widget/UIRichText.js +549 -0
- package/dist/ui/widget/UIRichText.js.map +1 -0
- package/dist/ui/widget/UIScrollView.d.ts +547 -0
- package/dist/ui/widget/UIScrollView.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollView.js +1544 -0
- package/dist/ui/widget/UIScrollView.js.map +1 -0
- package/dist/ui/widget/UIScrollViewBar.d.ts +101 -0
- package/dist/ui/widget/UIScrollViewBar.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollViewBar.js +277 -0
- package/dist/ui/widget/UIScrollViewBar.js.map +1 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts +10 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js +42 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js.map +1 -0
- package/dist/ui/widget/UISlider.d.ts +229 -0
- package/dist/ui/widget/UISlider.d.ts.map +1 -0
- package/dist/ui/widget/UISlider.js +667 -0
- package/dist/ui/widget/UISlider.js.map +1 -0
- package/dist/ui/widget/UIText.d.ts +90 -0
- package/dist/ui/widget/UIText.d.ts.map +1 -0
- package/dist/ui/widget/UIText.js +325 -0
- package/dist/ui/widget/UIText.js.map +1 -0
- package/dist/ui/widget/UITextField.d.ts +282 -0
- package/dist/ui/widget/UITextField.d.ts.map +1 -0
- package/dist/ui/widget/UITextField.js +549 -0
- package/dist/ui/widget/UITextField.js.map +1 -0
- package/dist/ui/widget/UITextFieldRenderer.d.ts +41 -0
- package/dist/ui/widget/UITextFieldRenderer.d.ts.map +1 -0
- package/dist/ui/widget/UITextFieldRenderer.js +150 -0
- package/dist/ui/widget/UITextFieldRenderer.js.map +1 -0
- package/eslint.config.ts +59 -0
- package/index.html +22 -0
- package/package.json +38 -0
- package/res/Button.mp3 +0 -0
- package/res/SmallSun.plist +108 -0
- package/res/Spiral.plist +102 -0
- package/res/base.png +0 -0
- package/res/button.png +0 -0
- package/res/button_plus.png +0 -0
- package/res/ortho-test1.png +0 -0
- package/res/orthogonal-test1.tmx +9 -0
- package/res/orthogonal-test1.tsx +4 -0
- package/res/particle.png +0 -0
- package/res/sliderThumb.png +0 -0
- package/res/sliderTrack.png +0 -0
- package/res/streak.png +0 -0
- package/res/ui.plist +578 -0
- package/res/ui.png +0 -0
- package/res/vite.svg +1 -0
- package/test/ActionScene.ts +15 -0
- package/test/DemoScene.ts +108 -0
- package/test/GraphicsTest.ts +17 -0
- package/test/ParticleScene.ts +24 -0
- package/test/TiledMapScene.ts +14 -0
- package/test/index.ts +28 -0
- package/vite.config.ts +13 -0
|
@@ -0,0 +1,1430 @@
|
|
|
1
|
+
import { pLength, pSub, Sprite } from '../../core';
|
|
2
|
+
import { Node } from '../../core/base-nodes/Node';
|
|
3
|
+
import { p, Rect, Size } from '../../core/cocoa/Geometry';
|
|
4
|
+
import { Color, color, FLT_MAX } from '../../core/platform';
|
|
5
|
+
import { assert, log } from '../../helper/Debugger';
|
|
6
|
+
import { DrawNode } from '../../shape-nodes/DrawNode';
|
|
7
|
+
import { Scale9Sprite } from '../base/UIScale9Sprite';
|
|
8
|
+
import { Widget } from '../base/UIWidget';
|
|
9
|
+
import { LayoutParameter, LinearLayoutParameter, RelativeLayoutParameter } from './UILayoutParameter';
|
|
10
|
+
import { LayoutWebGLRenderCmd } from './UILayoutWebGLRenderCmd';
|
|
11
|
+
export class Layout extends Widget {
|
|
12
|
+
_clippingEnabled = false;
|
|
13
|
+
_bgImageTexType = Widget.LOCAL_TEXTURE;
|
|
14
|
+
_opacity = 255;
|
|
15
|
+
_doLayoutDirty = true;
|
|
16
|
+
_clippingRectDirty = true;
|
|
17
|
+
_clippingStencil;
|
|
18
|
+
_scissorRectDirty = false;
|
|
19
|
+
_className = 'Layout';
|
|
20
|
+
_finalPositionX = 0;
|
|
21
|
+
_finalPositionY = 0;
|
|
22
|
+
_backGroundImageOpacity = 0;
|
|
23
|
+
_loopFocus = false; //whether enable loop focus or not
|
|
24
|
+
__passFocusToChild = true; //on default, it will pass the focus to the next nearest widget
|
|
25
|
+
_isFocusPassing = false; //when finding the next focused widget, use this variable to pass focus between layout & widget
|
|
26
|
+
_isInterceptTouch = false;
|
|
27
|
+
/**
|
|
28
|
+
* To specify a user-defined functor to decide which child widget of the layout should get focused
|
|
29
|
+
* @function
|
|
30
|
+
* @param {Number} direction
|
|
31
|
+
* @param {Widget} current
|
|
32
|
+
*/
|
|
33
|
+
onPassFocusToChild = null;
|
|
34
|
+
/**
|
|
35
|
+
* Allocates and initializes an UILayout.
|
|
36
|
+
* Constructor of Layout
|
|
37
|
+
* @function
|
|
38
|
+
* @example
|
|
39
|
+
* // example
|
|
40
|
+
* var uiLayout = new Layout();
|
|
41
|
+
*/
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this._layoutType = Layout.ABSOLUTE;
|
|
45
|
+
this._widgetType = Widget.TYPE_CONTAINER;
|
|
46
|
+
this._clippingType = Layout.CLIPPING_SCISSOR;
|
|
47
|
+
this._colorType = Layout.BG_COLOR_NONE;
|
|
48
|
+
this.ignoreContentAdaptWithSize(false);
|
|
49
|
+
this.setContentSize(Size(0, 0));
|
|
50
|
+
this.setAnchorPoint(0, 0);
|
|
51
|
+
this.onPassFocusToChild = this._findNearestChildWidgetIndex.bind(this);
|
|
52
|
+
this._backGroundImageCapInsets = Rect(0, 0, 0, 0);
|
|
53
|
+
this._color = color(255, 255, 255, 255);
|
|
54
|
+
this._startColor = color(255, 255, 255, 255);
|
|
55
|
+
this._endColor = color(255, 255, 255, 255);
|
|
56
|
+
this._alongVector = p(0, -1);
|
|
57
|
+
this._backGroundImageTextureSize = Size(0, 0);
|
|
58
|
+
this._clippingRect = Rect(0, 0, 0, 0);
|
|
59
|
+
this._backGroundImageColor = color(255, 255, 255, 255);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Calls its parent's onEnter, and calls its clippingStencil's onEnter if clippingStencil isn't null.
|
|
63
|
+
* @override
|
|
64
|
+
*/
|
|
65
|
+
onEnter() {
|
|
66
|
+
super.onEnter();
|
|
67
|
+
if (this._clippingStencil)
|
|
68
|
+
this._clippingStencil._performRecursive(Node._stateCallbackType.onEnter);
|
|
69
|
+
this._doLayoutDirty = true;
|
|
70
|
+
this._clippingRectDirty = true;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Calls its parent's onExit, and calls its clippingStencil's onExit if clippingStencil isn't null.
|
|
74
|
+
* @override
|
|
75
|
+
*/
|
|
76
|
+
onExit() {
|
|
77
|
+
super.onExit();
|
|
78
|
+
if (this._clippingStencil)
|
|
79
|
+
this._clippingStencil._performRecursive(Node._stateCallbackType.onExit);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* <p>
|
|
83
|
+
* Calls adaptRenderers (its subclass will override it.) and do layout.
|
|
84
|
+
* If clippingEnabled is true, it will clip/scissor area.
|
|
85
|
+
* </p>
|
|
86
|
+
* @override
|
|
87
|
+
* @param {Node} [parent]
|
|
88
|
+
*/
|
|
89
|
+
visit(parent) {
|
|
90
|
+
const cmd = this._renderCmd, parentCmd = parent ? parent._renderCmd : null;
|
|
91
|
+
// quick return if not visible
|
|
92
|
+
if (!this._visible) {
|
|
93
|
+
cmd._propagateFlagsDown(parentCmd);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this._adaptRenderers();
|
|
97
|
+
this._doLayout();
|
|
98
|
+
cmd.visit(parentCmd);
|
|
99
|
+
const stencilClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_STENCIL;
|
|
100
|
+
const scissorClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_SCISSOR;
|
|
101
|
+
if (stencilClipping) {
|
|
102
|
+
cmd.stencilClippingVisit(parentCmd);
|
|
103
|
+
}
|
|
104
|
+
else if (scissorClipping) {
|
|
105
|
+
cmd.scissorClippingVisit(parentCmd);
|
|
106
|
+
}
|
|
107
|
+
let i;
|
|
108
|
+
const children = this._children;
|
|
109
|
+
const len = children.length;
|
|
110
|
+
let child;
|
|
111
|
+
let j;
|
|
112
|
+
const pChildren = this._protectedChildren;
|
|
113
|
+
const pLen = pChildren.length;
|
|
114
|
+
let pChild;
|
|
115
|
+
if (this._reorderChildDirty)
|
|
116
|
+
this.sortAllChildren();
|
|
117
|
+
if (this._reorderProtectedChildDirty)
|
|
118
|
+
this.sortAllProtectedChildren();
|
|
119
|
+
// draw children zOrder < 0
|
|
120
|
+
for (i = 0; i < len; i++) {
|
|
121
|
+
child = children[i];
|
|
122
|
+
if (child._localZOrder < 0) {
|
|
123
|
+
child.visit(this);
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
for (j = 0; j < pLen; j++) {
|
|
129
|
+
pChild = pChildren[j];
|
|
130
|
+
if (pChild._localZOrder < 0) {
|
|
131
|
+
cmd._changeProtectedChild(pChild);
|
|
132
|
+
pChild.visit(this);
|
|
133
|
+
}
|
|
134
|
+
else
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
// draw children zOrder >= 0
|
|
138
|
+
for (; i < len; i++) {
|
|
139
|
+
children[i].visit(this);
|
|
140
|
+
}
|
|
141
|
+
for (; j < pLen; j++) {
|
|
142
|
+
pChild = pChildren[j];
|
|
143
|
+
cmd._changeProtectedChild(pChild);
|
|
144
|
+
pChild.visit(this);
|
|
145
|
+
}
|
|
146
|
+
if (stencilClipping) {
|
|
147
|
+
cmd.postStencilVisit();
|
|
148
|
+
}
|
|
149
|
+
else if (scissorClipping) {
|
|
150
|
+
cmd.postScissorVisit();
|
|
151
|
+
}
|
|
152
|
+
cmd._dirtyFlag = 0;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* If a layout is loop focused which means that the focus movement will be inside the layout
|
|
156
|
+
* @param {Boolean} loop pass true to let the focus movement loop inside the layout
|
|
157
|
+
*/
|
|
158
|
+
setLoopFocus(loop) {
|
|
159
|
+
this._loopFocus = loop;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets whether enable focus loop
|
|
163
|
+
* @returns {boolean} If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false.
|
|
164
|
+
*/
|
|
165
|
+
isLoopFocus() {
|
|
166
|
+
return this._loopFocus;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Specifies whether the layout pass its focus to its child
|
|
170
|
+
* @param pass To specify whether the layout pass its focus to its child
|
|
171
|
+
*/
|
|
172
|
+
setPassFocusToChild(pass) {
|
|
173
|
+
this.__passFocusToChild = pass;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns whether the layout will pass the focus to its children or not. The default value is true
|
|
177
|
+
* @returns {boolean} To query whether the layout will pass the focus to its children or not. The default value is true
|
|
178
|
+
*/
|
|
179
|
+
isPassFocusToChild() {
|
|
180
|
+
return this.__passFocusToChild;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
|
|
184
|
+
* If the widget is not in a layout, it will return itself
|
|
185
|
+
* @param {Number} direction the direction to look for the next focused widget in a layout
|
|
186
|
+
* @param {Widget} current the current focused widget
|
|
187
|
+
* @returns {Widget} return the index of widget in the layout
|
|
188
|
+
*/
|
|
189
|
+
findNextFocusedWidget(direction, current) {
|
|
190
|
+
if (this._isFocusPassing || this.isFocused()) {
|
|
191
|
+
const parent = this.getParent();
|
|
192
|
+
this._isFocusPassing = false;
|
|
193
|
+
if (this.__passFocusToChild) {
|
|
194
|
+
const w = this._passFocusToChild(direction, current);
|
|
195
|
+
if (w instanceof Layout && parent) {
|
|
196
|
+
parent._isFocusPassing = true;
|
|
197
|
+
return parent.findNextFocusedWidget(direction, this);
|
|
198
|
+
}
|
|
199
|
+
return w;
|
|
200
|
+
}
|
|
201
|
+
if (null == parent || !(parent instanceof Layout))
|
|
202
|
+
return this;
|
|
203
|
+
parent._isFocusPassing = true;
|
|
204
|
+
return parent.findNextFocusedWidget(direction, this);
|
|
205
|
+
}
|
|
206
|
+
else if (current.isFocused() || current instanceof Layout) {
|
|
207
|
+
if (this._layoutType === Layout.LINEAR_HORIZONTAL) {
|
|
208
|
+
switch (direction) {
|
|
209
|
+
case Widget.LEFT:
|
|
210
|
+
return this._getPreviousFocusedWidget(direction, current);
|
|
211
|
+
break;
|
|
212
|
+
case Widget.RIGHT:
|
|
213
|
+
return this._getNextFocusedWidget(direction, current);
|
|
214
|
+
break;
|
|
215
|
+
case Widget.DOWN:
|
|
216
|
+
case Widget.UP:
|
|
217
|
+
if (this._isLastWidgetInContainer(this, direction)) {
|
|
218
|
+
if (this._isWidgetAncestorSupportLoopFocus(current, direction))
|
|
219
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
220
|
+
return current;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
assert(0, 'Invalid Focus Direction');
|
|
228
|
+
return current;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (this._layoutType === Layout.LINEAR_VERTICAL) {
|
|
232
|
+
switch (direction) {
|
|
233
|
+
case Widget.LEFT:
|
|
234
|
+
case Widget.RIGHT:
|
|
235
|
+
if (this._isLastWidgetInContainer(this, direction)) {
|
|
236
|
+
if (this._isWidgetAncestorSupportLoopFocus(current, direction))
|
|
237
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
238
|
+
return current;
|
|
239
|
+
}
|
|
240
|
+
else
|
|
241
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
242
|
+
case Widget.DOWN:
|
|
243
|
+
return this._getNextFocusedWidget(direction, current);
|
|
244
|
+
case Widget.UP:
|
|
245
|
+
return this._getPreviousFocusedWidget(direction, current);
|
|
246
|
+
default:
|
|
247
|
+
assert(0, 'Invalid Focus Direction');
|
|
248
|
+
return current;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
assert(0, 'Un Supported Layout type, please use VBox and HBox instead!!!');
|
|
253
|
+
return current;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else
|
|
257
|
+
return current;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Adds a widget to the container.
|
|
261
|
+
* @param {Widget} widget
|
|
262
|
+
* @param {Number} [zOrder]
|
|
263
|
+
* @param {Number|string} [tag] tag or name
|
|
264
|
+
* @override
|
|
265
|
+
*/
|
|
266
|
+
addChild(widget, zOrder, tag) {
|
|
267
|
+
if (widget instanceof Widget) {
|
|
268
|
+
this._supplyTheLayoutParameterLackToChild(widget);
|
|
269
|
+
}
|
|
270
|
+
Widget.prototype.addChild.call(this, widget, zOrder, tag);
|
|
271
|
+
this._doLayoutDirty = true;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Removes child widget from Layout, and sets the layout dirty flag to true.
|
|
275
|
+
* @param {Widget} widget
|
|
276
|
+
* @param {Boolean} [cleanup=true]
|
|
277
|
+
* @override
|
|
278
|
+
*/
|
|
279
|
+
removeChild(widget, cleanup) {
|
|
280
|
+
Widget.prototype.removeChild.call(this, widget, cleanup);
|
|
281
|
+
this._doLayoutDirty = true;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Removes all children from the container with a cleanup, and sets the layout dirty flag to true.
|
|
285
|
+
* @param {Boolean} cleanup
|
|
286
|
+
*/
|
|
287
|
+
removeAllChildren(cleanup) {
|
|
288
|
+
Widget.prototype.removeAllChildren.call(this, cleanup);
|
|
289
|
+
this._doLayoutDirty = true;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Removes all children from the container, do a cleanup to all running actions depending on the cleanup parameter,
|
|
293
|
+
* and sets the layout dirty flag to true.
|
|
294
|
+
* @param {Boolean} cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
|
|
295
|
+
*/
|
|
296
|
+
removeAllChildrenWithCleanup(cleanup) {
|
|
297
|
+
Widget.prototype.removeAllChildrenWithCleanup.call(this, cleanup);
|
|
298
|
+
this._doLayoutDirty = true;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Gets if layout is clipping enabled.
|
|
302
|
+
* @returns {Boolean} if layout is clipping enabled.
|
|
303
|
+
*/
|
|
304
|
+
isClippingEnabled() {
|
|
305
|
+
return this._clippingEnabled;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Changes if layout can clip it's content and locChild.
|
|
309
|
+
* If you really need this, please enable it. But it would reduce the rendering efficiency.
|
|
310
|
+
* @param {Boolean} able clipping enabled.
|
|
311
|
+
*/
|
|
312
|
+
setClippingEnabled(able) {
|
|
313
|
+
if (able === this._clippingEnabled)
|
|
314
|
+
return;
|
|
315
|
+
this._clippingEnabled = able;
|
|
316
|
+
switch (this._clippingType) {
|
|
317
|
+
case Layout.CLIPPING_SCISSOR:
|
|
318
|
+
case Layout.CLIPPING_STENCIL:
|
|
319
|
+
if (able) {
|
|
320
|
+
this._clippingStencil = new DrawNode();
|
|
321
|
+
this._renderCmd.rebindStencilRendering(this._clippingStencil);
|
|
322
|
+
if (this._running)
|
|
323
|
+
this._clippingStencil._performRecursive(Node._stateCallbackType.onEnter);
|
|
324
|
+
this._setStencilClippingSize(this._contentSize);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
if (this._running && this._clippingStencil)
|
|
328
|
+
this._clippingStencil._performRecursive(Node._stateCallbackType.onExit);
|
|
329
|
+
this._clippingStencil = null;
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
default:
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Sets clipping type to Layout
|
|
338
|
+
* @param {Layout.CLIPPING_STENCIL|Layout.CLIPPING_SCISSOR} type
|
|
339
|
+
*/
|
|
340
|
+
setClippingType(type) {
|
|
341
|
+
if (type === this._clippingType)
|
|
342
|
+
return;
|
|
343
|
+
const clippingEnabled = this.isClippingEnabled();
|
|
344
|
+
this.setClippingEnabled(false);
|
|
345
|
+
this._clippingType = type;
|
|
346
|
+
this.setClippingEnabled(clippingEnabled);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Gets clipping type of Layout
|
|
350
|
+
* @returns {Layout.CLIPPING_STENCIL|Layout.CLIPPING_SCISSOR}
|
|
351
|
+
*/
|
|
352
|
+
getClippingType() {
|
|
353
|
+
return this._clippingType;
|
|
354
|
+
}
|
|
355
|
+
_setStencilClippingSize(size) {
|
|
356
|
+
if (this._clippingEnabled) {
|
|
357
|
+
const rect = [];
|
|
358
|
+
rect[0] = p(0, 0);
|
|
359
|
+
rect[1] = p(size.width, 0);
|
|
360
|
+
rect[2] = p(size.width, size.height);
|
|
361
|
+
rect[3] = p(0, size.height);
|
|
362
|
+
const green = Color.GREEN;
|
|
363
|
+
this._clippingStencil.clear();
|
|
364
|
+
this._clippingStencil.setLocalBB(0, 0, size.width, size.height);
|
|
365
|
+
this._clippingStencil.drawPoly(rect, green, 0, green);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
_getClippingRect() {
|
|
369
|
+
if (this._clippingRectDirty) {
|
|
370
|
+
const worldPos = this.convertToWorldSpace(p(0, 0));
|
|
371
|
+
const t = this.getNodeToWorldTransform();
|
|
372
|
+
const scissorWidth = this._contentSize.width * t.a;
|
|
373
|
+
const scissorHeight = this._contentSize.height * t.d;
|
|
374
|
+
let parentClippingRect;
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
376
|
+
let parent = this;
|
|
377
|
+
while (parent) {
|
|
378
|
+
parent = parent.getParent();
|
|
379
|
+
if (parent && parent instanceof Layout && parent.isClippingEnabled()) {
|
|
380
|
+
this._clippingParent = parent;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (this._clippingParent) {
|
|
385
|
+
parentClippingRect = this._clippingParent._getClippingRect();
|
|
386
|
+
this._clippingRect.x = Math.max(worldPos.x, parentClippingRect.x);
|
|
387
|
+
this._clippingRect.y = Math.max(worldPos.y, parentClippingRect.y);
|
|
388
|
+
const right = Math.min(worldPos.x + scissorWidth, parentClippingRect.x + parentClippingRect.width);
|
|
389
|
+
const top = Math.min(worldPos.y + scissorHeight, parentClippingRect.y + parentClippingRect.height);
|
|
390
|
+
this._clippingRect.width = Math.max(0.0, right - this._clippingRect.x);
|
|
391
|
+
this._clippingRect.height = Math.max(0.0, top - this._clippingRect.y);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
this._clippingRect.x = worldPos.x;
|
|
395
|
+
this._clippingRect.y = worldPos.y;
|
|
396
|
+
this._clippingRect.width = scissorWidth;
|
|
397
|
+
this._clippingRect.height = scissorHeight;
|
|
398
|
+
}
|
|
399
|
+
this._clippingRectDirty = false;
|
|
400
|
+
}
|
|
401
|
+
return this._clippingRect;
|
|
402
|
+
}
|
|
403
|
+
_onSizeChanged() {
|
|
404
|
+
Widget.prototype._onSizeChanged.call(this);
|
|
405
|
+
const locContentSize = this._contentSize;
|
|
406
|
+
this._setStencilClippingSize(locContentSize);
|
|
407
|
+
this._doLayoutDirty = true;
|
|
408
|
+
this._clippingRectDirty = true;
|
|
409
|
+
if (this._backGroundImage) {
|
|
410
|
+
this._backGroundImage.setPosition(locContentSize.width * 0.5, locContentSize.height * 0.5);
|
|
411
|
+
if (this._backGroundScale9Enabled && this._backGroundImage instanceof Scale9Sprite)
|
|
412
|
+
this._backGroundImage.setPreferredSize(locContentSize);
|
|
413
|
+
}
|
|
414
|
+
if (this._colorRender)
|
|
415
|
+
this._colorRender.setContentSize(locContentSize);
|
|
416
|
+
if (this._gradientRender)
|
|
417
|
+
this._gradientRender.setContentSize(locContentSize);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Sets background image use scale9 renderer.
|
|
421
|
+
* @param {Boolean} able true that use scale9 renderer, false otherwise.
|
|
422
|
+
*/
|
|
423
|
+
setBackGroundImageScale9Enabled(able) {
|
|
424
|
+
if (this._backGroundScale9Enabled === able)
|
|
425
|
+
return;
|
|
426
|
+
this.removeProtectedChild(this._backGroundImage);
|
|
427
|
+
this._backGroundImage = null;
|
|
428
|
+
this._backGroundScale9Enabled = able;
|
|
429
|
+
this._addBackGroundImage();
|
|
430
|
+
this.setBackGroundImage(this._backGroundImageFileName, this._bgImageTexType);
|
|
431
|
+
this.setBackGroundImageCapInsets(this._backGroundImageCapInsets);
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Get whether background image is use scale9 renderer.
|
|
435
|
+
* @returns {Boolean}
|
|
436
|
+
*/
|
|
437
|
+
isBackGroundImageScale9Enabled() {
|
|
438
|
+
return this._backGroundScale9Enabled;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Sets a background image for layout
|
|
442
|
+
* @param {String} fileName
|
|
443
|
+
* @param {Widget.LOCAL_TEXTURE|Widget.PLIST_TEXTURE} texType
|
|
444
|
+
*/
|
|
445
|
+
setBackGroundImage(fileName, texType) {
|
|
446
|
+
if (!fileName)
|
|
447
|
+
return;
|
|
448
|
+
texType = texType || Widget.LOCAL_TEXTURE;
|
|
449
|
+
if (this._backGroundImage === null) {
|
|
450
|
+
this._addBackGroundImage();
|
|
451
|
+
this.setBackGroundImageScale9Enabled(this._backGroundScale9Enabled);
|
|
452
|
+
}
|
|
453
|
+
this._backGroundImageFileName = fileName;
|
|
454
|
+
this._bgImageTexType = texType;
|
|
455
|
+
const locBackgroundImage = this._backGroundImage;
|
|
456
|
+
switch (this._bgImageTexType) {
|
|
457
|
+
case Widget.LOCAL_TEXTURE:
|
|
458
|
+
locBackgroundImage.initWithFile(fileName);
|
|
459
|
+
break;
|
|
460
|
+
case Widget.PLIST_TEXTURE:
|
|
461
|
+
locBackgroundImage.initWithSpriteFrameName(fileName);
|
|
462
|
+
break;
|
|
463
|
+
default:
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
if (this._backGroundScale9Enabled)
|
|
467
|
+
locBackgroundImage.setPreferredSize(this._contentSize);
|
|
468
|
+
this._backGroundImageTextureSize = locBackgroundImage.getContentSize();
|
|
469
|
+
locBackgroundImage.setPosition(this._contentSize.width * 0.5, this._contentSize.height * 0.5);
|
|
470
|
+
this._updateBackGroundImageColor();
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Sets a background image CapInsets for layout, if the background image is a scale9 render.
|
|
474
|
+
* @param {Rect} capInsets capinsets of background image.
|
|
475
|
+
*/
|
|
476
|
+
setBackGroundImageCapInsets(capInsets) {
|
|
477
|
+
if (!capInsets)
|
|
478
|
+
return;
|
|
479
|
+
const locInsets = this._backGroundImageCapInsets;
|
|
480
|
+
locInsets.x = capInsets.x;
|
|
481
|
+
locInsets.y = capInsets.y;
|
|
482
|
+
locInsets.width = capInsets.width;
|
|
483
|
+
locInsets.height = capInsets.height;
|
|
484
|
+
if (this._backGroundScale9Enabled)
|
|
485
|
+
this._backGroundImage.setCapInsets(capInsets);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Gets background image capinsets of Layout.
|
|
489
|
+
* @returns {Rect}
|
|
490
|
+
*/
|
|
491
|
+
getBackGroundImageCapInsets() {
|
|
492
|
+
return Rect(this._backGroundImageCapInsets);
|
|
493
|
+
}
|
|
494
|
+
_supplyTheLayoutParameterLackToChild(locChild) {
|
|
495
|
+
if (!locChild) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
switch (this._layoutType) {
|
|
499
|
+
case Layout.ABSOLUTE:
|
|
500
|
+
break;
|
|
501
|
+
case Layout.LINEAR_HORIZONTAL:
|
|
502
|
+
case Layout.LINEAR_VERTICAL: {
|
|
503
|
+
const layoutParameter = locChild.getLayoutParameter(LayoutParameter.LINEAR);
|
|
504
|
+
if (!layoutParameter)
|
|
505
|
+
locChild.setLayoutParameter(new LinearLayoutParameter());
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
case Layout.RELATIVE: {
|
|
509
|
+
const layoutParameter = locChild.getLayoutParameter(LayoutParameter.RELATIVE);
|
|
510
|
+
if (!layoutParameter)
|
|
511
|
+
locChild.setLayoutParameter(new RelativeLayoutParameter());
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
default:
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
_addBackGroundImage() {
|
|
519
|
+
const contentSize = this._contentSize;
|
|
520
|
+
if (this._backGroundScale9Enabled) {
|
|
521
|
+
this._backGroundImage = new Scale9Sprite();
|
|
522
|
+
this._backGroundImage.setPreferredSize(contentSize);
|
|
523
|
+
}
|
|
524
|
+
else
|
|
525
|
+
this._backGroundImage = new Sprite();
|
|
526
|
+
this.addProtectedChild(this._backGroundImage, Layout.BACKGROUND_IMAGE_ZORDER, -1);
|
|
527
|
+
this._backGroundImage.setPosition(contentSize.width * 0.5, contentSize.height * 0.5);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Remove the background image of Layout.
|
|
531
|
+
*/
|
|
532
|
+
removeBackGroundImage() {
|
|
533
|
+
if (!this._backGroundImage)
|
|
534
|
+
return;
|
|
535
|
+
this.removeProtectedChild(this._backGroundImage);
|
|
536
|
+
this._backGroundImage = null;
|
|
537
|
+
this._backGroundImageFileName = '';
|
|
538
|
+
this._backGroundImageTextureSize.width = 0;
|
|
539
|
+
this._backGroundImageTextureSize.height = 0;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Sets Color Type for Layout.
|
|
543
|
+
* @param {Layout.BG_COLOR_NONE|Layout.BG_COLOR_SOLID|Layout.BG_COLOR_GRADIENT} type
|
|
544
|
+
*/
|
|
545
|
+
setBackGroundColorType(type) {
|
|
546
|
+
if (this._colorType === type)
|
|
547
|
+
return;
|
|
548
|
+
switch (this._colorType) {
|
|
549
|
+
case Layout.BG_COLOR_NONE:
|
|
550
|
+
if (this._colorRender) {
|
|
551
|
+
this.removeProtectedChild(this._colorRender);
|
|
552
|
+
this._colorRender = null;
|
|
553
|
+
}
|
|
554
|
+
if (this._gradientRender) {
|
|
555
|
+
this.removeProtectedChild(this._gradientRender);
|
|
556
|
+
this._gradientRender = null;
|
|
557
|
+
}
|
|
558
|
+
break;
|
|
559
|
+
case Layout.BG_COLOR_SOLID:
|
|
560
|
+
if (this._colorRender) {
|
|
561
|
+
this.removeProtectedChild(this._colorRender);
|
|
562
|
+
this._colorRender = null;
|
|
563
|
+
}
|
|
564
|
+
break;
|
|
565
|
+
case Layout.BG_COLOR_GRADIENT:
|
|
566
|
+
if (this._gradientRender) {
|
|
567
|
+
this.removeProtectedChild(this._gradientRender);
|
|
568
|
+
this._gradientRender = null;
|
|
569
|
+
}
|
|
570
|
+
break;
|
|
571
|
+
default:
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
this._colorType = type;
|
|
575
|
+
switch (this._colorType) {
|
|
576
|
+
case Layout.BG_COLOR_NONE:
|
|
577
|
+
break;
|
|
578
|
+
// case Layout.BG_COLOR_SOLID:
|
|
579
|
+
// this._colorRender = new LayerColor()
|
|
580
|
+
// this._colorRender.setContentSize(this._contentSize)
|
|
581
|
+
// this._colorRender.setOpacity(this._opacity)
|
|
582
|
+
// this._colorRender.setColor(this._color)
|
|
583
|
+
// this.addProtectedChild(this._colorRender, Layout.BACKGROUND_RENDERER_ZORDER, -1)
|
|
584
|
+
// break
|
|
585
|
+
// case Layout.BG_COLOR_GRADIENT:
|
|
586
|
+
// this._gradientRender = new LayerGradient(color(255, 0, 0, 255), color(0, 255, 0, 255))
|
|
587
|
+
// this._gradientRender.setContentSize(this._contentSize)
|
|
588
|
+
// this._gradientRender.setOpacity(this._opacity)
|
|
589
|
+
// this._gradientRender.setStartColor(this._startColor)
|
|
590
|
+
// this._gradientRender.setEndColor(this._endColor)
|
|
591
|
+
// this._gradientRender.setVector(this._alongVector)
|
|
592
|
+
// this.addProtectedChild(this._gradientRender, Layout.BACKGROUND_RENDERER_ZORDER, -1)
|
|
593
|
+
// break
|
|
594
|
+
default:
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Get background color type of Layout.
|
|
600
|
+
* @returns {Layout.BG_COLOR_NONE|Layout.BG_COLOR_SOLID|Layout.BG_COLOR_GRADIENT}
|
|
601
|
+
*/
|
|
602
|
+
getBackGroundColorType() {
|
|
603
|
+
return this._colorType;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Sets background color for layout, if color type is Layout.COLOR_SOLID
|
|
607
|
+
* @param {Color} color
|
|
608
|
+
* @param {Color} [endColor]
|
|
609
|
+
*/
|
|
610
|
+
setBackGroundColor(color, endColor) {
|
|
611
|
+
if (!endColor) {
|
|
612
|
+
this._color.r = color.r;
|
|
613
|
+
this._color.g = color.g;
|
|
614
|
+
this._color.b = color.b;
|
|
615
|
+
if (this._colorRender)
|
|
616
|
+
this._colorRender.setColor(color);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
this._startColor.r = color.r;
|
|
620
|
+
this._startColor.g = color.g;
|
|
621
|
+
this._startColor.b = color.b;
|
|
622
|
+
if (this._gradientRender)
|
|
623
|
+
this._gradientRender.setStartColor(color);
|
|
624
|
+
this._endColor.r = endColor.r;
|
|
625
|
+
this._endColor.g = endColor.g;
|
|
626
|
+
this._endColor.b = endColor.b;
|
|
627
|
+
if (this._gradientRender)
|
|
628
|
+
this._gradientRender.setEndColor(endColor);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Gets background color of Layout, if color type is Layout.COLOR_SOLID.
|
|
633
|
+
* @returns {Color}
|
|
634
|
+
*/
|
|
635
|
+
getBackGroundColor() {
|
|
636
|
+
const tmpColor = this._color;
|
|
637
|
+
return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Gets background start color of Layout
|
|
641
|
+
* @returns {Color}
|
|
642
|
+
*/
|
|
643
|
+
getBackGroundStartColor() {
|
|
644
|
+
const tmpColor = this._startColor;
|
|
645
|
+
return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Gets background end color of Layout
|
|
649
|
+
* @returns {Color}
|
|
650
|
+
*/
|
|
651
|
+
getBackGroundEndColor() {
|
|
652
|
+
const tmpColor = this._endColor;
|
|
653
|
+
return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Sets background opacity to Layout.
|
|
657
|
+
* @param {number} opacity
|
|
658
|
+
*/
|
|
659
|
+
setBackGroundColorOpacity(opacity) {
|
|
660
|
+
this._opacity = opacity;
|
|
661
|
+
switch (this._colorType) {
|
|
662
|
+
case Layout.BG_COLOR_NONE:
|
|
663
|
+
break;
|
|
664
|
+
case Layout.BG_COLOR_SOLID:
|
|
665
|
+
this._colorRender.setOpacity(opacity);
|
|
666
|
+
break;
|
|
667
|
+
case Layout.BG_COLOR_GRADIENT:
|
|
668
|
+
this._gradientRender.setOpacity(opacity);
|
|
669
|
+
break;
|
|
670
|
+
default:
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Get background opacity value of Layout.
|
|
676
|
+
* @returns {Number}
|
|
677
|
+
*/
|
|
678
|
+
getBackGroundColorOpacity() {
|
|
679
|
+
return this._opacity;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Sets background color vector for layout, if color type is Layout.COLOR_GRADIENT
|
|
683
|
+
* @param {Point} vector
|
|
684
|
+
*/
|
|
685
|
+
setBackGroundColorVector(vector) {
|
|
686
|
+
this._alongVector.x = vector.x;
|
|
687
|
+
this._alongVector.y = vector.y;
|
|
688
|
+
if (this._gradientRender) {
|
|
689
|
+
this._gradientRender.setVector(vector);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Gets background color vector of Layout, if color type is Layout.COLOR_GRADIENT
|
|
694
|
+
* @returns {Point}
|
|
695
|
+
*/
|
|
696
|
+
getBackGroundColorVector() {
|
|
697
|
+
return this._alongVector;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Sets backGround image color
|
|
701
|
+
* @param {Color} color
|
|
702
|
+
*/
|
|
703
|
+
setBackGroundImageColor(color) {
|
|
704
|
+
this._backGroundImageColor.r = color.r;
|
|
705
|
+
this._backGroundImageColor.g = color.g;
|
|
706
|
+
this._backGroundImageColor.b = color.b;
|
|
707
|
+
this._updateBackGroundImageColor();
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Sets backGround image Opacity
|
|
711
|
+
* @param {Number} opacity
|
|
712
|
+
*/
|
|
713
|
+
setBackGroundImageOpacity(opacity) {
|
|
714
|
+
this._backGroundImageColor.a = opacity;
|
|
715
|
+
this.getBackGroundImageColor();
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Gets backGround image color
|
|
719
|
+
* @returns {Color}
|
|
720
|
+
*/
|
|
721
|
+
getBackGroundImageColor() {
|
|
722
|
+
return color(this._backGroundImageColor);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Gets backGround image opacity
|
|
726
|
+
* @returns {Number}
|
|
727
|
+
*/
|
|
728
|
+
getBackGroundImageOpacity() {
|
|
729
|
+
return this._backGroundImageColor.a;
|
|
730
|
+
}
|
|
731
|
+
_updateBackGroundImageColor() {
|
|
732
|
+
if (this._backGroundImage)
|
|
733
|
+
this._backGroundImage.setColor(this._backGroundImageColor);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Gets background image texture size.
|
|
737
|
+
* @returns {Size}
|
|
738
|
+
*/
|
|
739
|
+
getBackGroundImageTextureSize() {
|
|
740
|
+
return this._backGroundImageTextureSize;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Sets LayoutType to Layout, LayoutManager will do layout by layout type..
|
|
744
|
+
* @param {Layout.ABSOLUTE|Layout.LINEAR_VERTICAL|Layout.LINEAR_HORIZONTAL|Layout.RELATIVE} type
|
|
745
|
+
*/
|
|
746
|
+
setLayoutType(type) {
|
|
747
|
+
this._layoutType = type;
|
|
748
|
+
const layoutChildrenArray = this._children;
|
|
749
|
+
let locChild;
|
|
750
|
+
for (let i = 0; i < layoutChildrenArray.length; i++) {
|
|
751
|
+
locChild = layoutChildrenArray[i];
|
|
752
|
+
if (locChild instanceof Widget)
|
|
753
|
+
this._supplyTheLayoutParameterLackToChild(locChild);
|
|
754
|
+
}
|
|
755
|
+
this._doLayoutDirty = true;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Gets LayoutType of Layout.
|
|
759
|
+
* @returns {null}
|
|
760
|
+
*/
|
|
761
|
+
getLayoutType() {
|
|
762
|
+
return this._layoutType;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* request to refresh widget layout, it will do layout at visit calls
|
|
766
|
+
*/
|
|
767
|
+
requestDoLayout() {
|
|
768
|
+
this._doLayoutDirty = true;
|
|
769
|
+
}
|
|
770
|
+
_doLayout() {
|
|
771
|
+
if (!this._doLayoutDirty)
|
|
772
|
+
return;
|
|
773
|
+
this.sortAllChildren();
|
|
774
|
+
// const executant = getLayoutManager(this._layoutType)
|
|
775
|
+
// if (executant) executant._doLayout(this)
|
|
776
|
+
this._doLayoutDirty = false;
|
|
777
|
+
}
|
|
778
|
+
_getLayoutContentSize() {
|
|
779
|
+
return this.getContentSize();
|
|
780
|
+
}
|
|
781
|
+
_getLayoutElements() {
|
|
782
|
+
return this.getChildren();
|
|
783
|
+
}
|
|
784
|
+
_updateBackGroundImageOpacity() {
|
|
785
|
+
if (this._backGroundImage)
|
|
786
|
+
this._backGroundImage.setOpacity(this._backGroundImageOpacity);
|
|
787
|
+
}
|
|
788
|
+
_updateBackGroundImageRGBA() {
|
|
789
|
+
if (this._backGroundImage) {
|
|
790
|
+
this._backGroundImage.setColor(this._backGroundImageColor);
|
|
791
|
+
this._backGroundImage.setOpacity(this._backGroundImageOpacity);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Gets the content size of the layout, it will accumulate all its children's content size
|
|
796
|
+
* @returns {Size}
|
|
797
|
+
* @private
|
|
798
|
+
*/
|
|
799
|
+
_getLayoutAccumulatedSize() {
|
|
800
|
+
const children = this.getChildren();
|
|
801
|
+
const layoutSize = Size(0, 0);
|
|
802
|
+
let widgetCount = 0, locSize;
|
|
803
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
804
|
+
const layout = children[i];
|
|
805
|
+
if (null !== layout && layout instanceof Layout) {
|
|
806
|
+
locSize = layout._getLayoutAccumulatedSize();
|
|
807
|
+
layoutSize.width += locSize.width;
|
|
808
|
+
layoutSize.height += locSize.height;
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
if (layout instanceof Widget) {
|
|
812
|
+
widgetCount++;
|
|
813
|
+
const m = layout.getLayoutParameter().getMargin();
|
|
814
|
+
locSize = layout.getContentSize();
|
|
815
|
+
layoutSize.width += locSize.width + (m.right + m.left) * 0.5;
|
|
816
|
+
layoutSize.height += locSize.height + (m.top + m.bottom) * 0.5;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
//substract extra size
|
|
821
|
+
const type = this.getLayoutType();
|
|
822
|
+
if (type === Layout.LINEAR_HORIZONTAL)
|
|
823
|
+
layoutSize.height = layoutSize.height - (layoutSize.height / widgetCount) * (widgetCount - 1);
|
|
824
|
+
if (type === Layout.LINEAR_VERTICAL)
|
|
825
|
+
layoutSize.width = layoutSize.width - (layoutSize.width / widgetCount) * (widgetCount - 1);
|
|
826
|
+
return layoutSize;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child <br/>
|
|
830
|
+
* will get the focus. The current algorithm to determine which child will get focus is nearest-distance-priority algorithm
|
|
831
|
+
* @param {Number} direction next focused widget direction
|
|
832
|
+
* @param {Widget} baseWidget
|
|
833
|
+
* @returns {Number}
|
|
834
|
+
* @private
|
|
835
|
+
*/
|
|
836
|
+
_findNearestChildWidgetIndex(direction, baseWidget) {
|
|
837
|
+
if (baseWidget == null || baseWidget === this)
|
|
838
|
+
return this._findFirstFocusEnabledWidgetIndex();
|
|
839
|
+
let index = 0;
|
|
840
|
+
const locChildren = this.getChildren();
|
|
841
|
+
const count = locChildren.length;
|
|
842
|
+
let widgetPosition;
|
|
843
|
+
let distance = FLT_MAX, found = 0;
|
|
844
|
+
if (direction === Widget.LEFT || direction === Widget.RIGHT || direction === Widget.DOWN || direction === Widget.UP) {
|
|
845
|
+
widgetPosition = this._getWorldCenterPoint(baseWidget);
|
|
846
|
+
while (index < count) {
|
|
847
|
+
const w = locChildren[index];
|
|
848
|
+
if (w && w instanceof Widget && w.isFocusEnabled()) {
|
|
849
|
+
const length = w instanceof Layout ? w._calculateNearestDistance(baseWidget) : pLength(pSub(this._getWorldCenterPoint(w), widgetPosition));
|
|
850
|
+
if (length < distance) {
|
|
851
|
+
found = index;
|
|
852
|
+
distance = length;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
index++;
|
|
856
|
+
}
|
|
857
|
+
return found;
|
|
858
|
+
}
|
|
859
|
+
log('invalid focus direction!');
|
|
860
|
+
return 0;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child
|
|
864
|
+
* will get the focus. The current algorithm to determine which child will get focus is farthest-distance-priority algorithm
|
|
865
|
+
* @param {Number} direction next focused widget direction
|
|
866
|
+
* @param {Widget} baseWidget
|
|
867
|
+
* @returns {Number} The index of child widget in the container
|
|
868
|
+
* @private
|
|
869
|
+
*/
|
|
870
|
+
_findFarthestChildWidgetIndex(direction, baseWidget) {
|
|
871
|
+
if (baseWidget == null || baseWidget === this)
|
|
872
|
+
return this._findFirstFocusEnabledWidgetIndex();
|
|
873
|
+
let index = 0;
|
|
874
|
+
const locChildren = this.getChildren();
|
|
875
|
+
const count = locChildren.length;
|
|
876
|
+
let distance = -FLT_MAX, found = 0;
|
|
877
|
+
if (direction === Widget.LEFT || direction === Widget.RIGHT || direction === Widget.DOWN || direction === Widget.UP) {
|
|
878
|
+
const widgetPosition = this._getWorldCenterPoint(baseWidget);
|
|
879
|
+
while (index < count) {
|
|
880
|
+
const w = locChildren[index];
|
|
881
|
+
if (w && w instanceof Widget && w.isFocusEnabled()) {
|
|
882
|
+
const length = w instanceof Layout ? w._calculateFarthestDistance(baseWidget) : pLength(pSub(this._getWorldCenterPoint(w), widgetPosition));
|
|
883
|
+
if (length > distance) {
|
|
884
|
+
found = index;
|
|
885
|
+
distance = length;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
index++;
|
|
889
|
+
}
|
|
890
|
+
return found;
|
|
891
|
+
}
|
|
892
|
+
log('invalid focus direction!!!');
|
|
893
|
+
return 0;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* calculate the nearest distance between the baseWidget and the children of the layout
|
|
897
|
+
* @param {Widget} baseWidget the base widget which will be used to calculate the distance between the layout's children and itself
|
|
898
|
+
* @returns {Number} return the nearest distance between the baseWidget and the layout's children
|
|
899
|
+
* @private
|
|
900
|
+
*/
|
|
901
|
+
_calculateNearestDistance(baseWidget) {
|
|
902
|
+
let distance = FLT_MAX;
|
|
903
|
+
const widgetPosition = this._getWorldCenterPoint(baseWidget);
|
|
904
|
+
const locChildren = this._children;
|
|
905
|
+
for (let i = 0, len = locChildren.length; i < len; i++) {
|
|
906
|
+
const widget = locChildren[i];
|
|
907
|
+
let length;
|
|
908
|
+
if (widget instanceof Layout)
|
|
909
|
+
length = widget._calculateNearestDistance(baseWidget);
|
|
910
|
+
else {
|
|
911
|
+
if (widget instanceof Widget && widget.isFocusEnabled())
|
|
912
|
+
length = pLength(pSub(this._getWorldCenterPoint(widget), widgetPosition));
|
|
913
|
+
else
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
if (length < distance)
|
|
917
|
+
distance = length;
|
|
918
|
+
}
|
|
919
|
+
return distance;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* calculate the farthest distance between the baseWidget and the children of the layout
|
|
923
|
+
* @param baseWidget
|
|
924
|
+
* @returns {number}
|
|
925
|
+
* @private
|
|
926
|
+
*/
|
|
927
|
+
_calculateFarthestDistance(baseWidget) {
|
|
928
|
+
let distance = -FLT_MAX;
|
|
929
|
+
const widgetPosition = this._getWorldCenterPoint(baseWidget);
|
|
930
|
+
const locChildren = this._children;
|
|
931
|
+
for (let i = 0, len = locChildren.length; i < len; i++) {
|
|
932
|
+
const layout = locChildren[i];
|
|
933
|
+
let length;
|
|
934
|
+
if (layout instanceof Layout)
|
|
935
|
+
length = layout._calculateFarthestDistance(baseWidget);
|
|
936
|
+
else {
|
|
937
|
+
if (layout instanceof Widget && layout.isFocusEnabled()) {
|
|
938
|
+
const wPosition = this._getWorldCenterPoint(layout);
|
|
939
|
+
length = pLength(pSub(wPosition, widgetPosition));
|
|
940
|
+
}
|
|
941
|
+
else
|
|
942
|
+
continue;
|
|
943
|
+
}
|
|
944
|
+
if (length > distance)
|
|
945
|
+
distance = length;
|
|
946
|
+
}
|
|
947
|
+
return distance;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* when a layout pass the focus to it's child, use this method to determine which algorithm to use, nearest or farthest distance algorithm or not
|
|
951
|
+
* @param direction
|
|
952
|
+
* @param baseWidget
|
|
953
|
+
* @private
|
|
954
|
+
*/
|
|
955
|
+
_findProperSearchingFunctor(direction, baseWidget) {
|
|
956
|
+
if (baseWidget === undefined)
|
|
957
|
+
return;
|
|
958
|
+
const previousWidgetPosition = this._getWorldCenterPoint(baseWidget);
|
|
959
|
+
const widgetPosition = this._getWorldCenterPoint(this._findFirstNonLayoutWidget());
|
|
960
|
+
if (direction === Widget.LEFT) {
|
|
961
|
+
this.onPassFocusToChild =
|
|
962
|
+
previousWidgetPosition.x > widgetPosition.x ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
|
|
963
|
+
}
|
|
964
|
+
else if (direction === Widget.RIGHT) {
|
|
965
|
+
this.onPassFocusToChild =
|
|
966
|
+
previousWidgetPosition.x > widgetPosition.x ? this._findFarthestChildWidgetIndex : this._findNearestChildWidgetIndex;
|
|
967
|
+
}
|
|
968
|
+
else if (direction === Widget.DOWN) {
|
|
969
|
+
this.onPassFocusToChild =
|
|
970
|
+
previousWidgetPosition.y > widgetPosition.y ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
|
|
971
|
+
}
|
|
972
|
+
else if (direction === Widget.UP) {
|
|
973
|
+
this.onPassFocusToChild =
|
|
974
|
+
previousWidgetPosition.y < widgetPosition.y ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
|
|
975
|
+
}
|
|
976
|
+
else
|
|
977
|
+
log('invalid direction!');
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* find the first non-layout widget in this layout
|
|
981
|
+
* @returns {Widget}
|
|
982
|
+
* @private
|
|
983
|
+
*/
|
|
984
|
+
_findFirstNonLayoutWidget() {
|
|
985
|
+
const locChildren = this._children;
|
|
986
|
+
for (let i = 0, len = locChildren.length; i < len; i++) {
|
|
987
|
+
const child = locChildren[i];
|
|
988
|
+
if (child instanceof Layout) {
|
|
989
|
+
const widget = child._findFirstNonLayoutWidget();
|
|
990
|
+
if (widget)
|
|
991
|
+
return widget;
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
if (child instanceof Widget)
|
|
995
|
+
return child;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* find the first focus enabled widget index in the layout, it will recursive searching the child widget
|
|
1002
|
+
* @returns {number}
|
|
1003
|
+
* @private
|
|
1004
|
+
*/
|
|
1005
|
+
_findFirstFocusEnabledWidgetIndex() {
|
|
1006
|
+
let index = 0;
|
|
1007
|
+
const locChildren = this.getChildren();
|
|
1008
|
+
const count = locChildren.length;
|
|
1009
|
+
while (index < count) {
|
|
1010
|
+
const w = locChildren[index];
|
|
1011
|
+
if (w && w instanceof Widget && w.isFocusEnabled())
|
|
1012
|
+
return index;
|
|
1013
|
+
index++;
|
|
1014
|
+
}
|
|
1015
|
+
return 0;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* find a focus enabled child Widget in the layout by index
|
|
1019
|
+
* @param index
|
|
1020
|
+
* @returns {*}
|
|
1021
|
+
* @private
|
|
1022
|
+
*/
|
|
1023
|
+
_findFocusEnabledChildWidgetByIndex(index) {
|
|
1024
|
+
const widget = this._getChildWidgetByIndex(index);
|
|
1025
|
+
if (widget) {
|
|
1026
|
+
if (widget.isFocusEnabled())
|
|
1027
|
+
return widget;
|
|
1028
|
+
index = index + 1;
|
|
1029
|
+
return this._findFocusEnabledChildWidgetByIndex(index);
|
|
1030
|
+
}
|
|
1031
|
+
return null;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* get the center point of a widget in world space
|
|
1035
|
+
* @param {Widget} widget
|
|
1036
|
+
* @returns {Point}
|
|
1037
|
+
* @private
|
|
1038
|
+
*/
|
|
1039
|
+
_getWorldCenterPoint(widget) {
|
|
1040
|
+
//FIXEDME: we don't need to calculate the content size of layout anymore
|
|
1041
|
+
const widgetSize = widget instanceof Layout ? widget._getLayoutAccumulatedSize() : widget.getContentSize();
|
|
1042
|
+
return widget.convertToWorldSpace(p(widgetSize.width / 2, widgetSize.height / 2));
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* this method is called internally by nextFocusedWidget. When the dir is Right/Down, then this method will be called
|
|
1046
|
+
* @param {Number} direction
|
|
1047
|
+
* @param {Widget} current the current focused widget
|
|
1048
|
+
* @returns {Widget} the next focused widget
|
|
1049
|
+
* @private
|
|
1050
|
+
*/
|
|
1051
|
+
_getNextFocusedWidget(direction, current) {
|
|
1052
|
+
let nextWidget;
|
|
1053
|
+
const locChildren = this._children;
|
|
1054
|
+
let previousWidgetPos = locChildren.indexOf(current);
|
|
1055
|
+
previousWidgetPos = previousWidgetPos + 1;
|
|
1056
|
+
if (previousWidgetPos < locChildren.length) {
|
|
1057
|
+
nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
|
|
1058
|
+
//handle widget
|
|
1059
|
+
if (nextWidget) {
|
|
1060
|
+
if (nextWidget.isFocusEnabled()) {
|
|
1061
|
+
if (nextWidget instanceof Layout) {
|
|
1062
|
+
nextWidget._isFocusPassing = true;
|
|
1063
|
+
return nextWidget.findNextFocusedWidget(direction, nextWidget);
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
this.dispatchFocusEvent(current, nextWidget);
|
|
1067
|
+
return nextWidget;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
else
|
|
1071
|
+
return this._getNextFocusedWidget(direction, nextWidget);
|
|
1072
|
+
}
|
|
1073
|
+
else
|
|
1074
|
+
return current;
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
if (this._loopFocus) {
|
|
1078
|
+
if (this._checkFocusEnabledChild()) {
|
|
1079
|
+
previousWidgetPos = 0;
|
|
1080
|
+
nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
|
|
1081
|
+
if (nextWidget.isFocusEnabled()) {
|
|
1082
|
+
if (nextWidget instanceof Layout) {
|
|
1083
|
+
nextWidget._isFocusPassing = true;
|
|
1084
|
+
return nextWidget.findNextFocusedWidget(direction, nextWidget);
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
this.dispatchFocusEvent(current, nextWidget);
|
|
1088
|
+
return nextWidget;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
else
|
|
1092
|
+
return this._getNextFocusedWidget(direction, nextWidget);
|
|
1093
|
+
}
|
|
1094
|
+
else
|
|
1095
|
+
return current instanceof Layout ? current : Widget._focusedWidget;
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
if (this._isLastWidgetInContainer(current, direction)) {
|
|
1099
|
+
if (this._isWidgetAncestorSupportLoopFocus(this, direction))
|
|
1100
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
1101
|
+
return current instanceof Layout ? current : Widget._focusedWidget;
|
|
1102
|
+
}
|
|
1103
|
+
else
|
|
1104
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* this method is called internally by nextFocusedWidget. When the dir is Left/Up, then this method will be called
|
|
1110
|
+
* @param direction
|
|
1111
|
+
* @param {Widget} current the current focused widget
|
|
1112
|
+
* @returns {Widget} the next focused widget
|
|
1113
|
+
* @private
|
|
1114
|
+
*/
|
|
1115
|
+
_getPreviousFocusedWidget(direction, current) {
|
|
1116
|
+
let nextWidget;
|
|
1117
|
+
const locChildren = this._children;
|
|
1118
|
+
let previousWidgetPos = locChildren.indexOf(current);
|
|
1119
|
+
previousWidgetPos = previousWidgetPos - 1;
|
|
1120
|
+
if (previousWidgetPos >= 0) {
|
|
1121
|
+
nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
|
|
1122
|
+
if (nextWidget.isFocusEnabled()) {
|
|
1123
|
+
if (nextWidget instanceof Layout) {
|
|
1124
|
+
nextWidget._isFocusPassing = true;
|
|
1125
|
+
return nextWidget.findNextFocusedWidget(direction, nextWidget);
|
|
1126
|
+
}
|
|
1127
|
+
this.dispatchFocusEvent(current, nextWidget);
|
|
1128
|
+
return nextWidget;
|
|
1129
|
+
}
|
|
1130
|
+
else
|
|
1131
|
+
return this._getPreviousFocusedWidget(direction, nextWidget); //handling the disabled widget, there is no actual focus lose or get, so we don't need any envet
|
|
1132
|
+
}
|
|
1133
|
+
else {
|
|
1134
|
+
if (this._loopFocus) {
|
|
1135
|
+
if (this._checkFocusEnabledChild()) {
|
|
1136
|
+
previousWidgetPos = locChildren.length - 1;
|
|
1137
|
+
nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
|
|
1138
|
+
if (nextWidget.isFocusEnabled()) {
|
|
1139
|
+
if (nextWidget instanceof Layout) {
|
|
1140
|
+
nextWidget._isFocusPassing = true;
|
|
1141
|
+
return nextWidget.findNextFocusedWidget(direction, nextWidget);
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
this.dispatchFocusEvent(current, nextWidget);
|
|
1145
|
+
return nextWidget;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
else
|
|
1149
|
+
return this._getPreviousFocusedWidget(direction, nextWidget);
|
|
1150
|
+
}
|
|
1151
|
+
else
|
|
1152
|
+
return current instanceof Layout ? current : Widget._focusedWidget;
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
if (this._isLastWidgetInContainer(current, direction)) {
|
|
1156
|
+
if (this._isWidgetAncestorSupportLoopFocus(this, direction))
|
|
1157
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
1158
|
+
return current instanceof Layout ? current : Widget._focusedWidget;
|
|
1159
|
+
}
|
|
1160
|
+
else
|
|
1161
|
+
return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* find the nth element in the _children array. Only the Widget descendant object will be returned
|
|
1167
|
+
* @param {Number} index
|
|
1168
|
+
* @returns {Widget}
|
|
1169
|
+
* @private
|
|
1170
|
+
*/
|
|
1171
|
+
_getChildWidgetByIndex(index) {
|
|
1172
|
+
const locChildren = this._children;
|
|
1173
|
+
const size = locChildren.length;
|
|
1174
|
+
let count = 0;
|
|
1175
|
+
const oldIndex = index;
|
|
1176
|
+
while (index < size) {
|
|
1177
|
+
const firstChild = locChildren[index];
|
|
1178
|
+
if (firstChild && firstChild instanceof Widget)
|
|
1179
|
+
return firstChild;
|
|
1180
|
+
count++;
|
|
1181
|
+
index++;
|
|
1182
|
+
}
|
|
1183
|
+
let begin = 0;
|
|
1184
|
+
while (begin < oldIndex) {
|
|
1185
|
+
const child = locChildren[begin];
|
|
1186
|
+
if (child && child instanceof Widget)
|
|
1187
|
+
return child;
|
|
1188
|
+
count++;
|
|
1189
|
+
begin++;
|
|
1190
|
+
}
|
|
1191
|
+
return null;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* whether it is the last element according to all their parents
|
|
1195
|
+
* @param {Widget} widget
|
|
1196
|
+
* @param {Number} direction
|
|
1197
|
+
* @returns {Boolean}
|
|
1198
|
+
* @private
|
|
1199
|
+
*/
|
|
1200
|
+
_isLastWidgetInContainer(widget, direction) {
|
|
1201
|
+
const parent = widget.getParent();
|
|
1202
|
+
if (parent == null || !(parent instanceof Layout))
|
|
1203
|
+
return true;
|
|
1204
|
+
const container = parent.getChildren();
|
|
1205
|
+
const index = container.indexOf(widget);
|
|
1206
|
+
if (parent.getLayoutType() === Layout.LINEAR_HORIZONTAL) {
|
|
1207
|
+
if (direction === Widget.LEFT) {
|
|
1208
|
+
if (index === 0)
|
|
1209
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1210
|
+
else
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
if (direction === Widget.RIGHT) {
|
|
1214
|
+
if (index === container.length - 1)
|
|
1215
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1216
|
+
else
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
1219
|
+
if (direction === Widget.DOWN)
|
|
1220
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1221
|
+
if (direction === Widget.UP)
|
|
1222
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1223
|
+
}
|
|
1224
|
+
else if (parent.getLayoutType() === Layout.LINEAR_VERTICAL) {
|
|
1225
|
+
if (direction === Widget.UP) {
|
|
1226
|
+
if (index === 0)
|
|
1227
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1228
|
+
else
|
|
1229
|
+
return false;
|
|
1230
|
+
}
|
|
1231
|
+
if (direction === Widget.DOWN) {
|
|
1232
|
+
if (index === container.length - 1)
|
|
1233
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1234
|
+
else
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
if (direction === Widget.LEFT)
|
|
1238
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1239
|
+
if (direction === Widget.RIGHT)
|
|
1240
|
+
return this._isLastWidgetInContainer(parent, direction);
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
log('invalid layout Type');
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Lookup any parent widget with a layout type as the direction, if the layout is loop focused, then return true, otherwise it returns false.
|
|
1249
|
+
* @param {Widget} widget
|
|
1250
|
+
* @param {Number} direction
|
|
1251
|
+
* @returns {Boolean}
|
|
1252
|
+
* @private
|
|
1253
|
+
*/
|
|
1254
|
+
_isWidgetAncestorSupportLoopFocus(widget, direction) {
|
|
1255
|
+
const parent = widget.getParent();
|
|
1256
|
+
if (parent == null || !(parent instanceof Layout))
|
|
1257
|
+
return false;
|
|
1258
|
+
if (parent.isLoopFocus()) {
|
|
1259
|
+
const layoutType = parent.getLayoutType();
|
|
1260
|
+
if (layoutType === Layout.LINEAR_HORIZONTAL) {
|
|
1261
|
+
if (direction === Widget.LEFT || direction === Widget.RIGHT)
|
|
1262
|
+
return true;
|
|
1263
|
+
else
|
|
1264
|
+
return this._isWidgetAncestorSupportLoopFocus(parent, direction);
|
|
1265
|
+
}
|
|
1266
|
+
if (layoutType === Layout.LINEAR_VERTICAL) {
|
|
1267
|
+
if (direction === Widget.DOWN || direction === Widget.UP)
|
|
1268
|
+
return true;
|
|
1269
|
+
else
|
|
1270
|
+
return this._isWidgetAncestorSupportLoopFocus(parent, direction);
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
assert(0, 'invalid layout type');
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
else
|
|
1278
|
+
return this._isWidgetAncestorSupportLoopFocus(parent, direction);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* pass the focus to the layout's next focus enabled child
|
|
1282
|
+
* @param {Number} direction
|
|
1283
|
+
* @param {Widget} current
|
|
1284
|
+
* @returns {Widget}
|
|
1285
|
+
* @private
|
|
1286
|
+
*/
|
|
1287
|
+
_passFocusToChild(direction, current) {
|
|
1288
|
+
if (this._checkFocusEnabledChild()) {
|
|
1289
|
+
const previousWidget = Widget.getCurrentFocusedWidget();
|
|
1290
|
+
this._findProperSearchingFunctor(direction, previousWidget);
|
|
1291
|
+
const index = this.onPassFocusToChild(direction, previousWidget);
|
|
1292
|
+
const widget = this._getChildWidgetByIndex(index);
|
|
1293
|
+
if (widget instanceof Layout) {
|
|
1294
|
+
widget._isFocusPassing = true;
|
|
1295
|
+
return widget.findNextFocusedWidget(direction, widget);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
this.dispatchFocusEvent(current, widget);
|
|
1299
|
+
return widget;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
else
|
|
1303
|
+
return this;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* If there are no focus enabled child in the layout, it will return false, otherwise it returns true
|
|
1307
|
+
* @returns {boolean}
|
|
1308
|
+
* @private
|
|
1309
|
+
*/
|
|
1310
|
+
_checkFocusEnabledChild() {
|
|
1311
|
+
const locChildren = this._children;
|
|
1312
|
+
for (let i = 0, len = locChildren.length; i < len; i++) {
|
|
1313
|
+
const widget = locChildren[i];
|
|
1314
|
+
if (widget && widget instanceof Widget && widget.isFocusEnabled())
|
|
1315
|
+
return true;
|
|
1316
|
+
}
|
|
1317
|
+
return false;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Returns the "class name" of widget.
|
|
1321
|
+
* @returns {string}
|
|
1322
|
+
*/
|
|
1323
|
+
getDescription() {
|
|
1324
|
+
return 'Layout';
|
|
1325
|
+
}
|
|
1326
|
+
_createCloneInstance() {
|
|
1327
|
+
return new Layout();
|
|
1328
|
+
}
|
|
1329
|
+
_copyClonedWidgetChildren(model) {
|
|
1330
|
+
Widget.prototype._copyClonedWidgetChildren.call(this, model);
|
|
1331
|
+
}
|
|
1332
|
+
_copySpecialProperties(layout) {
|
|
1333
|
+
if (!(layout instanceof Layout))
|
|
1334
|
+
return;
|
|
1335
|
+
this.setBackGroundImageScale9Enabled(layout._backGroundScale9Enabled);
|
|
1336
|
+
this.setBackGroundImage(layout._backGroundImageFileName, layout._bgImageTexType);
|
|
1337
|
+
this.setBackGroundImageCapInsets(layout._backGroundImageCapInsets);
|
|
1338
|
+
this.setBackGroundColorType(layout._colorType);
|
|
1339
|
+
this.setBackGroundColor(layout._color);
|
|
1340
|
+
this.setBackGroundColor(layout._startColor, layout._endColor);
|
|
1341
|
+
this.setBackGroundColorOpacity(layout._opacity);
|
|
1342
|
+
this.setBackGroundColorVector(layout._alongVector);
|
|
1343
|
+
this.setLayoutType(layout._layoutType);
|
|
1344
|
+
this.setClippingEnabled(layout._clippingEnabled);
|
|
1345
|
+
this.setClippingType(layout._clippingType);
|
|
1346
|
+
this._loopFocus = layout._loopFocus;
|
|
1347
|
+
this.__passFocusToChild = layout.__passFocusToChild;
|
|
1348
|
+
this._isInterceptTouch = layout._isInterceptTouch;
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* force refresh widget layout
|
|
1352
|
+
*/
|
|
1353
|
+
forceDoLayout() {
|
|
1354
|
+
this.requestDoLayout();
|
|
1355
|
+
this._doLayout();
|
|
1356
|
+
}
|
|
1357
|
+
_createRenderCmd() {
|
|
1358
|
+
return new LayoutWebGLRenderCmd(this);
|
|
1359
|
+
}
|
|
1360
|
+
//layoutBackGround color type
|
|
1361
|
+
/**
|
|
1362
|
+
* The None of Layout's background color type
|
|
1363
|
+
* @constant
|
|
1364
|
+
* @type {number}
|
|
1365
|
+
*/
|
|
1366
|
+
static BG_COLOR_NONE = 0;
|
|
1367
|
+
/**
|
|
1368
|
+
* The solid of Layout's background color type, it will use a LayerColor to draw the background.
|
|
1369
|
+
* @constant
|
|
1370
|
+
* @type {number}
|
|
1371
|
+
*/
|
|
1372
|
+
static BG_COLOR_SOLID = 1;
|
|
1373
|
+
/**
|
|
1374
|
+
* The gradient of Layout's background color type, it will use a LayerGradient to draw the background.
|
|
1375
|
+
* @constant
|
|
1376
|
+
* @type {number}
|
|
1377
|
+
*/
|
|
1378
|
+
static BG_COLOR_GRADIENT = 2;
|
|
1379
|
+
//Layout type
|
|
1380
|
+
/**
|
|
1381
|
+
* The absolute of Layout's layout type.
|
|
1382
|
+
* @type {number}
|
|
1383
|
+
* @constant
|
|
1384
|
+
*/
|
|
1385
|
+
static ABSOLUTE = 0;
|
|
1386
|
+
/**
|
|
1387
|
+
* The vertical of Layout's layout type.
|
|
1388
|
+
* @type {number}
|
|
1389
|
+
* @constant
|
|
1390
|
+
*/
|
|
1391
|
+
static LINEAR_VERTICAL = 1;
|
|
1392
|
+
/**
|
|
1393
|
+
* The horizontal of Layout's layout type.
|
|
1394
|
+
* @type {number}
|
|
1395
|
+
* @constant
|
|
1396
|
+
*/
|
|
1397
|
+
static LINEAR_HORIZONTAL = 2;
|
|
1398
|
+
/**
|
|
1399
|
+
* The relative of Layout's layout type.
|
|
1400
|
+
* @type {number}
|
|
1401
|
+
* @constant
|
|
1402
|
+
*/
|
|
1403
|
+
static RELATIVE = 3;
|
|
1404
|
+
//Layout clipping type
|
|
1405
|
+
/**
|
|
1406
|
+
* The stencil of Layout's clipping type.
|
|
1407
|
+
* @type {number}
|
|
1408
|
+
* @constant
|
|
1409
|
+
*/
|
|
1410
|
+
static CLIPPING_STENCIL = 0;
|
|
1411
|
+
/**
|
|
1412
|
+
* The scissor of Layout's clipping type.
|
|
1413
|
+
* @type {number}
|
|
1414
|
+
* @constant
|
|
1415
|
+
*/
|
|
1416
|
+
static CLIPPING_SCISSOR = 1;
|
|
1417
|
+
/**
|
|
1418
|
+
* The zOrder value of Layout's image background.
|
|
1419
|
+
* @type {number}
|
|
1420
|
+
* @constant
|
|
1421
|
+
*/
|
|
1422
|
+
static BACKGROUND_IMAGE_ZORDER = -1;
|
|
1423
|
+
/**
|
|
1424
|
+
* The zOrder value of Layout's color background.
|
|
1425
|
+
* @type {number}
|
|
1426
|
+
* @constant
|
|
1427
|
+
*/
|
|
1428
|
+
static BACKGROUND_RENDERER_ZORDER = -2;
|
|
1429
|
+
}
|
|
1430
|
+
//# sourceMappingURL=UILayout.js.map
|