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,1634 @@
|
|
|
1
|
+
import { renderer } from '../..';
|
|
2
|
+
import { Node } from '../../core/base-nodes/Node';
|
|
3
|
+
import { p, Rect, rectContainsPoint, Size } from '../../core/cocoa/Geometry';
|
|
4
|
+
import { EventListener } from '../../core/event-manager';
|
|
5
|
+
import { EventFocus } from '../../core/event-manager/EventFocus';
|
|
6
|
+
import { createEventListener, eventManager } from '../../core/event-manager/EventManager';
|
|
7
|
+
import { arrayRemoveObject, SHADER_SPRITE_POSITION_TEXTURECOLOR, SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY } from '../../core/platform';
|
|
8
|
+
import { log } from '../../helper/Debugger';
|
|
9
|
+
import { shaderCache } from '../../shaders/ShaderCache';
|
|
10
|
+
// import { Layout } from '../layout/UILayout'
|
|
11
|
+
import { LayoutParameter } from '../layout/UILayoutParameter';
|
|
12
|
+
import { FocusNavigationController } from './FocusNavigationController';
|
|
13
|
+
import { ProtectedNode } from './ProtectedNode';
|
|
14
|
+
import { WidgetWebGLRenderCmd } from './UIWidgetRenderCmd';
|
|
15
|
+
export const __LAYOUT_COMPONENT_NAME = '__ui_layout';
|
|
16
|
+
export class Widget extends ProtectedNode {
|
|
17
|
+
_enabled = true; ///< Highest control of widget
|
|
18
|
+
_bright = true; ///< is this widget bright
|
|
19
|
+
_touchEnabled = false; ///< is this widget touch endabled
|
|
20
|
+
_name = 'default';
|
|
21
|
+
_widgetType = null;
|
|
22
|
+
_actionTag = 0;
|
|
23
|
+
_customSize = null;
|
|
24
|
+
_layoutParameterType = 0;
|
|
25
|
+
_focused = false;
|
|
26
|
+
_focusEnabled = true;
|
|
27
|
+
_ignoreSize = false;
|
|
28
|
+
_affectByClipping = false;
|
|
29
|
+
_sizeType = null;
|
|
30
|
+
_sizePercent = null;
|
|
31
|
+
_positionType = null;
|
|
32
|
+
_positionPercent = null;
|
|
33
|
+
_hit = false;
|
|
34
|
+
_nodes = null;
|
|
35
|
+
_touchListener = null;
|
|
36
|
+
_className = 'Widget';
|
|
37
|
+
_flippedX = false;
|
|
38
|
+
_flippedY = false;
|
|
39
|
+
_opacity = 255;
|
|
40
|
+
_highlight = false;
|
|
41
|
+
_propagateTouchEvents = true;
|
|
42
|
+
_unifySize = false;
|
|
43
|
+
_inViewRect = true;
|
|
44
|
+
/**
|
|
45
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
|
|
46
|
+
* @function
|
|
47
|
+
*/
|
|
48
|
+
constructor() {
|
|
49
|
+
super();
|
|
50
|
+
this._brightStyle = Widget.BRIGHT_STYLE_NONE;
|
|
51
|
+
this._touchBeganPosition = p(0, 0);
|
|
52
|
+
this._touchMovePosition = p(0, 0);
|
|
53
|
+
this._touchEndPosition = p(0, 0);
|
|
54
|
+
this._widgetType = Widget.TYPE_WIDGET;
|
|
55
|
+
this._customSize = Size(0, 0);
|
|
56
|
+
this._layoutParameterDictionary = {};
|
|
57
|
+
this._sizeType = Widget.SIZE_ABSOLUTE;
|
|
58
|
+
this._sizePercent = p(0, 0);
|
|
59
|
+
this._positionType = Widget.POSITION_ABSOLUTE;
|
|
60
|
+
this._positionPercent = p(0, 0);
|
|
61
|
+
this._nodes = [];
|
|
62
|
+
this._layoutParameterType = LayoutParameter.NONE;
|
|
63
|
+
this.init();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* initializes state of widget. please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
69
|
+
init() {
|
|
70
|
+
this._layoutParameterDictionary = {};
|
|
71
|
+
this._initRenderer();
|
|
72
|
+
this.setBright(true);
|
|
73
|
+
this.onFocusChanged = this.onFocusChange;
|
|
74
|
+
this.onNextFocusedWidget = null;
|
|
75
|
+
this.setAnchorPoint(p(0.5, 0.5));
|
|
76
|
+
this.ignoreContentAdaptWithSize(true);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Calls updateSizeAndPosition and its parent's onEnter
|
|
81
|
+
* @override
|
|
82
|
+
*/
|
|
83
|
+
onEnter() {
|
|
84
|
+
const locListener = this._touchListener;
|
|
85
|
+
if (locListener && !locListener._isRegistered() && this._touchEnabled)
|
|
86
|
+
eventManager.addListener(locListener, this);
|
|
87
|
+
this.updateSizeAndPosition();
|
|
88
|
+
if (this._sizeDirty)
|
|
89
|
+
this._onSizeChanged();
|
|
90
|
+
super.onEnter();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Calls unscheduleUpdate and its parent's onExit
|
|
94
|
+
* @override
|
|
95
|
+
*/
|
|
96
|
+
onExit() {
|
|
97
|
+
this.unscheduleUpdate();
|
|
98
|
+
super.onExit();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The direct parent when it's a widget also, otherwise equals null
|
|
102
|
+
* @returns {Widget|null}
|
|
103
|
+
*/
|
|
104
|
+
getWidgetParent() {
|
|
105
|
+
const widget = this.getParent();
|
|
106
|
+
if (widget instanceof Widget)
|
|
107
|
+
return widget;
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
_updateContentSizeWithTextureSize(size) {
|
|
111
|
+
if (this._unifySize) {
|
|
112
|
+
this.setContentSize(size);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.setContentSize(this._ignoreSize ? size : this._customSize);
|
|
116
|
+
}
|
|
117
|
+
_isAncestorsEnabled() {
|
|
118
|
+
const parentWidget = this._getAncensterWidget(this);
|
|
119
|
+
if (parentWidget == null)
|
|
120
|
+
return true;
|
|
121
|
+
if (parentWidget && !parentWidget.isEnabled())
|
|
122
|
+
return false;
|
|
123
|
+
return parentWidget._isAncestorsEnabled();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Allow widget touch events to propagate to its parents. Set false will disable propagation
|
|
127
|
+
* @since v3.2
|
|
128
|
+
* @param {Boolean} isPropagate
|
|
129
|
+
*/
|
|
130
|
+
setPropagateTouchEvents(isPropagate) {
|
|
131
|
+
this._propagateTouchEvents = isPropagate;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Return whether the widget is propagate touch events to its parents or not
|
|
135
|
+
* @since v3.2
|
|
136
|
+
* @returns {boolean}
|
|
137
|
+
*/
|
|
138
|
+
isPropagateTouchEvents() {
|
|
139
|
+
return this._propagateTouchEvents;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Specify widget to swallow touches or not
|
|
143
|
+
* @since v3.2
|
|
144
|
+
* @param {Boolean} swallow
|
|
145
|
+
*/
|
|
146
|
+
setSwallowTouches(swallow) {
|
|
147
|
+
if (this._touchListener)
|
|
148
|
+
this._touchListener.setSwallowTouches(swallow);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Return whether the widget is swallowing touch or not
|
|
152
|
+
* @since v3.2
|
|
153
|
+
* @returns {boolean}
|
|
154
|
+
*/
|
|
155
|
+
isSwallowTouches() {
|
|
156
|
+
if (this._touchListener) {
|
|
157
|
+
//return true; //todo need test
|
|
158
|
+
return this._touchListener.isSwallowTouches();
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
_getAncensterWidget(node) {
|
|
163
|
+
if (null == node)
|
|
164
|
+
return null;
|
|
165
|
+
const parent = node.getParent();
|
|
166
|
+
if (null == parent)
|
|
167
|
+
return null;
|
|
168
|
+
if (parent instanceof Widget)
|
|
169
|
+
return parent;
|
|
170
|
+
else
|
|
171
|
+
return this._getAncensterWidget(parent.getParent());
|
|
172
|
+
}
|
|
173
|
+
_isAncestorsVisible(node) {
|
|
174
|
+
if (null == node)
|
|
175
|
+
return true;
|
|
176
|
+
const parent = node.getParent();
|
|
177
|
+
if (parent && !parent.isVisible())
|
|
178
|
+
return false;
|
|
179
|
+
return this._isAncestorsVisible(parent);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* <p>
|
|
183
|
+
* Sets whether the widget is enabled <br/>
|
|
184
|
+
* true if the widget is enabled, widget may be touched , false if the widget is disabled, widget cannot be touched. <br/>
|
|
185
|
+
* The default value is true, a widget is default to enabled
|
|
186
|
+
* </p>
|
|
187
|
+
* @param {Boolean} enabled
|
|
188
|
+
*/
|
|
189
|
+
setEnabled(enabled) {
|
|
190
|
+
this._enabled = enabled;
|
|
191
|
+
this.setBright(enabled);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* initializes renderer of widget.
|
|
195
|
+
*/
|
|
196
|
+
_initRenderer() { }
|
|
197
|
+
/**
|
|
198
|
+
* Sets _customSize of Widget, if ignoreSize is true, the content size is its renderer's contentSize, otherwise the content size is parameter.
|
|
199
|
+
* and updates size percent by parent content size. At last, updates its children's size and position.
|
|
200
|
+
* @param {Size|Number} contentSize content size or width of content size
|
|
201
|
+
* @param {Number} [height]
|
|
202
|
+
* @override
|
|
203
|
+
*/
|
|
204
|
+
setContentSize(contentSize, height) {
|
|
205
|
+
super.setContentSize(contentSize, height);
|
|
206
|
+
const locWidth = this._contentSize.width;
|
|
207
|
+
const locHeight = this._contentSize.height;
|
|
208
|
+
this._customSize.width = locWidth;
|
|
209
|
+
this._customSize.height = locHeight;
|
|
210
|
+
if (this._unifySize) {
|
|
211
|
+
//unify size logic
|
|
212
|
+
}
|
|
213
|
+
else if (this._ignoreSize) {
|
|
214
|
+
this._contentSize = this.getVirtualRendererSize();
|
|
215
|
+
}
|
|
216
|
+
if (this._running) {
|
|
217
|
+
const widgetParent = this.getWidgetParent();
|
|
218
|
+
const pSize = widgetParent ? widgetParent.getContentSize() : this._parent.getContentSize();
|
|
219
|
+
this._sizePercent.x = pSize.width > 0.0 ? locWidth / pSize.width : 0.0;
|
|
220
|
+
this._sizePercent.y = pSize.height > 0.0 ? locHeight / pSize.height : 0.0;
|
|
221
|
+
}
|
|
222
|
+
if (this._running) {
|
|
223
|
+
this._onSizeChanged();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
this._sizeDirty = true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
_setWidth(w) {
|
|
230
|
+
if (w === this._contentSize.width) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
super._setWidth(w);
|
|
234
|
+
this._customSize.width = w;
|
|
235
|
+
if (this._unifySize) {
|
|
236
|
+
//unify size logic
|
|
237
|
+
}
|
|
238
|
+
else if (this._ignoreSize) {
|
|
239
|
+
this._contentSize = this.getVirtualRendererSize();
|
|
240
|
+
}
|
|
241
|
+
if (this._running) {
|
|
242
|
+
const widgetParent = this.getWidgetParent();
|
|
243
|
+
const locWidth = widgetParent ? widgetParent._getWidth() : this._parent._getWidth();
|
|
244
|
+
this._sizePercent.x = locWidth > 0 ? this._customSize.width / locWidth : 0;
|
|
245
|
+
}
|
|
246
|
+
if (this._running) {
|
|
247
|
+
this._onSizeChanged();
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
this._sizeDirty = true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
_setHeight(h) {
|
|
254
|
+
if (h === this._contentSize.height) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
Node.prototype._setHeight.call(this, h);
|
|
258
|
+
this._customSize.height = h;
|
|
259
|
+
if (this._unifySize) {
|
|
260
|
+
//unify size logic
|
|
261
|
+
}
|
|
262
|
+
else if (this._ignoreSize) {
|
|
263
|
+
this._contentSize = this.getVirtualRendererSize();
|
|
264
|
+
}
|
|
265
|
+
if (this._running) {
|
|
266
|
+
const widgetParent = this.getWidgetParent();
|
|
267
|
+
const locH = widgetParent ? widgetParent._getHeight() : this._parent._getHeight();
|
|
268
|
+
this._sizePercent.y = locH > 0 ? this._customSize.height / locH : 0;
|
|
269
|
+
}
|
|
270
|
+
if (this._running) {
|
|
271
|
+
this._onSizeChanged();
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this._sizeDirty = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Changes the percent that is widget's percent size
|
|
279
|
+
* @param {Point} percent that is widget's percent size, width and height value from 0 to 1.
|
|
280
|
+
*/
|
|
281
|
+
setSizePercent(percent) {
|
|
282
|
+
this._sizePercent.x = percent.x;
|
|
283
|
+
this._sizePercent.y = percent.y;
|
|
284
|
+
let width = this._customSize.width, height = this._customSize.height;
|
|
285
|
+
if (this._running) {
|
|
286
|
+
const widgetParent = this.getWidgetParent();
|
|
287
|
+
if (widgetParent) {
|
|
288
|
+
width = widgetParent._getWidth() * percent.x;
|
|
289
|
+
height = widgetParent._getHeight() * percent.y;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
width = this._parent._getWidth() * percent.x;
|
|
293
|
+
height = this._parent._getHeight() * percent.y;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (this._ignoreSize)
|
|
297
|
+
this.setContentSize(this.getVirtualRendererSize());
|
|
298
|
+
else
|
|
299
|
+
this.setContentSize(width, height);
|
|
300
|
+
this._customSize.width = width;
|
|
301
|
+
this._customSize.height = height;
|
|
302
|
+
}
|
|
303
|
+
_setWidthPercent(percent) {
|
|
304
|
+
this._sizePercent.x = percent;
|
|
305
|
+
let width = this._customSize.width;
|
|
306
|
+
if (this._running) {
|
|
307
|
+
const widgetParent = this.getWidgetParent();
|
|
308
|
+
width = (widgetParent ? widgetParent._getWidth() : this._parent._getWidth()) * percent;
|
|
309
|
+
}
|
|
310
|
+
if (this._ignoreSize)
|
|
311
|
+
this._setWidth(this.getVirtualRendererSize().width);
|
|
312
|
+
else
|
|
313
|
+
this._setWidth(width);
|
|
314
|
+
this._customSize.width = width;
|
|
315
|
+
}
|
|
316
|
+
_setHeightPercent(percent) {
|
|
317
|
+
this._sizePercent.y = percent;
|
|
318
|
+
let height = this._customSize.height;
|
|
319
|
+
if (this._running) {
|
|
320
|
+
const widgetParent = this.getWidgetParent();
|
|
321
|
+
height = (widgetParent ? widgetParent._getHeight() : this._parent._getHeight()) * percent;
|
|
322
|
+
}
|
|
323
|
+
if (this._ignoreSize)
|
|
324
|
+
this._setHeight(this.getVirtualRendererSize().height);
|
|
325
|
+
else
|
|
326
|
+
this._setHeight(height);
|
|
327
|
+
this._customSize.height = height;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* updates its size by size type and its position by position type.
|
|
331
|
+
* @param {Size} [parentSize] parent size
|
|
332
|
+
*/
|
|
333
|
+
updateSizeAndPosition(parentSize) {
|
|
334
|
+
if (!parentSize) {
|
|
335
|
+
const widgetParent = this.getWidgetParent();
|
|
336
|
+
if (widgetParent)
|
|
337
|
+
parentSize = widgetParent.getLayoutSize();
|
|
338
|
+
else
|
|
339
|
+
parentSize = this._parent.getContentSize();
|
|
340
|
+
}
|
|
341
|
+
switch (this._sizeType) {
|
|
342
|
+
case Widget.SIZE_ABSOLUTE:
|
|
343
|
+
if (this._ignoreSize)
|
|
344
|
+
this.setContentSize(this.getVirtualRendererSize());
|
|
345
|
+
else
|
|
346
|
+
this.setContentSize(this._customSize);
|
|
347
|
+
this._sizePercent.x = parentSize.width > 0 ? this._customSize.width / parentSize.width : 0;
|
|
348
|
+
this._sizePercent.y = parentSize.height > 0 ? this._customSize.height / parentSize.height : 0;
|
|
349
|
+
break;
|
|
350
|
+
case Widget.SIZE_PERCENT: {
|
|
351
|
+
const cSize = Size(parentSize.width * this._sizePercent.x, parentSize.height * this._sizePercent.y);
|
|
352
|
+
if (this._ignoreSize)
|
|
353
|
+
this.setContentSize(this.getVirtualRendererSize());
|
|
354
|
+
else
|
|
355
|
+
this.setContentSize(cSize);
|
|
356
|
+
this._customSize.width = cSize.width;
|
|
357
|
+
this._customSize.height = cSize.height;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
default:
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
this._onSizeChanged();
|
|
364
|
+
let absPos = this.getPosition();
|
|
365
|
+
switch (this._positionType) {
|
|
366
|
+
case Widget.POSITION_ABSOLUTE:
|
|
367
|
+
if (parentSize.width <= 0 || parentSize.height <= 0) {
|
|
368
|
+
this._positionPercent.x = this._positionPercent.y = 0;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
this._positionPercent.x = absPos.x / parentSize.width;
|
|
372
|
+
this._positionPercent.y = absPos.y / parentSize.height;
|
|
373
|
+
}
|
|
374
|
+
break;
|
|
375
|
+
case Widget.POSITION_PERCENT:
|
|
376
|
+
absPos = p(parentSize.width * this._positionPercent.x, parentSize.height * this._positionPercent.y);
|
|
377
|
+
break;
|
|
378
|
+
default:
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
// if (this._parent instanceof ImageView) {
|
|
382
|
+
// const renderer = this._parent._imageRenderer
|
|
383
|
+
// if (renderer && !renderer._textureLoaded) return
|
|
384
|
+
// }
|
|
385
|
+
this.setPosition(absPos);
|
|
386
|
+
}
|
|
387
|
+
/**TEXTURE_RES_TYPE
|
|
388
|
+
* Changes the size type of widget.
|
|
389
|
+
* @param {Widget.SIZE_ABSOLUTE|Widget.SIZE_PERCENT} type that is widget's size type
|
|
390
|
+
*/
|
|
391
|
+
setSizeType(type) {
|
|
392
|
+
this._sizeType = type;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Gets the size type of widget.
|
|
396
|
+
* @returns {Widget.SIZE_ABSOLUTE|Widget.SIZE_PERCENT} that is widget's size type
|
|
397
|
+
*/
|
|
398
|
+
getSizeType() {
|
|
399
|
+
return this._sizeType;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Ignore the widget size
|
|
403
|
+
* @param {Boolean} ignore true that widget will ignore it's size, use texture size, false otherwise. Default value is true.
|
|
404
|
+
*/
|
|
405
|
+
ignoreContentAdaptWithSize(ignore) {
|
|
406
|
+
if (this._unifySize) {
|
|
407
|
+
this.setContentSize(this._customSize);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (this._ignoreSize === ignore)
|
|
411
|
+
return;
|
|
412
|
+
this._ignoreSize = ignore;
|
|
413
|
+
this.setContentSize(ignore ? this.getVirtualRendererSize() : this._customSize);
|
|
414
|
+
//this._onSizeChanged();
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Gets whether ignore the content size (custom size)
|
|
418
|
+
* @returns {boolean} true that widget will ignore it's size, use texture size, false otherwise.
|
|
419
|
+
*/
|
|
420
|
+
isIgnoreContentAdaptWithSize() {
|
|
421
|
+
return this._ignoreSize;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get custom size of Widget
|
|
425
|
+
* @returns {Size}
|
|
426
|
+
*/
|
|
427
|
+
getCustomSize() {
|
|
428
|
+
return Size(this._customSize);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Gets layout size of Widget.
|
|
432
|
+
* @returns {Size}
|
|
433
|
+
*/
|
|
434
|
+
getLayoutSize() {
|
|
435
|
+
return Size(this._contentSize);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Returns size percent of Widget
|
|
439
|
+
* @returns {Point}
|
|
440
|
+
*/
|
|
441
|
+
getSizePercent() {
|
|
442
|
+
return this._sizePercent;
|
|
443
|
+
}
|
|
444
|
+
_getWidthPercent() {
|
|
445
|
+
return this._sizePercent.x;
|
|
446
|
+
}
|
|
447
|
+
_getHeightPercent() {
|
|
448
|
+
return this._sizePercent.y;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Gets world position of Widget.
|
|
452
|
+
* @returns {Point} world position of Widget.
|
|
453
|
+
*/
|
|
454
|
+
getWorldPosition() {
|
|
455
|
+
return this.convertToWorldSpace(p(this._anchorPoint.x * this._contentSize.width, this._anchorPoint.y * this._contentSize.height));
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Gets the Virtual Renderer of widget.
|
|
459
|
+
* @returns {Widget}
|
|
460
|
+
*/
|
|
461
|
+
getVirtualRenderer() {
|
|
462
|
+
return this;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Gets the content size of widget. Content size is widget's texture size.
|
|
466
|
+
*/
|
|
467
|
+
getVirtualRendererSize() {
|
|
468
|
+
return Size(this._contentSize);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* call back function called when size changed.
|
|
472
|
+
*/
|
|
473
|
+
_onSizeChanged() {
|
|
474
|
+
const locChildren = this.getChildren();
|
|
475
|
+
for (let i = 0, len = locChildren.length; i < len; i++) {
|
|
476
|
+
const child = locChildren[i];
|
|
477
|
+
if (child instanceof Widget)
|
|
478
|
+
child.updateSizeAndPosition();
|
|
479
|
+
}
|
|
480
|
+
this._sizeDirty = false;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Sets whether the widget is touch enabled. The default value is false, a widget is default to touch disabled
|
|
484
|
+
* @param {Boolean} enable true if the widget is touch enabled, false if the widget is touch disabled.
|
|
485
|
+
*/
|
|
486
|
+
setTouchEnabled(enable) {
|
|
487
|
+
if (this._touchEnabled === enable)
|
|
488
|
+
return;
|
|
489
|
+
this._touchEnabled = enable; //TODO need consider remove and re-add.
|
|
490
|
+
if (this._touchEnabled) {
|
|
491
|
+
if (!this._touchListener)
|
|
492
|
+
this._touchListener = createEventListener({
|
|
493
|
+
event: EventListener.TOUCH_ONE_BY_ONE,
|
|
494
|
+
swallowTouches: true,
|
|
495
|
+
onTouchBegan: this.onTouchBegan.bind(this),
|
|
496
|
+
onTouchMoved: this.onTouchMoved.bind(this),
|
|
497
|
+
onTouchEnded: this.onTouchEnded.bind(this),
|
|
498
|
+
});
|
|
499
|
+
eventManager.addListener(this._touchListener, this);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
eventManager.removeListener(this._touchListener);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Returns whether or not touch is enabled.
|
|
507
|
+
* @returns {boolean} true if the widget is touch enabled, false if the widget is touch disabled.
|
|
508
|
+
*/
|
|
509
|
+
isTouchEnabled() {
|
|
510
|
+
return this._touchEnabled;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Determines if the widget is highlighted
|
|
514
|
+
* @returns {boolean} true if the widget is highlighted, false if the widget is not highlighted .
|
|
515
|
+
*/
|
|
516
|
+
isHighlighted() {
|
|
517
|
+
return this._highlight;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Sets whether the widget is highlighted. The default value is false, a widget is default to not highlighted
|
|
521
|
+
* @param highlight true if the widget is highlighted, false if the widget is not highlighted.
|
|
522
|
+
*/
|
|
523
|
+
setHighlighted(highlight) {
|
|
524
|
+
if (highlight === this._highlight)
|
|
525
|
+
return;
|
|
526
|
+
this._highlight = highlight;
|
|
527
|
+
if (this._bright) {
|
|
528
|
+
if (this._highlight)
|
|
529
|
+
this.setBrightStyle(Widget.BRIGHT_STYLE_HIGH_LIGHT);
|
|
530
|
+
else
|
|
531
|
+
this.setBrightStyle(Widget.BRIGHT_STYLE_NORMAL);
|
|
532
|
+
}
|
|
533
|
+
else
|
|
534
|
+
this._onPressStateChangedToDisabled();
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Determines if the widget is on focused
|
|
538
|
+
* @returns {boolean} whether the widget is focused or not
|
|
539
|
+
*/
|
|
540
|
+
isFocused() {
|
|
541
|
+
return this._focused;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Sets whether the widget is on focused
|
|
545
|
+
* The default value is false, a widget is default to not on focused
|
|
546
|
+
* @param {boolean} focus pass true to let the widget get focus or pass false to let the widget lose focus
|
|
547
|
+
*/
|
|
548
|
+
setFocused(focus) {
|
|
549
|
+
this._focused = focus;
|
|
550
|
+
//make sure there is only one focusedWidget
|
|
551
|
+
if (focus) {
|
|
552
|
+
Widget._focusedWidget = this;
|
|
553
|
+
if (Widget._focusNavigationController)
|
|
554
|
+
Widget._focusNavigationController._setFirstFocsuedWidget(this);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* returns whether the widget could accept focus.
|
|
559
|
+
* @returns {boolean} true represent the widget could accept focus, false represent the widget couldn't accept focus
|
|
560
|
+
*/
|
|
561
|
+
isFocusEnabled() {
|
|
562
|
+
return this._focusEnabled;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* sets whether the widget could accept focus.
|
|
566
|
+
* @param {Boolean} enable true represent the widget could accept focus, false represent the widget couldn't accept focus
|
|
567
|
+
*/
|
|
568
|
+
setFocusEnabled(enable) {
|
|
569
|
+
this._focusEnabled = enable;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* <p>
|
|
573
|
+
* When a widget is in a layout, you could call this method to get the next focused widget within a specified direction. <br/>
|
|
574
|
+
* If the widget is not in a layout, it will return itself
|
|
575
|
+
* </p>
|
|
576
|
+
* @param direction the direction to look for the next focused widget in a layout
|
|
577
|
+
* @param current the current focused widget
|
|
578
|
+
* @return the next focused widget in a layout
|
|
579
|
+
*/
|
|
580
|
+
findNextFocusedWidget(direction, current) {
|
|
581
|
+
if (null === this.onNextFocusedWidget || null == this.onNextFocusedWidget(direction)) {
|
|
582
|
+
const isLayout = current._layoutType;
|
|
583
|
+
if (this.isFocused() || isLayout) {
|
|
584
|
+
const layout = this.getParent();
|
|
585
|
+
if (null === layout || !layout._layoutType) {
|
|
586
|
+
//the outer layout's default behaviour is : loop focus
|
|
587
|
+
if (isLayout)
|
|
588
|
+
return current.findNextFocusedWidget(direction, current);
|
|
589
|
+
return current;
|
|
590
|
+
}
|
|
591
|
+
else
|
|
592
|
+
return layout.findNextFocusedWidget(direction, current);
|
|
593
|
+
}
|
|
594
|
+
else
|
|
595
|
+
return current;
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
const getFocusWidget = this.onNextFocusedWidget(direction);
|
|
599
|
+
this.dispatchFocusEvent(this, getFocusWidget);
|
|
600
|
+
return getFocusWidget;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* when a widget calls this method, it will get focus immediately.
|
|
605
|
+
*/
|
|
606
|
+
requestFocus() {
|
|
607
|
+
if (this === Widget._focusedWidget)
|
|
608
|
+
return;
|
|
609
|
+
this.dispatchFocusEvent(Widget._focusedWidget, this);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* no matter what widget object you call this method on , it will return you the exact one focused widget
|
|
613
|
+
*/
|
|
614
|
+
getCurrentFocusedWidget() {
|
|
615
|
+
return Widget._focusedWidget;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Sends the touch event to widget's parent, its subclass will override it, e.g. ScrollView, PageView
|
|
619
|
+
* @param {Number} eventType
|
|
620
|
+
* @param {Widget} sender
|
|
621
|
+
* @param {Touch} touch
|
|
622
|
+
*/
|
|
623
|
+
interceptTouchEvent(eventType, sender, touch) {
|
|
624
|
+
const widgetParent = this.getWidgetParent();
|
|
625
|
+
if (widgetParent)
|
|
626
|
+
widgetParent.interceptTouchEvent(eventType, sender, touch);
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* This method is called when a focus change event happens
|
|
630
|
+
* @param {Widget} widgetLostFocus
|
|
631
|
+
* @param {Widget} widgetGetFocus
|
|
632
|
+
*/
|
|
633
|
+
onFocusChange(widgetLostFocus, widgetGetFocus) {
|
|
634
|
+
//only change focus when there is indeed a get&lose happens
|
|
635
|
+
if (widgetLostFocus)
|
|
636
|
+
widgetLostFocus.setFocused(false);
|
|
637
|
+
if (widgetGetFocus)
|
|
638
|
+
widgetGetFocus.setFocused(true);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Dispatch a EventFocus through a EventDispatcher
|
|
642
|
+
* @param {Widget} widgetLostFocus
|
|
643
|
+
* @param {Widget} widgetGetFocus
|
|
644
|
+
*/
|
|
645
|
+
dispatchFocusEvent(widgetLostFocus, widgetGetFocus) {
|
|
646
|
+
//if the widgetLoseFocus doesn't get focus, it will use the previous focused widget instead
|
|
647
|
+
if (widgetLostFocus && !widgetLostFocus.isFocused())
|
|
648
|
+
widgetLostFocus = Widget._focusedWidget;
|
|
649
|
+
if (widgetGetFocus !== widgetLostFocus) {
|
|
650
|
+
if (widgetGetFocus && widgetGetFocus.onFocusChanged)
|
|
651
|
+
widgetGetFocus.onFocusChanged(widgetLostFocus, widgetGetFocus);
|
|
652
|
+
if (widgetLostFocus && widgetGetFocus.onFocusChanged)
|
|
653
|
+
widgetLostFocus.onFocusChanged(widgetLostFocus, widgetGetFocus);
|
|
654
|
+
eventManager.dispatchEvent(new EventFocus(widgetLostFocus, widgetGetFocus));
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Sets whether the widget is bright. The default value is true, a widget is default to bright
|
|
659
|
+
* @param {Boolean} bright true if the widget is bright, false if the widget is dark.
|
|
660
|
+
*/
|
|
661
|
+
setBright(bright) {
|
|
662
|
+
this._bright = bright;
|
|
663
|
+
if (this._bright) {
|
|
664
|
+
this._brightStyle = Widget.BRIGHT_STYLE_NONE;
|
|
665
|
+
this.setBrightStyle(Widget.BRIGHT_STYLE_NORMAL);
|
|
666
|
+
}
|
|
667
|
+
else
|
|
668
|
+
this._onPressStateChangedToDisabled();
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* To set the bright style of Widget.
|
|
672
|
+
* @param {Number} style BRIGHT_NORMAL the widget is normal state, BRIGHT_HIGHLIGHT the widget is height light state.
|
|
673
|
+
*/
|
|
674
|
+
setBrightStyle(style) {
|
|
675
|
+
if (this._brightStyle === style)
|
|
676
|
+
return;
|
|
677
|
+
style = style || Widget.BRIGHT_STYLE_NORMAL;
|
|
678
|
+
this._brightStyle = style;
|
|
679
|
+
switch (this._brightStyle) {
|
|
680
|
+
case Widget.BRIGHT_STYLE_NORMAL:
|
|
681
|
+
this._onPressStateChangedToNormal();
|
|
682
|
+
break;
|
|
683
|
+
case Widget.BRIGHT_STYLE_HIGH_LIGHT:
|
|
684
|
+
this._onPressStateChangedToPressed();
|
|
685
|
+
break;
|
|
686
|
+
default:
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
_onPressStateChangedToNormal() { }
|
|
691
|
+
_onPressStateChangedToPressed() { }
|
|
692
|
+
_onPressStateChangedToDisabled() { }
|
|
693
|
+
_updateChildrenDisplayedRGBA() {
|
|
694
|
+
this.setColor(this.getColor());
|
|
695
|
+
this.setOpacity(this.getOpacity());
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* A call back function when widget lost of focus.
|
|
699
|
+
*/
|
|
700
|
+
didNotSelectSelf() { }
|
|
701
|
+
/**
|
|
702
|
+
* <p>
|
|
703
|
+
* The callback of touch began event. <br/>
|
|
704
|
+
* If the bounding box of Widget contains the touch point, it will do the following things: <br/>
|
|
705
|
+
* 1. sets highlight state, <br/>
|
|
706
|
+
* 2. sends event to parent widget by interceptTouchEvent <br/>
|
|
707
|
+
* 3. calls the callback of touch began event. <br/>
|
|
708
|
+
* 4. returns true, <br/>
|
|
709
|
+
* otherwise returns false directly. <br/>
|
|
710
|
+
* </p>
|
|
711
|
+
* @override
|
|
712
|
+
* @param {Touch} touch
|
|
713
|
+
* @param {Event} event
|
|
714
|
+
* @returns {boolean}
|
|
715
|
+
*/
|
|
716
|
+
onTouchBegan(touch, event) {
|
|
717
|
+
this._hit = false;
|
|
718
|
+
if (this.isVisible() && this.isEnabled() && this._isAncestorsEnabled() && this._isAncestorsVisible(this)) {
|
|
719
|
+
const touchPoint = touch.getLocation();
|
|
720
|
+
this._touchBeganPosition.x = touchPoint.x;
|
|
721
|
+
this._touchBeganPosition.y = touchPoint.y;
|
|
722
|
+
if (this.hitTest(this._touchBeganPosition) && this.isClippingParentContainsPoint(this._touchBeganPosition))
|
|
723
|
+
this._hit = true;
|
|
724
|
+
}
|
|
725
|
+
if (!this._hit) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
this.setHighlighted(true);
|
|
729
|
+
/*
|
|
730
|
+
* Propagate touch events to its parents
|
|
731
|
+
*/
|
|
732
|
+
if (this._propagateTouchEvents) {
|
|
733
|
+
this.propagateTouchEvent(Widget.TOUCH_BEGAN, this, touch);
|
|
734
|
+
}
|
|
735
|
+
this._pushDownEvent();
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
propagateTouchEvent(event, sender, touch) {
|
|
739
|
+
const widgetParent = this.getWidgetParent();
|
|
740
|
+
if (widgetParent) {
|
|
741
|
+
widgetParent.interceptTouchEvent(event, sender, touch);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* <p>
|
|
746
|
+
* The callback of touch moved event. <br/>
|
|
747
|
+
* It sets the highlight state by touch, sends event to parent widget by interceptTouchEvent and calls the callback of touch moved event.
|
|
748
|
+
* </p>
|
|
749
|
+
* @param {Touch} touch
|
|
750
|
+
* @param {Event} event
|
|
751
|
+
*/
|
|
752
|
+
onTouchMoved(touch, event) {
|
|
753
|
+
const touchPoint = touch.getLocation();
|
|
754
|
+
this._touchMovePosition.x = touchPoint.x;
|
|
755
|
+
this._touchMovePosition.y = touchPoint.y;
|
|
756
|
+
this.setHighlighted(this.hitTest(touchPoint));
|
|
757
|
+
/*
|
|
758
|
+
* Propagate touch events to its parents
|
|
759
|
+
*/
|
|
760
|
+
if (this._propagateTouchEvents)
|
|
761
|
+
this.propagateTouchEvent(Widget.TOUCH_MOVED, this, touch);
|
|
762
|
+
this._moveEvent();
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* <p>
|
|
766
|
+
* The callback of touch end event
|
|
767
|
+
* It sends event to parent widget by interceptTouchEvent,
|
|
768
|
+
* calls the callback of touch end event (highlight= true) or touch canceled event (highlight= false).
|
|
769
|
+
* sets the highlight state to false ,
|
|
770
|
+
* </p>
|
|
771
|
+
* @param touch
|
|
772
|
+
* @param event
|
|
773
|
+
*/
|
|
774
|
+
onTouchEnded(touch, event) {
|
|
775
|
+
const touchPoint = touch.getLocation();
|
|
776
|
+
this._touchEndPosition.x = touchPoint.x;
|
|
777
|
+
this._touchEndPosition.y = touchPoint.y;
|
|
778
|
+
/*
|
|
779
|
+
* Propagate touch events to its parents
|
|
780
|
+
*/
|
|
781
|
+
if (this._propagateTouchEvents)
|
|
782
|
+
this.propagateTouchEvent(Widget.TOUCH_ENDED, this, touch);
|
|
783
|
+
const highlight = this._highlight;
|
|
784
|
+
this.setHighlighted(false);
|
|
785
|
+
if (highlight)
|
|
786
|
+
this._releaseUpEvent();
|
|
787
|
+
else
|
|
788
|
+
this._cancelUpEvent();
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* A call back function called when widget is selected, and on touch canceled.
|
|
792
|
+
* @param {Point} touchPoint
|
|
793
|
+
*/
|
|
794
|
+
onTouchCancelled(touchPoint, event) {
|
|
795
|
+
this.setHighlighted(false);
|
|
796
|
+
this._cancelUpEvent();
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* A call back function called when widget is selected, and on touch long clicked.
|
|
800
|
+
* @param {Point} touchPoint
|
|
801
|
+
*/
|
|
802
|
+
onTouchLongClicked(touchPoint) {
|
|
803
|
+
this.longClickEvent();
|
|
804
|
+
}
|
|
805
|
+
//call back function called widget's state changed to dark.
|
|
806
|
+
_pushDownEvent() {
|
|
807
|
+
if (this._touchEventCallback)
|
|
808
|
+
this._touchEventCallback(this, Widget.TOUCH_BEGAN);
|
|
809
|
+
if (this._touchEventListener && this._touchEventSelector)
|
|
810
|
+
this._touchEventSelector.call(this._touchEventListener, this, Widget.TOUCH_BEGAN);
|
|
811
|
+
}
|
|
812
|
+
_moveEvent() {
|
|
813
|
+
if (this._touchEventCallback)
|
|
814
|
+
this._touchEventCallback(this, Widget.TOUCH_MOVED);
|
|
815
|
+
if (this._touchEventListener && this._touchEventSelector)
|
|
816
|
+
this._touchEventSelector.call(this._touchEventListener, this, Widget.TOUCH_MOVED);
|
|
817
|
+
}
|
|
818
|
+
_releaseUpEvent() {
|
|
819
|
+
if (this._touchEventCallback)
|
|
820
|
+
this._touchEventCallback(this, Widget.TOUCH_ENDED);
|
|
821
|
+
if (this._touchEventListener && this._touchEventSelector)
|
|
822
|
+
this._touchEventSelector.call(this._touchEventListener, this, Widget.TOUCH_ENDED);
|
|
823
|
+
if (this._clickEventListener)
|
|
824
|
+
this._clickEventListener(this);
|
|
825
|
+
}
|
|
826
|
+
_cancelUpEvent() {
|
|
827
|
+
if (this._touchEventCallback)
|
|
828
|
+
this._touchEventCallback(this, Widget.TOUCH_CANCELED);
|
|
829
|
+
if (this._touchEventListener && this._touchEventSelector)
|
|
830
|
+
this._touchEventSelector.call(this._touchEventListener, this, Widget.TOUCH_CANCELED);
|
|
831
|
+
}
|
|
832
|
+
longClickEvent() {
|
|
833
|
+
//TODO it will implement in v3.1
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Sets the touch event target/selector of the Widget
|
|
837
|
+
* @param {Function} selector
|
|
838
|
+
* @param {Object} target
|
|
839
|
+
*/
|
|
840
|
+
addTouchEventListener(selector, target) {
|
|
841
|
+
if (target === undefined)
|
|
842
|
+
this._touchEventCallback = selector;
|
|
843
|
+
else {
|
|
844
|
+
this._touchEventSelector = selector;
|
|
845
|
+
this._touchEventListener = target;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
addClickEventListener(callback) {
|
|
849
|
+
this._clickEventListener = callback;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Checks a point if is in widget's space
|
|
853
|
+
* @param {Point} pt
|
|
854
|
+
* @returns {boolean} true if the point is in widget's space, false otherwise.
|
|
855
|
+
*/
|
|
856
|
+
hitTest(pt) {
|
|
857
|
+
const bb = Rect(0, 0, this._contentSize.width, this._contentSize.height);
|
|
858
|
+
return rectContainsPoint(bb, this.convertToNodeSpace(pt));
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* returns whether clipping parent widget contains point.
|
|
862
|
+
* @param {Point} pt location point
|
|
863
|
+
* @returns {Boolean}
|
|
864
|
+
*/
|
|
865
|
+
isClippingParentContainsPoint(pt) {
|
|
866
|
+
this._affectByClipping = false;
|
|
867
|
+
let parent = this.getParent();
|
|
868
|
+
let clippingParent = null;
|
|
869
|
+
while (parent) {
|
|
870
|
+
if (parent._layoutType) {
|
|
871
|
+
if (parent.isClippingEnabled()) {
|
|
872
|
+
this._affectByClipping = true;
|
|
873
|
+
clippingParent = parent;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
parent = parent.getParent();
|
|
878
|
+
}
|
|
879
|
+
if (!this._affectByClipping)
|
|
880
|
+
return true;
|
|
881
|
+
if (clippingParent) {
|
|
882
|
+
if (clippingParent.hitTest(pt))
|
|
883
|
+
return clippingParent.isClippingParentContainsPoint(pt);
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Calls the checkChildInfo of widget's parent, its subclass will override it.
|
|
890
|
+
* @param {number} handleState
|
|
891
|
+
* @param {Widget} sender
|
|
892
|
+
* @param {Point} touchPoint
|
|
893
|
+
*/
|
|
894
|
+
checkChildInfo(handleState, sender, touchPoint) {
|
|
895
|
+
const widgetParent = this.getWidgetParent();
|
|
896
|
+
if (widgetParent)
|
|
897
|
+
widgetParent.checkChildInfo(handleState, sender, touchPoint);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Changes the position (x,y) of the widget .
|
|
901
|
+
* The original point (0,0) is at the left-bottom corner of screen.
|
|
902
|
+
* @override
|
|
903
|
+
* @param {Point|Number} pos
|
|
904
|
+
* @param {Number} [posY]
|
|
905
|
+
*/
|
|
906
|
+
setPosition(pos, posY) {
|
|
907
|
+
if (this._running) {
|
|
908
|
+
const widgetParent = this.getWidgetParent();
|
|
909
|
+
if (widgetParent) {
|
|
910
|
+
const pSize = widgetParent.getContentSize();
|
|
911
|
+
if (pSize.width <= 0 || pSize.height <= 0) {
|
|
912
|
+
this._positionPercent.x = 0;
|
|
913
|
+
this._positionPercent.y = 0;
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
if (posY === undefined) {
|
|
917
|
+
this._positionPercent.x = pos.x / pSize.width;
|
|
918
|
+
this._positionPercent.y = pos.y / pSize.height;
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
this._positionPercent.x = pos / pSize.width;
|
|
922
|
+
this._positionPercent.y = posY / pSize.height;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
Node.prototype.setPosition.call(this, pos, posY);
|
|
928
|
+
//this._positionType = Widget.POSITION_ABSOLUTE;
|
|
929
|
+
}
|
|
930
|
+
setPositionX(x) {
|
|
931
|
+
if (this._running) {
|
|
932
|
+
const widgetParent = this.getWidgetParent();
|
|
933
|
+
if (widgetParent) {
|
|
934
|
+
const pw = widgetParent._getWidth();
|
|
935
|
+
if (pw <= 0)
|
|
936
|
+
this._positionPercent.x = 0;
|
|
937
|
+
else
|
|
938
|
+
this._positionPercent.x = x / pw;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
Node.prototype.setPositionX.call(this, x);
|
|
942
|
+
}
|
|
943
|
+
setPositionY(y) {
|
|
944
|
+
if (this._running) {
|
|
945
|
+
const widgetParent = this.getWidgetParent();
|
|
946
|
+
if (widgetParent) {
|
|
947
|
+
const ph = widgetParent._getHeight();
|
|
948
|
+
if (ph <= 0)
|
|
949
|
+
this._positionPercent.y = 0;
|
|
950
|
+
else
|
|
951
|
+
this._positionPercent.y = y / ph;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
Node.prototype.setPositionY.call(this, y);
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Changes the position (x,y) of the widget
|
|
958
|
+
* @param {Point} percent
|
|
959
|
+
*/
|
|
960
|
+
setPositionPercent(percent) {
|
|
961
|
+
this._setXPercent(percent.x);
|
|
962
|
+
this._setYPercent(percent.y);
|
|
963
|
+
this._renderCmd.setDirtyFlag(Node._dirtyFlags.transformDirty);
|
|
964
|
+
}
|
|
965
|
+
_setXPercent(percent) {
|
|
966
|
+
this._positionPercent.x = percent;
|
|
967
|
+
this._renderCmd.setDirtyFlag(Node._dirtyFlags.transformDirty);
|
|
968
|
+
}
|
|
969
|
+
_setYPercent(percent) {
|
|
970
|
+
this._positionPercent.y = percent;
|
|
971
|
+
this._renderCmd.setDirtyFlag(Node._dirtyFlags.transformDirty);
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Gets the percent (x,y) of the widget
|
|
975
|
+
* @returns {Point} The percent (x,y) of the widget in OpenGL coordinates
|
|
976
|
+
*/
|
|
977
|
+
getPositionPercent() {
|
|
978
|
+
return p(this._positionPercent);
|
|
979
|
+
}
|
|
980
|
+
_getXPercent() {
|
|
981
|
+
return this._positionPercent.x;
|
|
982
|
+
}
|
|
983
|
+
_getYPercent() {
|
|
984
|
+
return this._positionPercent.y;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Changes the position type of the widget
|
|
988
|
+
* @param {Number} type the position type of widget
|
|
989
|
+
*/
|
|
990
|
+
setPositionType(type) {
|
|
991
|
+
this._positionType = type;
|
|
992
|
+
this._renderCmd.setDirtyFlag(Node._dirtyFlags.transformDirty);
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Gets the position type of the widget
|
|
996
|
+
* @returns {Number} the position type of widget
|
|
997
|
+
*/
|
|
998
|
+
getPositionType() {
|
|
999
|
+
return this._positionType;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Sets whether the widget should be flipped horizontally or not.
|
|
1003
|
+
* @param {Boolean} flipX true if the widget should be flipped horizontally, false otherwise.
|
|
1004
|
+
*/
|
|
1005
|
+
setFlippedX(flipX) {
|
|
1006
|
+
const realScale = this.getScaleX();
|
|
1007
|
+
this._flippedX = flipX;
|
|
1008
|
+
this.setScaleX(realScale);
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* <p>
|
|
1012
|
+
* Returns the flag which indicates whether the widget is flipped horizontally or not. <br/>
|
|
1013
|
+
* It only flips the texture of the widget, and not the texture of the widget's children. <br/>
|
|
1014
|
+
* Also, flipping the texture doesn't alter the anchorPoint. <br/>
|
|
1015
|
+
* If you want to flip the anchorPoint too, and/or to flip the children too use: <br/>
|
|
1016
|
+
* widget.setScaleX(sprite.getScaleX() * -1);
|
|
1017
|
+
* </p>
|
|
1018
|
+
* @returns {Boolean} true if the widget is flipped horizontally, false otherwise.
|
|
1019
|
+
*/
|
|
1020
|
+
isFlippedX() {
|
|
1021
|
+
return this._flippedX;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Sets whether the widget should be flipped vertically or not.
|
|
1025
|
+
* @param {Boolean} flipY true if the widget should be flipped vertically, false otherwise.
|
|
1026
|
+
*/
|
|
1027
|
+
setFlippedY(flipY) {
|
|
1028
|
+
const realScale = this.getScaleY();
|
|
1029
|
+
this._flippedY = flipY;
|
|
1030
|
+
this.setScaleY(realScale);
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* <p>
|
|
1034
|
+
* Return the flag which indicates whether the widget is flipped vertically or not. <br/>
|
|
1035
|
+
* It only flips the texture of the widget, and not the texture of the widget's children. <br/>
|
|
1036
|
+
* Also, flipping the texture doesn't alter the anchorPoint. <br/>
|
|
1037
|
+
* If you want to flip the anchorPoint too, and/or to flip the children too use: <br/>
|
|
1038
|
+
* widget.setScaleY(widget.getScaleY() * -1);
|
|
1039
|
+
* </p>
|
|
1040
|
+
* @returns {Boolean} true if the widget is flipped vertically, false otherwise.
|
|
1041
|
+
*/
|
|
1042
|
+
isFlippedY() {
|
|
1043
|
+
return this._flippedY;
|
|
1044
|
+
}
|
|
1045
|
+
_adaptRenderers() { }
|
|
1046
|
+
/**
|
|
1047
|
+
* Determines if the widget is bright
|
|
1048
|
+
* @returns {boolean} true if the widget is bright, false if the widget is dark.
|
|
1049
|
+
*/
|
|
1050
|
+
isBright() {
|
|
1051
|
+
return this._bright;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Determines if the widget is enabled
|
|
1055
|
+
* @returns {boolean}
|
|
1056
|
+
*/
|
|
1057
|
+
isEnabled() {
|
|
1058
|
+
return this._enabled;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Gets the left boundary position of this widget.
|
|
1062
|
+
* @returns {number}
|
|
1063
|
+
*/
|
|
1064
|
+
getLeftBoundary() {
|
|
1065
|
+
return this.getPositionX() - this._getAnchorX() * this._contentSize.width;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Gets the bottom boundary position of this widget.
|
|
1069
|
+
* @returns {number}
|
|
1070
|
+
*/
|
|
1071
|
+
getBottomBoundary() {
|
|
1072
|
+
return this.getPositionY() - this._getAnchorY() * this._contentSize.height;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Gets the right boundary position of this widget.
|
|
1076
|
+
* @returns {number}
|
|
1077
|
+
*/
|
|
1078
|
+
getRightBoundary() {
|
|
1079
|
+
return this.getLeftBoundary() + this._contentSize.width;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Gets the top boundary position of this widget.
|
|
1083
|
+
* @returns {number}
|
|
1084
|
+
*/
|
|
1085
|
+
getTopBoundary() {
|
|
1086
|
+
return this.getBottomBoundary() + this._contentSize.height;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Gets the position of touch began event.
|
|
1090
|
+
* @returns {Point}
|
|
1091
|
+
*/
|
|
1092
|
+
getTouchBeganPosition() {
|
|
1093
|
+
return p(this._touchBeganPosition);
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Gets the position of touch moved event
|
|
1097
|
+
* @returns {Point}
|
|
1098
|
+
*/
|
|
1099
|
+
getTouchMovePosition() {
|
|
1100
|
+
return p(this._touchMovePosition);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Gets the position of touch end event
|
|
1104
|
+
* @returns {Point}
|
|
1105
|
+
*/
|
|
1106
|
+
getTouchEndPosition() {
|
|
1107
|
+
return p(this._touchEndPosition);
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* get widget type
|
|
1111
|
+
* @returns {Widget.TYPE_WIDGET|Widget.TYPE_CONTAINER}
|
|
1112
|
+
*/
|
|
1113
|
+
getWidgetType() {
|
|
1114
|
+
return this._widgetType;
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Gets LayoutParameter of widget.
|
|
1118
|
+
* @param {LayoutParameter} parameter
|
|
1119
|
+
*/
|
|
1120
|
+
setLayoutParameter(parameter) {
|
|
1121
|
+
if (!parameter)
|
|
1122
|
+
return;
|
|
1123
|
+
this._layoutParameterDictionary[parameter.getLayoutType()] = parameter;
|
|
1124
|
+
this._layoutParameterType = parameter.getLayoutType();
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Gets layout parameter
|
|
1128
|
+
* @param {LayoutParameter.NONE|LayoutParameter.LINEAR|LayoutParameter.RELATIVE} type
|
|
1129
|
+
* @returns {LayoutParameter}
|
|
1130
|
+
*/
|
|
1131
|
+
getLayoutParameter(type) {
|
|
1132
|
+
const t = type || this._layoutParameterType;
|
|
1133
|
+
return this._layoutParameterDictionary[t];
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Returns the "class name" of widget.
|
|
1137
|
+
* @returns {string}
|
|
1138
|
+
*/
|
|
1139
|
+
getDescription() {
|
|
1140
|
+
return 'Widget';
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Clones a new widget.
|
|
1144
|
+
* @returns {Widget}
|
|
1145
|
+
*/
|
|
1146
|
+
clone() {
|
|
1147
|
+
const clonedWidget = this._createCloneInstance();
|
|
1148
|
+
clonedWidget._copyProperties(this);
|
|
1149
|
+
clonedWidget._copyClonedWidgetChildren(this);
|
|
1150
|
+
return clonedWidget;
|
|
1151
|
+
}
|
|
1152
|
+
_createCloneInstance() {
|
|
1153
|
+
return new Widget();
|
|
1154
|
+
}
|
|
1155
|
+
_copyClonedWidgetChildren(model) {
|
|
1156
|
+
const widgetChildren = model.getChildren();
|
|
1157
|
+
for (let i = 0; i < widgetChildren.length; i++) {
|
|
1158
|
+
const locChild = widgetChildren[i];
|
|
1159
|
+
if (locChild instanceof Widget)
|
|
1160
|
+
this.addChild(locChild.clone());
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
_copySpecialProperties(model) { }
|
|
1164
|
+
_copyProperties(widget) {
|
|
1165
|
+
this.setEnabled(widget.isEnabled());
|
|
1166
|
+
this.setVisible(widget.isVisible());
|
|
1167
|
+
this.setBright(widget.isBright());
|
|
1168
|
+
this.setTouchEnabled(widget.isTouchEnabled());
|
|
1169
|
+
this.setLocalZOrder(widget.getLocalZOrder());
|
|
1170
|
+
this.setTag(widget.getTag());
|
|
1171
|
+
this.setName(widget.getName());
|
|
1172
|
+
this.setActionTag(widget.getActionTag());
|
|
1173
|
+
this._ignoreSize = widget._ignoreSize;
|
|
1174
|
+
this.setContentSize(widget._contentSize);
|
|
1175
|
+
this._customSize.width = widget._customSize.width;
|
|
1176
|
+
this._customSize.height = widget._customSize.height;
|
|
1177
|
+
this._copySpecialProperties(widget);
|
|
1178
|
+
this._sizeType = widget.getSizeType();
|
|
1179
|
+
this._sizePercent.x = widget._sizePercent.x;
|
|
1180
|
+
this._sizePercent.y = widget._sizePercent.y;
|
|
1181
|
+
this._positionType = widget._positionType;
|
|
1182
|
+
this._positionPercent.x = widget._positionPercent.x;
|
|
1183
|
+
this._positionPercent.y = widget._positionPercent.y;
|
|
1184
|
+
this.setPosition(widget.getPosition());
|
|
1185
|
+
this.setAnchorPoint(widget.getAnchorPoint());
|
|
1186
|
+
this.setScaleX(widget.getScaleX());
|
|
1187
|
+
this.setScaleY(widget.getScaleY());
|
|
1188
|
+
this.setRotation(widget.getRotation());
|
|
1189
|
+
this.setRotationX(widget.getRotationX());
|
|
1190
|
+
this.setRotationY(widget.getRotationY());
|
|
1191
|
+
this.setFlippedX(widget.isFlippedX());
|
|
1192
|
+
this.setFlippedY(widget.isFlippedY());
|
|
1193
|
+
this.setColor(widget.getColor());
|
|
1194
|
+
this.setOpacity(widget.getOpacity());
|
|
1195
|
+
this._touchEventCallback = widget._touchEventCallback;
|
|
1196
|
+
this._touchEventListener = widget._touchEventListener;
|
|
1197
|
+
this._touchEventSelector = widget._touchEventSelector;
|
|
1198
|
+
this._clickEventListener = widget._clickEventListener;
|
|
1199
|
+
this._focused = widget._focused;
|
|
1200
|
+
this._focusEnabled = widget._focusEnabled;
|
|
1201
|
+
this._propagateTouchEvents = widget._propagateTouchEvents;
|
|
1202
|
+
for (const key in widget._layoutParameterDictionary) {
|
|
1203
|
+
const parameter = widget._layoutParameterDictionary[key];
|
|
1204
|
+
if (parameter)
|
|
1205
|
+
this.setLayoutParameter(parameter.clone());
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
/*temp action*/
|
|
1209
|
+
setActionTag(tag) {
|
|
1210
|
+
this._actionTag = tag;
|
|
1211
|
+
}
|
|
1212
|
+
getActionTag() {
|
|
1213
|
+
return this._actionTag;
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Gets the left boundary position of this widget.
|
|
1217
|
+
* @deprecated since v3.0, please use getLeftBoundary instead.
|
|
1218
|
+
* @returns {number}
|
|
1219
|
+
*/
|
|
1220
|
+
getLeftInParent() {
|
|
1221
|
+
log('getLeftInParent is deprecated. Please use getLeftBoundary instead.');
|
|
1222
|
+
return this.getLeftBoundary();
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Gets the bottom boundary position of this widget.
|
|
1226
|
+
* @deprecated since v3.0, please use getBottomBoundary instead.
|
|
1227
|
+
* @returns {number}
|
|
1228
|
+
*/
|
|
1229
|
+
getBottomInParent() {
|
|
1230
|
+
log('getBottomInParent is deprecated. Please use getBottomBoundary instead.');
|
|
1231
|
+
return this.getBottomBoundary();
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Gets the right boundary position of this widget.
|
|
1235
|
+
* @deprecated since v3.0, please use getRightBoundary instead.
|
|
1236
|
+
* @returns {number}
|
|
1237
|
+
*/
|
|
1238
|
+
getRightInParent() {
|
|
1239
|
+
log('getRightInParent is deprecated. Please use getRightBoundary instead.');
|
|
1240
|
+
return this.getRightBoundary();
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Gets the top boundary position of this widget.
|
|
1244
|
+
* @deprecated since v3.0, please use getTopBoundary instead.
|
|
1245
|
+
* @returns {number}
|
|
1246
|
+
*/
|
|
1247
|
+
getTopInParent() {
|
|
1248
|
+
log('getTopInParent is deprecated. Please use getTopBoundary instead.');
|
|
1249
|
+
return this.getTopBoundary();
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Gets the touch end point of widget when widget is selected.
|
|
1253
|
+
* @deprecated since v3.0, please use getTouchEndPosition instead.
|
|
1254
|
+
* @returns {Point} the touch end point.
|
|
1255
|
+
*/
|
|
1256
|
+
getTouchEndPos() {
|
|
1257
|
+
log('getTouchEndPos is deprecated. Please use getTouchEndPosition instead.');
|
|
1258
|
+
return this.getTouchEndPosition();
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
*Gets the touch move point of widget when widget is selected.
|
|
1262
|
+
* @deprecated since v3.0, please use getTouchMovePosition instead.
|
|
1263
|
+
* @returns {Point} the touch move point.
|
|
1264
|
+
*/
|
|
1265
|
+
getTouchMovePos() {
|
|
1266
|
+
log('getTouchMovePos is deprecated. Please use getTouchMovePosition instead.');
|
|
1267
|
+
return this.getTouchMovePosition();
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Checks a point if in parent's area.
|
|
1271
|
+
* @deprecated since v3.0, please use isClippingParentContainsPoint instead.
|
|
1272
|
+
* @param {Point} pt
|
|
1273
|
+
* @returns {Boolean}
|
|
1274
|
+
*/
|
|
1275
|
+
clippingParentAreaContainPoint(pt) {
|
|
1276
|
+
log('clippingParentAreaContainPoint is deprecated. Please use isClippingParentContainsPoint instead.');
|
|
1277
|
+
this.isClippingParentContainsPoint(pt);
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Gets the touch began point of widget when widget is selected.
|
|
1281
|
+
* @deprecated since v3.0, please use getTouchBeganPosition instead.
|
|
1282
|
+
* @returns {Point} the touch began point.
|
|
1283
|
+
*/
|
|
1284
|
+
getTouchStartPos() {
|
|
1285
|
+
log('getTouchStartPos is deprecated. Please use getTouchBeganPosition instead.');
|
|
1286
|
+
return this.getTouchBeganPosition();
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Changes the size that is widget's size
|
|
1290
|
+
* @deprecated since v3.0, please use setContentSize instead.
|
|
1291
|
+
* @param {Size} size that is widget's size
|
|
1292
|
+
*/
|
|
1293
|
+
setSize(size) {
|
|
1294
|
+
this.setContentSize(size);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns size of widget
|
|
1298
|
+
* @deprecated since v3.0, please use getContentSize instead.
|
|
1299
|
+
* @returns {Size}
|
|
1300
|
+
*/
|
|
1301
|
+
getSize() {
|
|
1302
|
+
return this.getContentSize();
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Adds a node for widget (this function is deleted in -x)
|
|
1306
|
+
* @param {Node} node
|
|
1307
|
+
* @param {Number} zOrder
|
|
1308
|
+
* @param {Number} tag
|
|
1309
|
+
* @deprecated since v3.0, please use addChild instead.
|
|
1310
|
+
*/
|
|
1311
|
+
addNode(node, zOrder, tag) {
|
|
1312
|
+
if (node instanceof Widget) {
|
|
1313
|
+
log('Please use addChild to add a Widget.');
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
Node.prototype.addChild.call(this, node, zOrder, tag);
|
|
1317
|
+
this._nodes.push(node);
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Gets node by tag
|
|
1321
|
+
* @deprecated since v3.0, please use getChildByTag instead.
|
|
1322
|
+
* @param {Number} tag
|
|
1323
|
+
* @returns {Node}
|
|
1324
|
+
*/
|
|
1325
|
+
getNodeByTag(tag) {
|
|
1326
|
+
const _nodes = this._nodes;
|
|
1327
|
+
for (let i = 0; i < _nodes.length; i++) {
|
|
1328
|
+
const node = _nodes[i];
|
|
1329
|
+
if (node && node.getTag() === tag) {
|
|
1330
|
+
return node;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Returns all children.
|
|
1337
|
+
* @deprecated since v3.0, please use getChildren instead.
|
|
1338
|
+
* @returns {Array}
|
|
1339
|
+
*/
|
|
1340
|
+
getNodes() {
|
|
1341
|
+
return this._nodes;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Removes a node from Widget
|
|
1345
|
+
* @deprecated since v3.0, please use removeChild instead.
|
|
1346
|
+
* @param {Node} node
|
|
1347
|
+
* @param {Boolean} cleanup
|
|
1348
|
+
*/
|
|
1349
|
+
removeNode(node, cleanup) {
|
|
1350
|
+
Node.prototype.removeChild.call(this, node, cleanup);
|
|
1351
|
+
arrayRemoveObject(this._nodes, node);
|
|
1352
|
+
}
|
|
1353
|
+
_getNormalGLProgram() {
|
|
1354
|
+
return shaderCache.programForKey(SHADER_SPRITE_POSITION_TEXTURECOLOR);
|
|
1355
|
+
}
|
|
1356
|
+
_getGrayGLProgram() {
|
|
1357
|
+
return shaderCache.programForKey(SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY);
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Removes node by tag
|
|
1361
|
+
* @deprecated since v3.0, please use removeChildByTag instead.
|
|
1362
|
+
* @param {Number} tag
|
|
1363
|
+
* @param {Boolean} [cleanup]
|
|
1364
|
+
*/
|
|
1365
|
+
removeNodeByTag(tag, cleanup) {
|
|
1366
|
+
const node = this.getChildByTag(tag);
|
|
1367
|
+
if (!node)
|
|
1368
|
+
log('cocos2d: removeNodeByTag(tag = %d): child not found!', tag);
|
|
1369
|
+
else
|
|
1370
|
+
this.removeChild(node, cleanup);
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Removes all node
|
|
1374
|
+
* @deprecated since v3.0, please use removeAllChildren instead.
|
|
1375
|
+
*/
|
|
1376
|
+
removeAllNodes() {
|
|
1377
|
+
for (let i = 0; i < this._nodes.length; i++) {
|
|
1378
|
+
const node = this._nodes[i];
|
|
1379
|
+
Node.prototype.removeChild.call(this, node);
|
|
1380
|
+
}
|
|
1381
|
+
this._nodes.length = 0;
|
|
1382
|
+
}
|
|
1383
|
+
_findLayout() {
|
|
1384
|
+
renderer.childrenOrderDirty = true;
|
|
1385
|
+
let layout = this._parent;
|
|
1386
|
+
while (layout) {
|
|
1387
|
+
if (layout._doLayout) {
|
|
1388
|
+
layout._doLayoutDirty = true;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
else
|
|
1392
|
+
layout = layout._parent;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* @since v3.2
|
|
1397
|
+
* @returns {boolean} true represent the widget use Unify Size, false represent the widget couldn't use Unify Size
|
|
1398
|
+
*/
|
|
1399
|
+
isUnifySizeEnabled() {
|
|
1400
|
+
return this._unifySize;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* @since v3.2
|
|
1404
|
+
* @param {Boolean} enable enable Unify Size of a widget
|
|
1405
|
+
*/
|
|
1406
|
+
setUnifySizeEnabled(enable) {
|
|
1407
|
+
this._unifySize = enable;
|
|
1408
|
+
}
|
|
1409
|
+
//override the scale functions.
|
|
1410
|
+
setScaleX(scaleX) {
|
|
1411
|
+
if (this._flippedX)
|
|
1412
|
+
scaleX = scaleX * -1;
|
|
1413
|
+
Node.prototype.setScaleX.call(this, scaleX);
|
|
1414
|
+
}
|
|
1415
|
+
setScaleY(scaleY) {
|
|
1416
|
+
if (this._flippedY)
|
|
1417
|
+
scaleY = scaleY * -1;
|
|
1418
|
+
Node.prototype.setScaleY.call(this, scaleY);
|
|
1419
|
+
}
|
|
1420
|
+
setScale(scaleX, scaleY) {
|
|
1421
|
+
if (scaleY === undefined)
|
|
1422
|
+
scaleY = scaleX;
|
|
1423
|
+
this.setScaleX(scaleX);
|
|
1424
|
+
this.setScaleY(scaleY);
|
|
1425
|
+
}
|
|
1426
|
+
getScaleX() {
|
|
1427
|
+
let originalScale = Node.prototype.getScaleX.call(this);
|
|
1428
|
+
if (this._flippedX)
|
|
1429
|
+
originalScale = originalScale * -1.0;
|
|
1430
|
+
return originalScale;
|
|
1431
|
+
}
|
|
1432
|
+
getScaleY() {
|
|
1433
|
+
let originalScale = Node.prototype.getScaleY.call(this);
|
|
1434
|
+
if (this._flippedY)
|
|
1435
|
+
originalScale = originalScale * -1.0;
|
|
1436
|
+
return originalScale;
|
|
1437
|
+
}
|
|
1438
|
+
getScale() {
|
|
1439
|
+
if (this.getScaleX() !== this.getScaleY())
|
|
1440
|
+
log('Widget#scale. ScaleX != ScaleY. Dont know which one to return');
|
|
1441
|
+
return this.getScaleX();
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Sets callback name to widget.
|
|
1445
|
+
* @since v3.3
|
|
1446
|
+
* @param {String} callbackName
|
|
1447
|
+
*/
|
|
1448
|
+
setCallbackName(callbackName) {
|
|
1449
|
+
this._callbackName = callbackName;
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Gets callback name of widget
|
|
1453
|
+
* @since v3.3
|
|
1454
|
+
* @returns {String|Null}
|
|
1455
|
+
*/
|
|
1456
|
+
getCallbackName() {
|
|
1457
|
+
return this._callbackName;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Sets callback type to widget
|
|
1461
|
+
* @since v3.3
|
|
1462
|
+
* @param {String} callbackType
|
|
1463
|
+
*/
|
|
1464
|
+
setCallbackType(callbackType) {
|
|
1465
|
+
this._callbackType = callbackType;
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Gets callback type of widget
|
|
1469
|
+
* @since v3.3
|
|
1470
|
+
* @returns {String|null}
|
|
1471
|
+
*/
|
|
1472
|
+
getCallbackType() {
|
|
1473
|
+
return this._callbackType;
|
|
1474
|
+
}
|
|
1475
|
+
_createRenderCmd() {
|
|
1476
|
+
return new WidgetWebGLRenderCmd(this);
|
|
1477
|
+
}
|
|
1478
|
+
// Static properties
|
|
1479
|
+
static _focusedWidget = null; //both layout & widget will be stored in this variable
|
|
1480
|
+
static _focusNavigationController = null;
|
|
1481
|
+
/**
|
|
1482
|
+
* call this method with parameter true to enable the Android Dpad focus navigation feature
|
|
1483
|
+
* @note it doesn't implemented on Web
|
|
1484
|
+
* @param {Boolean} enable set true to enable dpad focus navigation, otherwise disable dpad focus navigation
|
|
1485
|
+
*/
|
|
1486
|
+
static enableDpadNavigation(enable) {
|
|
1487
|
+
if (enable) {
|
|
1488
|
+
if (null == Widget._focusNavigationController) {
|
|
1489
|
+
Widget._focusNavigationController = new FocusNavigationController();
|
|
1490
|
+
if (Widget._focusedWidget) {
|
|
1491
|
+
Widget._focusNavigationController._setFirstFocsuedWidget(Widget._focusedWidget);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
Widget._focusNavigationController.enableFocusNavigation(true);
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
if (Widget._focusNavigationController) {
|
|
1498
|
+
Widget._focusNavigationController.enableFocusNavigation(false);
|
|
1499
|
+
Widget._focusNavigationController = null;
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Gets the focused widget of current stage.
|
|
1505
|
+
* @function
|
|
1506
|
+
* @returns {null|Widget}
|
|
1507
|
+
*/
|
|
1508
|
+
static getCurrentFocusedWidget() {
|
|
1509
|
+
return Widget._focusedWidget;
|
|
1510
|
+
}
|
|
1511
|
+
// Constants
|
|
1512
|
+
//bright style
|
|
1513
|
+
/**
|
|
1514
|
+
* None bright style of Widget.
|
|
1515
|
+
* @constant
|
|
1516
|
+
* @type {number}
|
|
1517
|
+
*/
|
|
1518
|
+
static BRIGHT_STYLE_NONE = -1;
|
|
1519
|
+
/**
|
|
1520
|
+
* Normal bright style of Widget.
|
|
1521
|
+
* @constant
|
|
1522
|
+
* @type {number}
|
|
1523
|
+
*/
|
|
1524
|
+
static BRIGHT_STYLE_NORMAL = 0;
|
|
1525
|
+
/**
|
|
1526
|
+
* Light bright style of Widget.
|
|
1527
|
+
* @constant
|
|
1528
|
+
* @type {number}
|
|
1529
|
+
*/
|
|
1530
|
+
static BRIGHT_STYLE_HIGH_LIGHT = 1;
|
|
1531
|
+
//widget type
|
|
1532
|
+
/**
|
|
1533
|
+
* The type code of Widget for ccui controls.
|
|
1534
|
+
* @constant
|
|
1535
|
+
* @type {number}
|
|
1536
|
+
*/
|
|
1537
|
+
static TYPE_WIDGET = 0;
|
|
1538
|
+
/**
|
|
1539
|
+
* The type code of Container for ccui controls.
|
|
1540
|
+
* @constant
|
|
1541
|
+
* @type {number}
|
|
1542
|
+
*/
|
|
1543
|
+
static TYPE_CONTAINER = 1;
|
|
1544
|
+
//Focus Direction
|
|
1545
|
+
/**
|
|
1546
|
+
* The left of Focus direction for Widget
|
|
1547
|
+
* @constant
|
|
1548
|
+
* @type {number}
|
|
1549
|
+
*/
|
|
1550
|
+
static LEFT = 0;
|
|
1551
|
+
/**
|
|
1552
|
+
* The right of Focus direction for Widget
|
|
1553
|
+
* @constant
|
|
1554
|
+
* @type {number}
|
|
1555
|
+
*/
|
|
1556
|
+
static RIGHT = 1;
|
|
1557
|
+
/**
|
|
1558
|
+
* The up of Focus direction for Widget
|
|
1559
|
+
* @constant
|
|
1560
|
+
* @type {number}
|
|
1561
|
+
*/
|
|
1562
|
+
static UP = 2;
|
|
1563
|
+
/**
|
|
1564
|
+
* The down of Focus direction for Widget
|
|
1565
|
+
* @constant
|
|
1566
|
+
* @type {number}
|
|
1567
|
+
*/
|
|
1568
|
+
static DOWN = 3;
|
|
1569
|
+
//texture resource type
|
|
1570
|
+
/**
|
|
1571
|
+
* The image file texture type of Widget loads.
|
|
1572
|
+
* @constant
|
|
1573
|
+
* @type {number}
|
|
1574
|
+
*/
|
|
1575
|
+
static LOCAL_TEXTURE = 0;
|
|
1576
|
+
/**
|
|
1577
|
+
* The sprite frame texture type of Widget loads.
|
|
1578
|
+
* @constant
|
|
1579
|
+
* @type {number}
|
|
1580
|
+
*/
|
|
1581
|
+
static PLIST_TEXTURE = 1;
|
|
1582
|
+
//touch event type
|
|
1583
|
+
/**
|
|
1584
|
+
* The touch began type of Widget's touch event
|
|
1585
|
+
* @constant
|
|
1586
|
+
* @type {number}
|
|
1587
|
+
*/
|
|
1588
|
+
static TOUCH_BEGAN = 0;
|
|
1589
|
+
/**
|
|
1590
|
+
* The touch moved type of Widget's touch event
|
|
1591
|
+
* @constant
|
|
1592
|
+
* @type {number}
|
|
1593
|
+
*/
|
|
1594
|
+
static TOUCH_MOVED = 1;
|
|
1595
|
+
/**
|
|
1596
|
+
* The touch end type of Widget's touch event
|
|
1597
|
+
* @constant
|
|
1598
|
+
* @type {number}
|
|
1599
|
+
*/
|
|
1600
|
+
static TOUCH_ENDED = 2;
|
|
1601
|
+
/**
|
|
1602
|
+
* The touch canceled type of Widget's touch event
|
|
1603
|
+
* @constant
|
|
1604
|
+
* @type {number}
|
|
1605
|
+
*/
|
|
1606
|
+
static TOUCH_CANCELED = 3;
|
|
1607
|
+
//size type
|
|
1608
|
+
/**
|
|
1609
|
+
* The absolute of Widget's size type.
|
|
1610
|
+
* @constant
|
|
1611
|
+
* @type {number}
|
|
1612
|
+
*/
|
|
1613
|
+
static SIZE_ABSOLUTE = 0;
|
|
1614
|
+
/**
|
|
1615
|
+
* The percent of Widget's size type.
|
|
1616
|
+
* @constant
|
|
1617
|
+
* @type {number}
|
|
1618
|
+
*/
|
|
1619
|
+
static SIZE_PERCENT = 1;
|
|
1620
|
+
//position type
|
|
1621
|
+
/**
|
|
1622
|
+
* The absolute of Widget's position type.
|
|
1623
|
+
* @constant
|
|
1624
|
+
* @type {number}
|
|
1625
|
+
*/
|
|
1626
|
+
static POSITION_ABSOLUTE = 0;
|
|
1627
|
+
/**
|
|
1628
|
+
* The percent of Widget's position type.
|
|
1629
|
+
* @constant
|
|
1630
|
+
* @type {number}
|
|
1631
|
+
*/
|
|
1632
|
+
static POSITION_PERCENT = 1;
|
|
1633
|
+
}
|
|
1634
|
+
//# sourceMappingURL=UIWidget.js.map
|