@codexo/exojs 0.6.12 → 0.7.12
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/CHANGELOG.md +1424 -0
- package/dist/esm/animation/Tween.d.ts +60 -1
- package/dist/esm/animation/Tween.js +60 -1
- package/dist/esm/animation/Tween.js.map +1 -1
- package/dist/esm/animation/TweenManager.d.ts +10 -0
- package/dist/esm/animation/TweenManager.js +10 -0
- package/dist/esm/animation/TweenManager.js.map +1 -1
- package/dist/esm/animation/types.d.ts +15 -0
- package/dist/esm/animation/types.js +6 -0
- package/dist/esm/animation/types.js.map +1 -1
- package/dist/esm/audio/AbstractMedia.d.ts +29 -0
- package/dist/esm/audio/AbstractMedia.js +76 -0
- package/dist/esm/audio/AbstractMedia.js.map +1 -1
- package/dist/esm/audio/AudioAnalyser.d.ts +83 -23
- package/dist/esm/audio/AudioAnalyser.js +277 -57
- package/dist/esm/audio/AudioAnalyser.js.map +1 -1
- package/dist/esm/audio/AudioBus.d.ts +82 -0
- package/dist/esm/audio/AudioBus.js +255 -0
- package/dist/esm/audio/AudioBus.js.map +1 -0
- package/dist/esm/audio/AudioFilter.d.ts +16 -0
- package/dist/esm/audio/AudioFilter.js +13 -0
- package/dist/esm/audio/AudioFilter.js.map +1 -0
- package/dist/esm/audio/AudioListener.d.ts +39 -0
- package/dist/esm/audio/AudioListener.js +97 -0
- package/dist/esm/audio/AudioListener.js.map +1 -0
- package/dist/esm/audio/AudioManager.d.ts +68 -0
- package/dist/esm/audio/AudioManager.js +139 -0
- package/dist/esm/audio/AudioManager.js.map +1 -0
- package/dist/esm/audio/BeatDetector.d.ts +142 -0
- package/dist/esm/audio/BeatDetector.js +957 -0
- package/dist/esm/audio/BeatDetector.js.map +1 -0
- package/dist/esm/audio/Envelope.d.ts +44 -0
- package/dist/esm/audio/Envelope.js +60 -0
- package/dist/esm/audio/Envelope.js.map +1 -0
- package/dist/esm/audio/Media.d.ts +11 -0
- package/dist/esm/audio/Music.d.ts +20 -0
- package/dist/esm/audio/Music.js +45 -4
- package/dist/esm/audio/Music.js.map +1 -1
- package/dist/esm/audio/OscillatorSound.d.ts +98 -0
- package/dist/esm/audio/OscillatorSound.js +342 -0
- package/dist/esm/audio/OscillatorSound.js.map +1 -0
- package/dist/esm/audio/Sound.d.ts +119 -9
- package/dist/esm/audio/Sound.js +301 -117
- package/dist/esm/audio/Sound.js.map +1 -1
- package/dist/esm/audio/audio-context.d.ts +48 -0
- package/dist/esm/audio/audio-context.js +48 -5
- package/dist/esm/audio/audio-context.js.map +1 -1
- package/dist/esm/audio/crossFade.d.ts +19 -0
- package/dist/esm/audio/crossFade.js +26 -0
- package/dist/esm/audio/crossFade.js.map +1 -0
- package/dist/esm/audio/dsp/fft.d.ts +22 -0
- package/dist/esm/audio/dsp/mel.d.ts +43 -0
- package/dist/esm/audio/dsp/tempogram.d.ts +51 -0
- package/dist/esm/audio/filters/ChorusFilter.d.ts +52 -0
- package/dist/esm/audio/filters/ChorusFilter.js +143 -0
- package/dist/esm/audio/filters/ChorusFilter.js.map +1 -0
- package/dist/esm/audio/filters/CompressorFilter.d.ts +43 -0
- package/dist/esm/audio/filters/CompressorFilter.js +108 -0
- package/dist/esm/audio/filters/CompressorFilter.js.map +1 -0
- package/dist/esm/audio/filters/DelayFilter.d.ts +34 -0
- package/dist/esm/audio/filters/DelayFilter.js +110 -0
- package/dist/esm/audio/filters/DelayFilter.js.map +1 -0
- package/dist/esm/audio/filters/DuckingFilter.d.ts +44 -0
- package/dist/esm/audio/filters/DuckingFilter.js +164 -0
- package/dist/esm/audio/filters/DuckingFilter.js.map +1 -0
- package/dist/esm/audio/filters/EqualizerFilter.d.ts +49 -0
- package/dist/esm/audio/filters/EqualizerFilter.js +134 -0
- package/dist/esm/audio/filters/EqualizerFilter.js.map +1 -0
- package/dist/esm/audio/filters/GranularFilter.d.ts +62 -0
- package/dist/esm/audio/filters/GranularFilter.js +176 -0
- package/dist/esm/audio/filters/GranularFilter.js.map +1 -0
- package/dist/esm/audio/filters/HighpassFilter.d.ts +29 -0
- package/dist/esm/audio/filters/HighpassFilter.js +71 -0
- package/dist/esm/audio/filters/HighpassFilter.js.map +1 -0
- package/dist/esm/audio/filters/LowpassFilter.d.ts +29 -0
- package/dist/esm/audio/filters/LowpassFilter.js +71 -0
- package/dist/esm/audio/filters/LowpassFilter.js.map +1 -0
- package/dist/esm/audio/filters/PitchShiftFilter.d.ts +44 -0
- package/dist/esm/audio/filters/PitchShiftFilter.js +132 -0
- package/dist/esm/audio/filters/PitchShiftFilter.js.map +1 -0
- package/dist/esm/audio/filters/ReverbFilter.d.ts +36 -0
- package/dist/esm/audio/filters/ReverbFilter.js +118 -0
- package/dist/esm/audio/filters/ReverbFilter.js.map +1 -0
- package/dist/esm/audio/filters/VocoderFilter.d.ts +49 -0
- package/dist/esm/audio/filters/VocoderFilter.js +174 -0
- package/dist/esm/audio/filters/VocoderFilter.js.map +1 -0
- package/dist/esm/audio/filters/WorkletFilter.d.ts +51 -0
- package/dist/esm/audio/filters/WorkletFilter.js +106 -0
- package/dist/esm/audio/filters/WorkletFilter.js.map +1 -0
- package/dist/esm/audio/filters/index.d.ts +12 -0
- package/dist/esm/audio/index.d.ts +15 -1
- package/dist/esm/audio/worklet/registerWorklet.d.ts +10 -0
- package/dist/esm/audio/worklet/registerWorklet.js +44 -0
- package/dist/esm/audio/worklet/registerWorklet.js.map +1 -0
- package/dist/esm/core/Application.d.ts +82 -0
- package/dist/esm/core/Application.js +137 -2
- package/dist/esm/core/Application.js.map +1 -1
- package/dist/esm/core/Bounds.d.ts +23 -0
- package/dist/esm/core/Bounds.js +23 -0
- package/dist/esm/core/Bounds.js.map +1 -1
- package/dist/esm/core/Clock.d.ts +21 -0
- package/dist/esm/core/Clock.js +21 -0
- package/dist/esm/core/Clock.js.map +1 -1
- package/dist/esm/core/Color.d.ts +35 -0
- package/dist/esm/core/Color.js +35 -0
- package/dist/esm/core/Color.js.map +1 -1
- package/dist/esm/core/Scene.d.ts +46 -0
- package/dist/esm/core/Scene.js +27 -0
- package/dist/esm/core/Scene.js.map +1 -1
- package/dist/esm/core/SceneManager.d.ts +62 -0
- package/dist/esm/core/SceneManager.js +49 -0
- package/dist/esm/core/SceneManager.js.map +1 -1
- package/dist/esm/core/SceneNode.d.ts +40 -1
- package/dist/esm/core/SceneNode.js +75 -6
- package/dist/esm/core/SceneNode.js.map +1 -1
- package/dist/esm/core/Signal.d.ts +44 -0
- package/dist/esm/core/Signal.js +39 -0
- package/dist/esm/core/Signal.js.map +1 -1
- package/dist/esm/core/Time.d.ts +21 -0
- package/dist/esm/core/Time.js +22 -1
- package/dist/esm/core/Time.js.map +1 -1
- package/dist/esm/core/Timer.d.ts +7 -0
- package/dist/esm/core/Timer.js +7 -0
- package/dist/esm/core/Timer.js.map +1 -1
- package/dist/esm/core/capabilities.d.ts +12 -0
- package/dist/esm/core/capabilities.js +12 -0
- package/dist/esm/core/capabilities.js.map +1 -1
- package/dist/esm/core/index.d.ts +0 -1
- package/dist/esm/core/types.d.ts +37 -0
- package/dist/esm/core/utils.d.ts +48 -0
- package/dist/esm/core/utils.js +48 -0
- package/dist/esm/core/utils.js.map +1 -1
- package/dist/esm/debug/BoundingBoxesLayer.d.ts +26 -0
- package/dist/esm/debug/BoundingBoxesLayer.js +136 -0
- package/dist/esm/debug/BoundingBoxesLayer.js.map +1 -0
- package/dist/esm/debug/DebugLayer.d.ts +42 -0
- package/dist/esm/debug/DebugLayer.js +34 -0
- package/dist/esm/debug/DebugLayer.js.map +1 -0
- package/dist/esm/debug/DebugOverlay.d.ts +59 -0
- package/dist/esm/debug/DebugOverlay.js +123 -0
- package/dist/esm/debug/DebugOverlay.js.map +1 -0
- package/dist/esm/debug/HitTestLayer.d.ts +32 -0
- package/dist/esm/debug/HitTestLayer.js +118 -0
- package/dist/esm/debug/HitTestLayer.js.map +1 -0
- package/dist/esm/debug/PerformanceLayer.d.ts +37 -0
- package/dist/esm/debug/PerformanceLayer.js +193 -0
- package/dist/esm/debug/PerformanceLayer.js.map +1 -0
- package/dist/esm/debug/PointerStackLayer.d.ts +31 -0
- package/dist/esm/debug/PointerStackLayer.js +160 -0
- package/dist/esm/debug/PointerStackLayer.js.map +1 -0
- package/dist/esm/debug/index.d.ts +6 -0
- package/dist/esm/debug/index.js +7 -0
- package/dist/esm/debug/index.js.map +1 -0
- package/dist/esm/index.js +30 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/input/ArcadeStickGamepadMapping.d.ts +7 -0
- package/dist/esm/input/ArcadeStickGamepadMapping.js +7 -0
- package/dist/esm/input/ArcadeStickGamepadMapping.js.map +1 -1
- package/dist/esm/input/GameCubeGamepadMapping.d.ts +9 -0
- package/dist/esm/input/GameCubeGamepadMapping.js +9 -0
- package/dist/esm/input/GameCubeGamepadMapping.js.map +1 -1
- package/dist/esm/input/Gamepad.d.ts +48 -0
- package/dist/esm/input/Gamepad.js +43 -0
- package/dist/esm/input/Gamepad.js.map +1 -1
- package/dist/esm/input/GamepadChannels.d.ts +8 -0
- package/dist/esm/input/GamepadChannels.js +8 -0
- package/dist/esm/input/GamepadChannels.js.map +1 -1
- package/dist/esm/input/GamepadControl.d.ts +18 -0
- package/dist/esm/input/GamepadControl.js +13 -0
- package/dist/esm/input/GamepadControl.js.map +1 -1
- package/dist/esm/input/GamepadDefinitions.d.ts +64 -1
- package/dist/esm/input/GamepadDefinitions.js +40 -1
- package/dist/esm/input/GamepadDefinitions.js.map +1 -1
- package/dist/esm/input/GamepadMapping.d.ts +32 -2
- package/dist/esm/input/GamepadMapping.js +24 -0
- package/dist/esm/input/GamepadMapping.js.map +1 -1
- package/dist/esm/input/GamepadPromptLayouts.d.ts +32 -1
- package/dist/esm/input/GamepadPromptLayouts.js +25 -1
- package/dist/esm/input/GamepadPromptLayouts.js.map +1 -1
- package/dist/esm/input/GenericDualAnalogGamepadMapping.d.ts +10 -0
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js +10 -0
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js.map +1 -1
- package/dist/esm/input/GestureRecognizer.d.ts +11 -2
- package/dist/esm/input/GestureRecognizer.js +11 -2
- package/dist/esm/input/GestureRecognizer.js.map +1 -1
- package/dist/esm/input/Input.d.ts +24 -0
- package/dist/esm/input/Input.js +22 -0
- package/dist/esm/input/Input.js.map +1 -1
- package/dist/esm/input/InputManager.d.ts +43 -0
- package/dist/esm/input/InputManager.js +68 -5
- package/dist/esm/input/InputManager.js.map +1 -1
- package/dist/esm/input/InteractionEvent.d.ts +31 -0
- package/dist/esm/input/InteractionEvent.js +37 -0
- package/dist/esm/input/InteractionEvent.js.map +1 -0
- package/dist/esm/input/InteractionManager.d.ts +163 -0
- package/dist/esm/input/InteractionManager.js +575 -0
- package/dist/esm/input/InteractionManager.js.map +1 -0
- package/dist/esm/input/JoyConLeftGamepadMapping.d.ts +9 -0
- package/dist/esm/input/JoyConLeftGamepadMapping.js +9 -0
- package/dist/esm/input/JoyConLeftGamepadMapping.js.map +1 -1
- package/dist/esm/input/JoyConRightGamepadMapping.d.ts +9 -0
- package/dist/esm/input/JoyConRightGamepadMapping.js +9 -0
- package/dist/esm/input/JoyConRightGamepadMapping.js.map +1 -1
- package/dist/esm/input/PlayStationGamepadMapping.d.ts +8 -0
- package/dist/esm/input/PlayStationGamepadMapping.js +8 -0
- package/dist/esm/input/PlayStationGamepadMapping.js.map +1 -1
- package/dist/esm/input/Pointer.d.ts +22 -0
- package/dist/esm/input/Pointer.js +22 -0
- package/dist/esm/input/Pointer.js.map +1 -1
- package/dist/esm/input/SteamControllerGamepadMapping.d.ts +8 -0
- package/dist/esm/input/SteamControllerGamepadMapping.js +8 -0
- package/dist/esm/input/SteamControllerGamepadMapping.js.map +1 -1
- package/dist/esm/input/SwitchProGamepadMapping.d.ts +9 -0
- package/dist/esm/input/SwitchProGamepadMapping.js +9 -0
- package/dist/esm/input/SwitchProGamepadMapping.js.map +1 -1
- package/dist/esm/input/XboxGamepadMapping.d.ts +8 -0
- package/dist/esm/input/XboxGamepadMapping.js +8 -0
- package/dist/esm/input/XboxGamepadMapping.js.map +1 -1
- package/dist/esm/input/index.d.ts +2 -0
- package/dist/esm/input/interaction-hooks.d.ts +34 -0
- package/dist/esm/input/interaction-hooks.js +35 -0
- package/dist/esm/input/interaction-hooks.js.map +1 -0
- package/dist/esm/input/types.d.ts +20 -0
- package/dist/esm/input/types.js +20 -0
- package/dist/esm/input/types.js.map +1 -1
- package/dist/esm/math/AbstractVector.d.ts +83 -0
- package/dist/esm/math/AbstractVector.js +83 -0
- package/dist/esm/math/AbstractVector.js.map +1 -1
- package/dist/esm/math/Circle.d.ts +44 -2
- package/dist/esm/math/Circle.js +116 -16
- package/dist/esm/math/Circle.js.map +1 -1
- package/dist/esm/math/CircleLike.d.ts +1 -0
- package/dist/esm/math/Collision.d.ts +39 -0
- package/dist/esm/math/Collision.js +5 -0
- package/dist/esm/math/Collision.js.map +1 -1
- package/dist/esm/math/Ellipse.d.ts +11 -0
- package/dist/esm/math/Ellipse.js +18 -2
- package/dist/esm/math/Ellipse.js.map +1 -1
- package/dist/esm/math/EllipseLike.d.ts +3 -0
- package/dist/esm/math/Flags.d.ts +31 -0
- package/dist/esm/math/Flags.js +31 -0
- package/dist/esm/math/Flags.js.map +1 -1
- package/dist/esm/math/Interval.d.ts +15 -0
- package/dist/esm/math/Interval.js +16 -1
- package/dist/esm/math/Interval.js.map +1 -1
- package/dist/esm/math/Line.d.ts +17 -1
- package/dist/esm/math/Line.js +17 -1
- package/dist/esm/math/Line.js.map +1 -1
- package/dist/esm/math/LineLike.d.ts +1 -0
- package/dist/esm/math/Matrix.d.ts +44 -3
- package/dist/esm/math/Matrix.js +44 -3
- package/dist/esm/math/Matrix.js.map +1 -1
- package/dist/esm/math/ObservableSize.d.ts +7 -0
- package/dist/esm/math/ObservableSize.js +7 -0
- package/dist/esm/math/ObservableSize.js.map +1 -1
- package/dist/esm/math/ObservableVector.d.ts +11 -2
- package/dist/esm/math/ObservableVector.js +13 -2
- package/dist/esm/math/ObservableVector.js.map +1 -1
- package/dist/esm/math/PointLike.d.ts +1 -0
- package/dist/esm/math/PolarVector.d.ts +15 -0
- package/dist/esm/math/PolarVector.js +16 -1
- package/dist/esm/math/PolarVector.js.map +1 -1
- package/dist/esm/math/Polygon.d.ts +35 -1
- package/dist/esm/math/Polygon.js +78 -6
- package/dist/esm/math/Polygon.js.map +1 -1
- package/dist/esm/math/PolygonLike.d.ts +4 -0
- package/dist/esm/math/Quadtree.d.ts +84 -0
- package/dist/esm/math/Quadtree.js +204 -0
- package/dist/esm/math/Quadtree.js.map +1 -0
- package/dist/esm/math/Random.d.ts +25 -0
- package/dist/esm/math/Random.js +26 -1
- package/dist/esm/math/Random.js.map +1 -1
- package/dist/esm/math/Rectangle.d.ts +15 -0
- package/dist/esm/math/Rectangle.js +17 -2
- package/dist/esm/math/Rectangle.js.map +1 -1
- package/dist/esm/math/RectangleLike.d.ts +1 -0
- package/dist/esm/math/Segment.d.ts +7 -0
- package/dist/esm/math/Segment.js +7 -0
- package/dist/esm/math/Segment.js.map +1 -1
- package/dist/esm/math/ShapeLike.d.ts +6 -0
- package/dist/esm/math/Size.d.ts +9 -0
- package/dist/esm/math/Size.js +10 -1
- package/dist/esm/math/Size.js.map +1 -1
- package/dist/esm/math/Vector.d.ts +16 -0
- package/dist/esm/math/Vector.js +17 -1
- package/dist/esm/math/Vector.js.map +1 -1
- package/dist/esm/math/collision-detection.d.ts +47 -1
- package/dist/esm/math/collision-detection.js +231 -17
- package/dist/esm/math/collision-detection.js.map +1 -1
- package/dist/esm/math/collision-primitives.d.ts +23 -0
- package/dist/esm/math/collision-primitives.js +23 -0
- package/dist/esm/math/collision-primitives.js.map +1 -1
- package/dist/esm/math/geometry.d.ts +42 -0
- package/dist/esm/math/geometry.js +37 -0
- package/dist/esm/math/geometry.js.map +1 -1
- package/dist/esm/math/index.d.ts +1 -0
- package/dist/esm/math/utils.d.ts +41 -0
- package/dist/esm/math/utils.js +41 -0
- package/dist/esm/math/utils.js.map +1 -1
- package/dist/esm/particles/Particle.d.ts +37 -0
- package/dist/esm/particles/Particle.js +37 -0
- package/dist/esm/particles/Particle.js.map +1 -1
- package/dist/esm/particles/ParticleProperties.d.ts +15 -0
- package/dist/esm/particles/ParticleSystem.d.ts +69 -0
- package/dist/esm/particles/ParticleSystem.js +70 -0
- package/dist/esm/particles/ParticleSystem.js.map +1 -1
- package/dist/esm/particles/affectors/ColorAffector.d.ts +13 -0
- package/dist/esm/particles/affectors/ColorAffector.js +13 -0
- package/dist/esm/particles/affectors/ColorAffector.js.map +1 -1
- package/dist/esm/particles/affectors/ForceAffector.d.ts +11 -0
- package/dist/esm/particles/affectors/ForceAffector.js +11 -0
- package/dist/esm/particles/affectors/ForceAffector.js.map +1 -1
- package/dist/esm/particles/affectors/ParticleAffector.d.ts +13 -0
- package/dist/esm/particles/affectors/ScaleAffector.d.ts +10 -0
- package/dist/esm/particles/affectors/ScaleAffector.js +10 -0
- package/dist/esm/particles/affectors/ScaleAffector.js.map +1 -1
- package/dist/esm/particles/affectors/TorqueAffector.d.ts +11 -0
- package/dist/esm/particles/affectors/TorqueAffector.js +12 -1
- package/dist/esm/particles/affectors/TorqueAffector.js.map +1 -1
- package/dist/esm/particles/emitters/ParticleEmitter.d.ts +13 -0
- package/dist/esm/particles/emitters/ParticleOptions.d.ts +16 -0
- package/dist/esm/particles/emitters/ParticleOptions.js +16 -0
- package/dist/esm/particles/emitters/ParticleOptions.js.map +1 -1
- package/dist/esm/particles/emitters/UniversalEmitter.d.ts +23 -0
- package/dist/esm/particles/emitters/UniversalEmitter.js +23 -0
- package/dist/esm/particles/emitters/UniversalEmitter.js.map +1 -1
- package/dist/esm/rendering/CallbackRenderPass.d.ts +12 -0
- package/dist/esm/rendering/CallbackRenderPass.js +12 -0
- package/dist/esm/rendering/CallbackRenderPass.js.map +1 -1
- package/dist/esm/rendering/Container.d.ts +44 -0
- package/dist/esm/rendering/Container.js +62 -0
- package/dist/esm/rendering/Container.js.map +1 -1
- package/dist/esm/rendering/Drawable.d.ts +22 -0
- package/dist/esm/rendering/Drawable.js +22 -0
- package/dist/esm/rendering/Drawable.js.map +1 -1
- package/dist/esm/rendering/RenderBackend.d.ts +13 -0
- package/dist/esm/rendering/RenderBackendType.d.ts +4 -0
- package/dist/esm/rendering/RenderBackendType.js +4 -0
- package/dist/esm/rendering/RenderBackendType.js.map +1 -1
- package/dist/esm/rendering/RenderNode.d.ts +45 -0
- package/dist/esm/rendering/RenderNode.js +62 -0
- package/dist/esm/rendering/RenderNode.js.map +1 -1
- package/dist/esm/rendering/RenderPass.d.ts +8 -0
- package/dist/esm/rendering/RenderStats.d.ts +19 -0
- package/dist/esm/rendering/RenderStats.js +7 -0
- package/dist/esm/rendering/RenderStats.js.map +1 -1
- package/dist/esm/rendering/RenderTarget.d.ts +17 -0
- package/dist/esm/rendering/RenderTarget.js +17 -0
- package/dist/esm/rendering/RenderTarget.js.map +1 -1
- package/dist/esm/rendering/RenderTargetPass.d.ts +11 -0
- package/dist/esm/rendering/RenderTargetPass.js +7 -0
- package/dist/esm/rendering/RenderTargetPass.js.map +1 -1
- package/dist/esm/rendering/Renderer.d.ts +15 -0
- package/dist/esm/rendering/RendererRegistry.d.ts +7 -0
- package/dist/esm/rendering/RendererRegistry.js +7 -0
- package/dist/esm/rendering/RendererRegistry.js.map +1 -1
- package/dist/esm/rendering/View.d.ts +73 -6
- package/dist/esm/rendering/View.js +69 -2
- package/dist/esm/rendering/View.js.map +1 -1
- package/dist/esm/rendering/filters/BlurFilter.d.ts +9 -0
- package/dist/esm/rendering/filters/BlurFilter.js +8 -0
- package/dist/esm/rendering/filters/BlurFilter.js.map +1 -1
- package/dist/esm/rendering/filters/ColorFilter.d.ts +7 -0
- package/dist/esm/rendering/filters/ColorFilter.js +7 -0
- package/dist/esm/rendering/filters/ColorFilter.js.map +1 -1
- package/dist/esm/rendering/filters/Filter.d.ts +23 -0
- package/dist/esm/rendering/filters/Filter.js +20 -0
- package/dist/esm/rendering/filters/Filter.js.map +1 -1
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.d.ts +114 -0
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.js +273 -0
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.js.map +1 -0
- package/dist/esm/rendering/filters/WebGpuShaderFilter.d.ts +116 -0
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js +402 -0
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js.map +1 -0
- package/dist/esm/rendering/index.d.ts +3 -0
- package/dist/esm/rendering/mesh/Mesh.d.ts +2 -0
- package/dist/esm/rendering/mesh/Mesh.js +3 -0
- package/dist/esm/rendering/mesh/Mesh.js.map +1 -1
- package/dist/esm/rendering/primitives/Graphics.d.ts +34 -0
- package/dist/esm/rendering/primitives/Graphics.js +34 -0
- package/dist/esm/rendering/primitives/Graphics.js.map +1 -1
- package/dist/esm/rendering/shader/Shader.d.ts +36 -0
- package/dist/esm/rendering/shader/Shader.js +26 -0
- package/dist/esm/rendering/shader/Shader.js.map +1 -1
- package/dist/esm/rendering/shader/ShaderAttribute.d.ts +13 -0
- package/dist/esm/rendering/shader/ShaderAttribute.js +13 -0
- package/dist/esm/rendering/shader/ShaderAttribute.js.map +1 -1
- package/dist/esm/rendering/shader/ShaderUniform.d.ts +27 -0
- package/dist/esm/rendering/shader/ShaderUniform.js +28 -1
- package/dist/esm/rendering/shader/ShaderUniform.js.map +1 -1
- package/dist/esm/rendering/shader/upgradeFragmentShaderToGl300.d.ts +34 -0
- package/dist/esm/rendering/shader/upgradeFragmentShaderToGl300.js +60 -0
- package/dist/esm/rendering/shader/upgradeFragmentShaderToGl300.js.map +1 -0
- package/dist/esm/rendering/sprite/AnimatedSprite.d.ts +38 -0
- package/dist/esm/rendering/sprite/AnimatedSprite.js +36 -0
- package/dist/esm/rendering/sprite/AnimatedSprite.js.map +1 -1
- package/dist/esm/rendering/sprite/Sprite.d.ts +62 -1
- package/dist/esm/rendering/sprite/Sprite.js +97 -19
- package/dist/esm/rendering/sprite/Sprite.js.map +1 -1
- package/dist/esm/rendering/sprite/Spritesheet.d.ts +25 -0
- package/dist/esm/rendering/sprite/Spritesheet.js +20 -0
- package/dist/esm/rendering/sprite/Spritesheet.js.map +1 -1
- package/dist/esm/rendering/text/Text.d.ts +2 -0
- package/dist/esm/rendering/text/Text.js +2 -0
- package/dist/esm/rendering/text/Text.js.map +1 -1
- package/dist/esm/rendering/text/TextStyle.d.ts +29 -0
- package/dist/esm/rendering/text/TextStyle.js +24 -0
- package/dist/esm/rendering/text/TextStyle.js.map +1 -1
- package/dist/esm/rendering/text/types.d.ts +1 -0
- package/dist/esm/rendering/texture/RenderTexture.d.ts +16 -0
- package/dist/esm/rendering/texture/RenderTexture.js +16 -0
- package/dist/esm/rendering/texture/RenderTexture.js.map +1 -1
- package/dist/esm/rendering/texture/Sampler.d.ts +23 -0
- package/dist/esm/rendering/texture/Sampler.js +13 -0
- package/dist/esm/rendering/texture/Sampler.js.map +1 -1
- package/dist/esm/rendering/texture/Texture.d.ts +30 -0
- package/dist/esm/rendering/texture/Texture.js +30 -0
- package/dist/esm/rendering/texture/Texture.js.map +1 -1
- package/dist/esm/rendering/types.d.ts +29 -0
- package/dist/esm/rendering/types.js +29 -0
- package/dist/esm/rendering/types.js.map +1 -1
- package/dist/esm/rendering/utils.d.ts +20 -0
- package/dist/esm/rendering/utils.js +10 -0
- package/dist/esm/rendering/utils.js.map +1 -1
- package/dist/esm/rendering/video/Video.d.ts +39 -1
- package/dist/esm/rendering/video/Video.js +68 -6
- package/dist/esm/rendering/video/Video.js.map +1 -1
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.d.ts +7 -0
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js +7 -0
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts +17 -4
- package/dist/esm/rendering/webgl2/WebGl2Backend.js +20 -16
- package/dist/esm/rendering/webgl2/WebGl2Backend.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.d.ts +8 -0
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js +8 -0
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts +45 -8
- package/dist/esm/rendering/webgpu/WebGpuBackend.js +160 -40
- package/dist/esm/rendering/webgpu/WebGpuBackend.js.map +1 -1
- package/dist/esm/resources/AbstractAssetFactory.d.ts +20 -0
- package/dist/esm/resources/AbstractAssetFactory.js +20 -0
- package/dist/esm/resources/AbstractAssetFactory.js.map +1 -1
- package/dist/esm/resources/AssetFactory.d.ts +26 -0
- package/dist/esm/resources/AssetManifest.d.ts +45 -0
- package/dist/esm/resources/AssetManifest.js +25 -0
- package/dist/esm/resources/AssetManifest.js.map +1 -1
- package/dist/esm/resources/CacheFirstStrategy.d.ts +12 -0
- package/dist/esm/resources/CacheFirstStrategy.js +12 -0
- package/dist/esm/resources/CacheFirstStrategy.js.map +1 -1
- package/dist/esm/resources/CacheStore.d.ts +23 -0
- package/dist/esm/resources/CacheStrategy.d.ts +20 -0
- package/dist/esm/resources/Database.d.ts +45 -0
- package/dist/esm/resources/FactoryRegistry.d.ts +28 -0
- package/dist/esm/resources/FactoryRegistry.js +24 -0
- package/dist/esm/resources/FactoryRegistry.js.map +1 -1
- package/dist/esm/resources/IndexedDbDatabase.d.ts +22 -1
- package/dist/esm/resources/IndexedDbDatabase.js +21 -0
- package/dist/esm/resources/IndexedDbDatabase.js.map +1 -1
- package/dist/esm/resources/IndexedDbStore.d.ts +20 -0
- package/dist/esm/resources/IndexedDbStore.js +12 -0
- package/dist/esm/resources/IndexedDbStore.js.map +1 -1
- package/dist/esm/resources/Loader.d.ts +167 -0
- package/dist/esm/resources/Loader.js +110 -0
- package/dist/esm/resources/Loader.js.map +1 -1
- package/dist/esm/resources/NetworkOnlyStrategy.d.ts +8 -0
- package/dist/esm/resources/NetworkOnlyStrategy.js +8 -0
- package/dist/esm/resources/NetworkOnlyStrategy.js.map +1 -1
- package/dist/esm/resources/factories/BinaryFactory.d.ts +13 -0
- package/dist/esm/resources/factories/BinaryFactory.js +13 -0
- package/dist/esm/resources/factories/BinaryFactory.js.map +1 -1
- package/dist/esm/resources/factories/FontFactory.d.ts +37 -0
- package/dist/esm/resources/factories/FontFactory.js +26 -0
- package/dist/esm/resources/factories/FontFactory.js.map +1 -1
- package/dist/esm/resources/factories/ImageFactory.d.ts +24 -0
- package/dist/esm/resources/factories/ImageFactory.js +19 -0
- package/dist/esm/resources/factories/ImageFactory.js.map +1 -1
- package/dist/esm/resources/factories/JsonFactory.d.ts +13 -0
- package/dist/esm/resources/factories/JsonFactory.js +13 -0
- package/dist/esm/resources/factories/JsonFactory.js.map +1 -1
- package/dist/esm/resources/factories/MusicFactory.d.ts +36 -0
- package/dist/esm/resources/factories/MusicFactory.js +44 -4
- package/dist/esm/resources/factories/MusicFactory.js.map +1 -1
- package/dist/esm/resources/factories/SoundFactory.d.ts +29 -0
- package/dist/esm/resources/factories/SoundFactory.js +18 -0
- package/dist/esm/resources/factories/SoundFactory.js.map +1 -1
- package/dist/esm/resources/factories/SvgFactory.d.ts +19 -0
- package/dist/esm/resources/factories/SvgFactory.js +19 -0
- package/dist/esm/resources/factories/SvgFactory.js.map +1 -1
- package/dist/esm/resources/factories/TextFactory.d.ts +11 -0
- package/dist/esm/resources/factories/TextFactory.js +11 -0
- package/dist/esm/resources/factories/TextFactory.js.map +1 -1
- package/dist/esm/resources/factories/TextureFactory.d.ts +25 -0
- package/dist/esm/resources/factories/TextureFactory.js +20 -0
- package/dist/esm/resources/factories/TextureFactory.js.map +1 -1
- package/dist/esm/resources/factories/VideoFactory.d.ts +37 -0
- package/dist/esm/resources/factories/VideoFactory.js +48 -5
- package/dist/esm/resources/factories/VideoFactory.js.map +1 -1
- package/dist/esm/resources/factories/VttFactory.d.ts +18 -0
- package/dist/esm/resources/factories/VttFactory.js +24 -0
- package/dist/esm/resources/factories/VttFactory.js.map +1 -1
- package/dist/esm/resources/factories/WasmFactory.d.ts +16 -0
- package/dist/esm/resources/factories/WasmFactory.js +16 -0
- package/dist/esm/resources/factories/WasmFactory.js.map +1 -1
- package/dist/esm/resources/utils.d.ts +10 -0
- package/dist/esm/resources/utils.js +10 -0
- package/dist/esm/resources/utils.js.map +1 -1
- package/dist/exo.esm.js +11182 -2538
- package/dist/exo.esm.js.map +1 -1
- package/package.json +20 -9
- package/dist/esm/core/Quadtree.d.ts +0 -20
- package/dist/esm/core/Quadtree.js +0 -86
- package/dist/esm/core/Quadtree.js.map +0 -1
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { clamp } from '../math/utils.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single mappable control — one button or one axis — on a physical gamepad.
|
|
5
|
+
*
|
|
6
|
+
* Stores the raw Gamepad API `index`, the target {@link GamepadChannel}, and the
|
|
7
|
+
* transform parameters (`invert`, `normalize`, `threshold`) applied each frame
|
|
8
|
+
* by {@link transformValue} before the value is written to the channel buffer.
|
|
9
|
+
*/
|
|
3
10
|
class GamepadControl {
|
|
4
11
|
index;
|
|
5
12
|
channel;
|
|
@@ -13,6 +20,12 @@ class GamepadControl {
|
|
|
13
20
|
this.normalize = options.normalize ?? false;
|
|
14
21
|
this.threshold = clamp(options.threshold ?? 0.2, 0, 1);
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Applies the control's transform pipeline to a raw browser value.
|
|
25
|
+
*
|
|
26
|
+
* Pipeline: clamp to [-1, 1] → optional invert → optional normalize to [0, 1]
|
|
27
|
+
* → dead-zone (returns 0 when the absolute result is at or below `threshold`).
|
|
28
|
+
*/
|
|
16
29
|
transformValue(value) {
|
|
17
30
|
let result = clamp(value, -1, 1);
|
|
18
31
|
if (this.invert) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamepadControl.js","sources":["../../../../src/input/GamepadControl.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"GamepadControl.js","sources":["../../../../src/input/GamepadControl.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeA;;;;;;AAMG;MACU,cAAc,CAAA;AACP,IAAA,KAAK;AACL,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,SAAS;AACT,IAAA,SAAS;AAEzB,IAAA,WAAA,CAAmB,KAAa,EAAE,OAAuB,EAAE,UAAiC,EAAE,EAAA;AAC1F,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;QACtB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK;QACrC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK;AAC3C,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1D;AAEA;;;;;AAKG;AACI,IAAA,cAAc,CAAC,KAAa,EAAA;QAC/B,IAAI,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAEhC,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,MAAM,IAAI,EAAE;QAChB;AAEA,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC;QAC7B;AAEA,QAAA,OAAO,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,MAAM,GAAG,CAAC;IAC/C;AACH;;;;"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { GamepadMapping } from './GamepadMapping';
|
|
2
|
+
/** Convenience alias for the non-null element type returned by `navigator.getGamepads()`. */
|
|
2
3
|
export type BrowserGamepad = NonNullable<ReturnType<Navigator['getGamepads']>[number]>;
|
|
4
|
+
/**
|
|
5
|
+
* Value a {@link GamepadDefinition.resolve} callback may return.
|
|
6
|
+
*
|
|
7
|
+
* Return a bare {@link GamepadMapping} to accept the device with the definition's
|
|
8
|
+
* default name, an object with an optional `name` override, or `null`/`undefined`
|
|
9
|
+
* to decline the device and let the next definition in the list try.
|
|
10
|
+
*/
|
|
3
11
|
export type GamepadDefinitionResult = GamepadMapping | {
|
|
4
12
|
name?: string;
|
|
5
13
|
mapping: GamepadMapping;
|
|
6
14
|
} | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Parsed metadata extracted from a browser `Gamepad.id` string.
|
|
17
|
+
*
|
|
18
|
+
* `vendorId` and `productId` are four-hex-digit strings (e.g. `"045e"`, `"028e"`).
|
|
19
|
+
* `productKey` is the colon-joined pair (`"045e:028e"`), used as a compact lookup key.
|
|
20
|
+
* `name` is the human-readable portion of the id with the vendor/product tokens removed,
|
|
21
|
+
* or `null` when the id contained only identifiers.
|
|
22
|
+
*/
|
|
7
23
|
export interface GamepadDescriptor {
|
|
8
24
|
id: string;
|
|
9
25
|
index: number;
|
|
@@ -13,19 +29,66 @@ export interface GamepadDescriptor {
|
|
|
13
29
|
productKey: string | null;
|
|
14
30
|
name: string | null;
|
|
15
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A rule that matches one or more physical gamepads and produces a {@link GamepadMapping}.
|
|
34
|
+
*
|
|
35
|
+
* `ids` is an optional allow-list of vendor IDs (`"045e"`) or `vendorId:productId`
|
|
36
|
+
* pairs (`"045e:028e"`); when omitted the definition matches every device.
|
|
37
|
+
* `resolve` is called with the parsed {@link GamepadDescriptor} and must return a
|
|
38
|
+
* {@link GamepadDefinitionResult} — `null`/`undefined` to skip, a mapping otherwise.
|
|
39
|
+
*/
|
|
16
40
|
export interface GamepadDefinition {
|
|
17
41
|
ids?: string | Array<string>;
|
|
18
42
|
name?: string;
|
|
19
43
|
resolve: (descriptor: GamepadDescriptor) => GamepadDefinitionResult;
|
|
20
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* The fully resolved product of running a {@link GamepadDefinition} against a
|
|
47
|
+
* connected gamepad — bundles the original descriptor, the resolved display name,
|
|
48
|
+
* and the chosen {@link GamepadMapping} together for use by {@link Gamepad}.
|
|
49
|
+
*/
|
|
21
50
|
export interface ResolvedGamepadDefinition {
|
|
22
51
|
descriptor: GamepadDescriptor;
|
|
23
52
|
name: string;
|
|
24
53
|
mapping: GamepadMapping;
|
|
25
54
|
}
|
|
26
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns `true` when `descriptor` matches any entry in `ids`.
|
|
57
|
+
*
|
|
58
|
+
* A colon-containing id (e.g. `"045e:028e"`) is matched against
|
|
59
|
+
* `descriptor.productKey`; a bare four-hex id is matched against
|
|
60
|
+
* `descriptor.vendorId`. Passing no `ids` always returns `true`.
|
|
61
|
+
*/
|
|
27
62
|
export declare const matchesIds: (descriptor: GamepadDescriptor, ids?: string | Array<string>) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Parses the raw browser `Gamepad.id` string into a structured {@link GamepadDescriptor}.
|
|
65
|
+
*
|
|
66
|
+
* Attempts multiple vendor/product ID patterns (hex-prefixed, plain, VID/PID, bare pair)
|
|
67
|
+
* in order of specificity, then strips the matched tokens to derive a clean `name`.
|
|
68
|
+
*/
|
|
28
69
|
export declare const parseGamepadDescriptor: (gamepad: BrowserGamepad) => GamepadDescriptor;
|
|
70
|
+
/**
|
|
71
|
+
* Runs a single {@link GamepadDefinition} against a descriptor, respecting its
|
|
72
|
+
* `ids` filter. Returns `null` when the definition declines the device.
|
|
73
|
+
*/
|
|
29
74
|
export declare const resolveDefinition: (definition: GamepadDefinition, descriptor: GamepadDescriptor) => ResolvedGamepadDefinition | null;
|
|
75
|
+
/**
|
|
76
|
+
* Resolves the best-matching {@link ResolvedGamepadDefinition} for a connected gamepad.
|
|
77
|
+
*
|
|
78
|
+
* Iterates `definitions` in order — exact product IDs first, then vendor fallbacks,
|
|
79
|
+
* then a generic catch-all — and returns the first match. Falls back to
|
|
80
|
+
* {@link GenericDualAnalogGamepadMapping} when no definition matches.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const resolved = resolveGamepadDefinition(navigator.getGamepads()[0]!);
|
|
84
|
+
* const gamepad = new Gamepad(browserGamepad, channels, resolved);
|
|
85
|
+
*/
|
|
30
86
|
export declare const resolveGamepadDefinition: (gamepadOrDescriptor: BrowserGamepad | GamepadDescriptor, definitions?: ReadonlyArray<GamepadDefinition>) => ResolvedGamepadDefinition;
|
|
87
|
+
/**
|
|
88
|
+
* The default ordered list of {@link GamepadDefinition} entries used by
|
|
89
|
+
* {@link resolveGamepadDefinition} when no custom list is supplied.
|
|
90
|
+
*
|
|
91
|
+
* Ordered as: exact product-ID matches → vendor-ID fallbacks → generic catch-all.
|
|
92
|
+
* Register custom definitions by prepending to a copy and passing it explicitly.
|
|
93
|
+
*/
|
|
31
94
|
export declare const builtInGamepadDefinitions: Array<GamepadDefinition>;
|
|
@@ -59,6 +59,10 @@ const resolveDefinitionResult = (definition, descriptor) => {
|
|
|
59
59
|
mapping: result,
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Normalises an `ids` value into a trimmed, lower-case string array ready for
|
|
64
|
+
* comparison against a {@link GamepadDescriptor}.
|
|
65
|
+
*/
|
|
62
66
|
const normalizeIds = (ids) => {
|
|
63
67
|
if (!ids) {
|
|
64
68
|
return [];
|
|
@@ -66,6 +70,13 @@ const normalizeIds = (ids) => {
|
|
|
66
70
|
const values = Array.isArray(ids) ? ids : [ids];
|
|
67
71
|
return values.map(normalizeId);
|
|
68
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Returns `true` when `descriptor` matches any entry in `ids`.
|
|
75
|
+
*
|
|
76
|
+
* A colon-containing id (e.g. `"045e:028e"`) is matched against
|
|
77
|
+
* `descriptor.productKey`; a bare four-hex id is matched against
|
|
78
|
+
* `descriptor.vendorId`. Passing no `ids` always returns `true`.
|
|
79
|
+
*/
|
|
69
80
|
const matchesIds = (descriptor, ids) => {
|
|
70
81
|
if (!ids) {
|
|
71
82
|
return true;
|
|
@@ -83,6 +94,12 @@ const matchesIds = (descriptor, ids) => {
|
|
|
83
94
|
}
|
|
84
95
|
return false;
|
|
85
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Parses the raw browser `Gamepad.id` string into a structured {@link GamepadDescriptor}.
|
|
99
|
+
*
|
|
100
|
+
* Attempts multiple vendor/product ID patterns (hex-prefixed, plain, VID/PID, bare pair)
|
|
101
|
+
* in order of specificity, then strips the matched tokens to derive a clean `name`.
|
|
102
|
+
*/
|
|
86
103
|
const parseGamepadDescriptor = (gamepad) => {
|
|
87
104
|
const label = gamepad.id.trim() || `Gamepad ${gamepad.index}`;
|
|
88
105
|
const productKey = parseProductKey(label);
|
|
@@ -98,12 +115,27 @@ const parseGamepadDescriptor = (gamepad) => {
|
|
|
98
115
|
name: parseName(label),
|
|
99
116
|
};
|
|
100
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* Runs a single {@link GamepadDefinition} against a descriptor, respecting its
|
|
120
|
+
* `ids` filter. Returns `null` when the definition declines the device.
|
|
121
|
+
*/
|
|
101
122
|
const resolveDefinition = (definition, descriptor) => {
|
|
102
123
|
if (!matchesIds(descriptor, definition.ids)) {
|
|
103
124
|
return null;
|
|
104
125
|
}
|
|
105
126
|
return resolveDefinitionResult(definition, descriptor);
|
|
106
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* Resolves the best-matching {@link ResolvedGamepadDefinition} for a connected gamepad.
|
|
130
|
+
*
|
|
131
|
+
* Iterates `definitions` in order — exact product IDs first, then vendor fallbacks,
|
|
132
|
+
* then a generic catch-all — and returns the first match. Falls back to
|
|
133
|
+
* {@link GenericDualAnalogGamepadMapping} when no definition matches.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* const resolved = resolveGamepadDefinition(navigator.getGamepads()[0]!);
|
|
137
|
+
* const gamepad = new Gamepad(browserGamepad, channels, resolved);
|
|
138
|
+
*/
|
|
107
139
|
const resolveGamepadDefinition = (gamepadOrDescriptor, definitions = builtInGamepadDefinitions) => {
|
|
108
140
|
const descriptor = 'connected' in gamepadOrDescriptor
|
|
109
141
|
? parseGamepadDescriptor(gamepadOrDescriptor)
|
|
@@ -165,11 +197,18 @@ const vendorFallbackDefinitions = [
|
|
|
165
197
|
createStaticGamepadDefinition('Sony Controller', () => new PlayStationGamepadMapping(), '054c'),
|
|
166
198
|
];
|
|
167
199
|
const genericFallbackDefinition = createStaticGamepadDefinition('Generic Gamepad', () => new GenericDualAnalogGamepadMapping());
|
|
200
|
+
/**
|
|
201
|
+
* The default ordered list of {@link GamepadDefinition} entries used by
|
|
202
|
+
* {@link resolveGamepadDefinition} when no custom list is supplied.
|
|
203
|
+
*
|
|
204
|
+
* Ordered as: exact product-ID matches → vendor-ID fallbacks → generic catch-all.
|
|
205
|
+
* Register custom definitions by prepending to a copy and passing it explicitly.
|
|
206
|
+
*/
|
|
168
207
|
const builtInGamepadDefinitions = [
|
|
169
208
|
...exactDeviceDefinitions,
|
|
170
209
|
...vendorFallbackDefinitions,
|
|
171
210
|
genericFallbackDefinition,
|
|
172
211
|
];
|
|
173
212
|
|
|
174
|
-
export { builtInGamepadDefinitions, matchesIds,
|
|
213
|
+
export { builtInGamepadDefinitions, matchesIds, parseGamepadDescriptor, resolveDefinition, resolveGamepadDefinition };
|
|
175
214
|
//# sourceMappingURL=GamepadDefinitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamepadDefinitions.js","sources":["../../../../src/input/GamepadDefinitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GamepadDefinitions.js","sources":["../../../../src/input/GamepadDefinitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AA0EA,MAAM,oBAAoB,GAAG,yDAAyD;AACtF,MAAM,uBAAuB,GAAG,6DAA6D;AAC7F,MAAM,w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AC;CAC9G;AAED,MAAM,yBAAyB,GAA6B;IACxD,6BAA6B,CAAC,sBAAsB,EAAE,MAAM,IAAI,kBAAkB,EAAE,EAAE,MAAM,CAAC;IAC7F,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,IAAI,yBAAyB,EAAE,EAAE,MAAM,CAAC;CAClG;AAED,MAAM,yBAAyB,GAAG,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,IAAI,+BAA+B,EAAE,CAAC;AAE/H;;;;;;AAMG;AACI,MAAM,yBAAyB,GAA6B;AAC/D,IAAA,GAAG,sBAAsB;AACzB,IAAA,GAAG,yBAAyB;IAC5B,yBAAyB;;;;;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { GamepadControl } from './GamepadControl';
|
|
2
2
|
import type { GamepadControlOptions } from './GamepadControl';
|
|
3
3
|
import type { GamepadChannel } from './GamepadChannels';
|
|
4
|
+
/**
|
|
5
|
+
* Discriminant tag identifying which device family a {@link GamepadMapping} belongs to.
|
|
6
|
+
* Used to select the correct mapping at runtime when a gamepad connects.
|
|
7
|
+
*/
|
|
4
8
|
export declare enum GamepadMappingFamily {
|
|
5
9
|
GenericDualAnalog = "genericDualAnalog",
|
|
6
10
|
Xbox = "xbox",
|
|
@@ -12,12 +16,38 @@ export declare enum GamepadMappingFamily {
|
|
|
12
16
|
SteamController = "steamController",
|
|
13
17
|
ArcadeStick = "arcadeStick"
|
|
14
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Compact descriptor for a single gamepad control.
|
|
21
|
+
* Tuple of `[rawIndex, channel, options?]` where `rawIndex` is the
|
|
22
|
+
* Gamepad API button or axis index reported by the browser.
|
|
23
|
+
*/
|
|
15
24
|
export type GamepadControlDefinition = readonly [number, GamepadChannel, GamepadControlOptions?];
|
|
25
|
+
/**
|
|
26
|
+
* Abstract translation layer between the browser's raw {@link https://developer.mozilla.org/en-US/docs/Web/API/Gamepad Gamepad API}
|
|
27
|
+
* indices and ExoJS-canonical {@link GamepadChannel} controls.
|
|
28
|
+
*
|
|
29
|
+
* Each concrete subclass encodes one device family's button/axis layout as
|
|
30
|
+
* ordered arrays of {@link GamepadControl} objects. The engine selects the
|
|
31
|
+
* appropriate mapping when a gamepad connects and uses it to route raw
|
|
32
|
+
* values to the correct input channels every frame.
|
|
33
|
+
*/
|
|
16
34
|
export declare abstract class GamepadMapping {
|
|
35
|
+
/** Identifies the device family this mapping targets. */
|
|
17
36
|
abstract readonly family: GamepadMappingFamily;
|
|
18
|
-
|
|
19
|
-
readonly
|
|
37
|
+
/** Ordered list of button controls, indexed by the Gamepad API button index. */
|
|
38
|
+
readonly buttons: ReadonlyArray<GamepadControl>;
|
|
39
|
+
/** Ordered list of axis controls, indexed by the Gamepad API axis index. */
|
|
40
|
+
readonly axes: ReadonlyArray<GamepadControl>;
|
|
20
41
|
protected constructor(buttons: Array<GamepadControl>, axes: Array<GamepadControl>);
|
|
42
|
+
/**
|
|
43
|
+
* Releases all button and axis control references held by this mapping.
|
|
44
|
+
* Call when the associated gamepad disconnects to allow garbage collection.
|
|
45
|
+
*/
|
|
21
46
|
destroy(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Converts an array of {@link GamepadControlDefinition} tuples into fully
|
|
49
|
+
* constructed {@link GamepadControl} instances.
|
|
50
|
+
* Shared factory used by all concrete mapping constructors.
|
|
51
|
+
*/
|
|
22
52
|
static createControls(definitions: ReadonlyArray<GamepadControlDefinition>): Array<GamepadControl>;
|
|
23
53
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { GamepadControl } from './GamepadControl.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Discriminant tag identifying which device family a {@link GamepadMapping} belongs to.
|
|
5
|
+
* Used to select the correct mapping at runtime when a gamepad connects.
|
|
6
|
+
*/
|
|
3
7
|
var GamepadMappingFamily;
|
|
4
8
|
(function (GamepadMappingFamily) {
|
|
5
9
|
GamepadMappingFamily["GenericDualAnalog"] = "genericDualAnalog";
|
|
@@ -12,17 +16,37 @@ var GamepadMappingFamily;
|
|
|
12
16
|
GamepadMappingFamily["SteamController"] = "steamController";
|
|
13
17
|
GamepadMappingFamily["ArcadeStick"] = "arcadeStick";
|
|
14
18
|
})(GamepadMappingFamily || (GamepadMappingFamily = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Abstract translation layer between the browser's raw {@link https://developer.mozilla.org/en-US/docs/Web/API/Gamepad Gamepad API}
|
|
21
|
+
* indices and ExoJS-canonical {@link GamepadChannel} controls.
|
|
22
|
+
*
|
|
23
|
+
* Each concrete subclass encodes one device family's button/axis layout as
|
|
24
|
+
* ordered arrays of {@link GamepadControl} objects. The engine selects the
|
|
25
|
+
* appropriate mapping when a gamepad connects and uses it to route raw
|
|
26
|
+
* values to the correct input channels every frame.
|
|
27
|
+
*/
|
|
15
28
|
class GamepadMapping {
|
|
29
|
+
/** Ordered list of button controls, indexed by the Gamepad API button index. */
|
|
16
30
|
buttons;
|
|
31
|
+
/** Ordered list of axis controls, indexed by the Gamepad API axis index. */
|
|
17
32
|
axes;
|
|
18
33
|
constructor(buttons, axes) {
|
|
19
34
|
this.buttons = buttons;
|
|
20
35
|
this.axes = axes;
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Releases all button and axis control references held by this mapping.
|
|
39
|
+
* Call when the associated gamepad disconnects to allow garbage collection.
|
|
40
|
+
*/
|
|
22
41
|
destroy() {
|
|
23
42
|
this.buttons.length = 0;
|
|
24
43
|
this.axes.length = 0;
|
|
25
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Converts an array of {@link GamepadControlDefinition} tuples into fully
|
|
47
|
+
* constructed {@link GamepadControl} instances.
|
|
48
|
+
* Shared factory used by all concrete mapping constructors.
|
|
49
|
+
*/
|
|
26
50
|
static createControls(definitions) {
|
|
27
51
|
return definitions.map(([index, channel, options]) => new GamepadControl(index, channel, options));
|
|
28
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamepadMapping.js","sources":["../../../../src/input/GamepadMapping.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"GamepadMapping.js","sources":["../../../../src/input/GamepadMapping.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;;;AAGG;IACS;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAC5B,IAAA,oBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC3B,IAAA,oBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC3B,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,oBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACnC,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC/B,CAAC,EAVW,oBAAoB,KAApB,oBAAoB,GAAA,EAAA,CAAA,CAAA;AAmBhC;;;;;;;;AAQG;MACmB,cAAc,CAAA;;AAKhB,IAAA,OAAO;;AAGP,IAAA,IAAI;IAEpB,WAAA,CAAsB,OAA8B,EAAE,IAA2B,EAAA;AAC7E,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IACpB;AAEA;;;AAGG;IACI,OAAO,GAAA;AACT,QAAA,IAAI,CAAC,OAAiC,CAAC,MAAM,GAAG,CAAC;AACjD,QAAA,IAAI,CAAC,IAA8B,CAAC,MAAM,GAAG,CAAC;IACnD;AAEA;;;;AAIG;IACI,OAAO,cAAc,CAAC,WAAoD,EAAA;QAC7E,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtG;AACH;;;;"}
|
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
import { GamepadChannel } from './GamepadChannels';
|
|
2
2
|
import { GamepadMappingFamily } from './GamepadMapping';
|
|
3
|
+
/**
|
|
4
|
+
* Named controls that can appear in an in-game prompt or button-hint UI.
|
|
5
|
+
*
|
|
6
|
+
* Intentionally a subset of {@link GamepadChannel} — covers the controls a
|
|
7
|
+
* typical prompt overlay needs to label, including the composite `'DPad'` token
|
|
8
|
+
* which has no single channel equivalent.
|
|
9
|
+
*/
|
|
3
10
|
export type GamepadPromptControl = 'DPad' | 'DPadUp' | 'DPadDown' | 'DPadLeft' | 'DPadRight' | 'ButtonNorth' | 'ButtonWest' | 'ButtonEast' | 'ButtonSouth' | 'LeftShoulder' | 'RightShoulder' | 'LeftTrigger' | 'RightTrigger' | 'Select' | 'Start' | 'LeftStick' | 'RightStick';
|
|
11
|
+
/**
|
|
12
|
+
* Static utility that drives in-game controller-prompt UI.
|
|
13
|
+
*
|
|
14
|
+
* Provides the canonical set of prompt controls, their normalised [x, y] positions
|
|
15
|
+
* on a generic controller silhouette, device-family label strings (e.g. "A" for
|
|
16
|
+
* Xbox, "Cross" for PlayStation, "B" for Switch), and the mapping from prompt
|
|
17
|
+
* control names to {@link GamepadChannel} values.
|
|
18
|
+
*/
|
|
4
19
|
export declare class GamepadPromptLayouts {
|
|
20
|
+
/** Complete ordered list of every {@link GamepadPromptControl} token. */
|
|
5
21
|
static readonly controls: Array<GamepadPromptControl>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the normalised [x, y] position of `control` on a generic controller
|
|
24
|
+
* silhouette, where (0, 0) is the top-left and (1, 1) the bottom-right.
|
|
25
|
+
* Falls back to [0.5, 0.5] (centre) when the control has no registered position.
|
|
26
|
+
*/
|
|
6
27
|
static getControlPosition(control: GamepadPromptControl): readonly [number, number];
|
|
28
|
+
/**
|
|
29
|
+
* Returns the label map for the given device family, e.g. `{ ButtonSouth → "A" }`
|
|
30
|
+
* for Xbox or `{ ButtonSouth → "Cross" }` for PlayStation.
|
|
31
|
+
* Falls back to generic labels when `family` has no registered label set.
|
|
32
|
+
*/
|
|
7
33
|
static getControlLabels(family: GamepadMappingFamily): ReadonlyMap<GamepadPromptControl, string>;
|
|
8
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Returns the static mapping from each {@link GamepadPromptControl} to its
|
|
36
|
+
* corresponding {@link GamepadChannel}. The composite `'DPad'` control has no
|
|
37
|
+
* channel entry and is absent from the returned map.
|
|
38
|
+
*/
|
|
39
|
+
static getControlChannelMap(): ReadonlyMap<GamepadPromptControl, GamepadChannel>;
|
|
9
40
|
}
|
|
@@ -105,7 +105,16 @@ const promptLabelsByFamily = new Map([
|
|
|
105
105
|
[GamepadMappingFamily.SteamController, genericLabels],
|
|
106
106
|
[GamepadMappingFamily.ArcadeStick, genericLabels],
|
|
107
107
|
]);
|
|
108
|
+
/**
|
|
109
|
+
* Static utility that drives in-game controller-prompt UI.
|
|
110
|
+
*
|
|
111
|
+
* Provides the canonical set of prompt controls, their normalised [x, y] positions
|
|
112
|
+
* on a generic controller silhouette, device-family label strings (e.g. "A" for
|
|
113
|
+
* Xbox, "Cross" for PlayStation, "B" for Switch), and the mapping from prompt
|
|
114
|
+
* control names to {@link GamepadChannel} values.
|
|
115
|
+
*/
|
|
108
116
|
class GamepadPromptLayouts {
|
|
117
|
+
/** Complete ordered list of every {@link GamepadPromptControl} token. */
|
|
109
118
|
static controls = [
|
|
110
119
|
'DPad',
|
|
111
120
|
'DPadUp',
|
|
@@ -125,13 +134,28 @@ class GamepadPromptLayouts {
|
|
|
125
134
|
'LeftStick',
|
|
126
135
|
'RightStick',
|
|
127
136
|
];
|
|
137
|
+
/**
|
|
138
|
+
* Returns the normalised [x, y] position of `control` on a generic controller
|
|
139
|
+
* silhouette, where (0, 0) is the top-left and (1, 1) the bottom-right.
|
|
140
|
+
* Falls back to [0.5, 0.5] (centre) when the control has no registered position.
|
|
141
|
+
*/
|
|
128
142
|
static getControlPosition(control) {
|
|
129
143
|
return basePositions.get(control) ?? [0.5, 0.5];
|
|
130
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Returns the label map for the given device family, e.g. `{ ButtonSouth → "A" }`
|
|
147
|
+
* for Xbox or `{ ButtonSouth → "Cross" }` for PlayStation.
|
|
148
|
+
* Falls back to generic labels when `family` has no registered label set.
|
|
149
|
+
*/
|
|
131
150
|
static getControlLabels(family) {
|
|
132
151
|
return promptLabelsByFamily.get(family) ?? genericLabels;
|
|
133
152
|
}
|
|
134
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Returns the static mapping from each {@link GamepadPromptControl} to its
|
|
155
|
+
* corresponding {@link GamepadChannel}. The composite `'DPad'` control has no
|
|
156
|
+
* channel entry and is absent from the returned map.
|
|
157
|
+
*/
|
|
158
|
+
static getControlChannelMap() {
|
|
135
159
|
return channelMap;
|
|
136
160
|
}
|
|
137
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamepadPromptLayouts.js","sources":["../../../../src/input/GamepadPromptLayouts.ts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"GamepadPromptLayouts.js","sources":["../../../../src/input/GamepadPromptLayouts.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AA6BA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAkD;AAC3E,IAAA,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtB,IAAA,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxB,IAAA,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC1B,IAAA,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC1B,IAAA,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,IA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AO,oBAAoB,GAAA;AAC9B,QAAA,OAAO,UAAU;IACrB;;;;;"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { GamepadMapping, GamepadMappingFamily } from './GamepadMapping';
|
|
2
|
+
/**
|
|
3
|
+
* Baseline mapping for dual-analog controllers that follow the standard
|
|
4
|
+
* W3C Gamepad API layout (axes 0–3 for both sticks, axes 4–7 auxiliary).
|
|
5
|
+
*
|
|
6
|
+
* Each signed axis is split into two directional channels — one for the
|
|
7
|
+
* negative half and one for the positive half — with the negative channel
|
|
8
|
+
* inverted so all channel values are non-negative during normal use.
|
|
9
|
+
* Device-specific subclasses (Xbox, PlayStation, Switch Pro, etc.) inherit
|
|
10
|
+
* this layout and override only {@link GamepadMapping.family}.
|
|
11
|
+
*/
|
|
2
12
|
export declare class GenericDualAnalogGamepadMapping extends GamepadMapping {
|
|
3
13
|
readonly family: GamepadMappingFamily;
|
|
4
14
|
constructor();
|
|
@@ -42,6 +42,16 @@ const genericDualAnalogAxisDefinitions = [
|
|
|
42
42
|
[7, GamepadChannel.AuxiliaryAxis3Negative, { invert: true }],
|
|
43
43
|
[7, GamepadChannel.AuxiliaryAxis3Positive],
|
|
44
44
|
];
|
|
45
|
+
/**
|
|
46
|
+
* Baseline mapping for dual-analog controllers that follow the standard
|
|
47
|
+
* W3C Gamepad API layout (axes 0–3 for both sticks, axes 4–7 auxiliary).
|
|
48
|
+
*
|
|
49
|
+
* Each signed axis is split into two directional channels — one for the
|
|
50
|
+
* negative half and one for the positive half — with the negative channel
|
|
51
|
+
* inverted so all channel values are non-negative during normal use.
|
|
52
|
+
* Device-specific subclasses (Xbox, PlayStation, Switch Pro, etc.) inherit
|
|
53
|
+
* this layout and override only {@link GamepadMapping.family}.
|
|
54
|
+
*/
|
|
45
55
|
class GenericDualAnalogGamepadMapping extends GamepadMapping {
|
|
46
56
|
family = GamepadMappingFamily.GenericDualAnalog;
|
|
47
57
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
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,sBAAsB,CAAC;CAC7C;AAED;;;;;;;;;AASG;AACG,MAAO,+BAAgC,SAAQ,cAAc,CAAA;AAC/C,IAAA,MAAM,GAAyB,oBAAoB,CAAC,iBAAiB;AAErF,IAAA,WAAA,GAAA;AACI,QAAA,KAAK,CACD,cAAc,CAAC,cAAc,CAAC,kCAAkC,CAAC,EACjE,cAAc,CAAC,cAAc,CAAC,gCAAgC,CAAC,CAClE;IACL;AACH;;;;"}
|
|
@@ -2,8 +2,17 @@ import { Vector } from '@/math/Vector';
|
|
|
2
2
|
import type { Signal } from '@/core/Signal';
|
|
3
3
|
import type { Pointer } from './Pointer';
|
|
4
4
|
/**
|
|
5
|
-
* Internal gesture recognizer
|
|
6
|
-
*
|
|
5
|
+
* Internal multi-touch gesture recognizer used by {@link InputManager}.
|
|
6
|
+
* Tracks active touch pointers, derives pinch/rotate deltas from the two
|
|
7
|
+
* primary touches, and fires long-press signals when a single pointer is
|
|
8
|
+
* held still for {@link longPressMs} (500 ms). Long-press cancels if the
|
|
9
|
+
* pointer moves beyond `distanceThreshold` pixels from the down position.
|
|
10
|
+
*
|
|
11
|
+
* The associated Signals (`onPinch`, `onRotate`, `onLongPress`) are owned
|
|
12
|
+
* by {@link InputManager} and re-exposed there as part of the public API;
|
|
13
|
+
* the recognizer just dispatches into them.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
7
16
|
*/
|
|
8
17
|
export declare class GestureRecognizer {
|
|
9
18
|
readonly onPinch: Signal<[scale: number, center: Vector]>;
|
|
@@ -3,8 +3,17 @@ import { Vector } from '../math/Vector.js';
|
|
|
3
3
|
/** Long-press threshold in milliseconds. */
|
|
4
4
|
const longPressMs = 500;
|
|
5
5
|
/**
|
|
6
|
-
* Internal gesture recognizer
|
|
7
|
-
*
|
|
6
|
+
* Internal multi-touch gesture recognizer used by {@link InputManager}.
|
|
7
|
+
* Tracks active touch pointers, derives pinch/rotate deltas from the two
|
|
8
|
+
* primary touches, and fires long-press signals when a single pointer is
|
|
9
|
+
* held still for {@link longPressMs} (500 ms). Long-press cancels if the
|
|
10
|
+
* pointer moves beyond `distanceThreshold` pixels from the down position.
|
|
11
|
+
*
|
|
12
|
+
* The associated Signals (`onPinch`, `onRotate`, `onLongPress`) are owned
|
|
13
|
+
* by {@link InputManager} and re-exposed there as part of the public API;
|
|
14
|
+
* the recognizer just dispatches into them.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
8
17
|
*/
|
|
9
18
|
class GestureRecognizer {
|
|
10
19
|
onPinch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureRecognizer.js","sources":["../../../../src/input/GestureRecognizer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;AACA,MAAM,WAAW,GAAG,GAAG;AAUvB
|
|
1
|
+
{"version":3,"file":"GestureRecognizer.js","sources":["../../../../src/input/GestureRecognizer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;AACA,MAAM,WAAW,GAAG,GAAG;AAUvB;;;;;;;;;;;;AAYG;MACU,iBAAiB,CAAA;AACV,IAAA,OAAO;AACP,IAAA,QAAQ;AACR,IAAA,WAAW;AAEV,IAAA,iBAAiB;;AAGjB,IAAA,aAAa,GAAyB,IAAI,GAAG,EAAE;;AAG/C,IAAA,gBAAgB,GAAgC,IAAI,GAAG,EAAE;;IAGlE,YAAY,GAAG,EAAE;IACjB,SAAS,GAAG,CAAC;;AAGJ,IAAA,SAAS,GAAG,IAAI,MAAM,EAAE;AAEzC,IAAA,WAAA,CACI,iBAAyB,EACzB,OAAgD,EAChD,QAAsD,EACtD,WAAuC,EAAA;AAEvC,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB;AAC1C,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;AACtB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;IAClC;AAEO,IAAA,aAAa,CAAC,OAAgB,EAAA;AACjC,QAAA,IAAI,O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UAAU,GAAG,YAAY,GAAG,IAAI,CAAC,SAAS;YAEhD,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE;gBAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;YACtD;QACJ;AAEA,QAAA,IAAI,CAAC,YAAY,GAAG,eAAe;AACnC,QAAA,IAAI,CAAC,SAAS,GAAG,YAAY;IACjC;AACH;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Signal } from '@/core/Signal';
|
|
2
2
|
import type { Keyboard } from '@/input/types';
|
|
3
3
|
import type { GamepadChannel } from './GamepadChannels';
|
|
4
|
+
/** Convenience options accepted by the {@link Input} constructor. */
|
|
4
5
|
interface InputOptions {
|
|
5
6
|
onStart?: () => void;
|
|
6
7
|
onStop?: () => void;
|
|
@@ -9,7 +10,25 @@ interface InputOptions {
|
|
|
9
10
|
context?: object;
|
|
10
11
|
threshold?: number;
|
|
11
12
|
}
|
|
13
|
+
/** Union of channel identifiers an {@link Input} can subscribe to. */
|
|
12
14
|
export type InputChannel = GamepadChannel | Keyboard;
|
|
15
|
+
/**
|
|
16
|
+
* Bind one or more input channels (keyboard keys, gamepad buttons, gamepad
|
|
17
|
+
* axes) to a set of high-level events: `onStart` (became active),
|
|
18
|
+
* `onStop` (became inactive), `onActive` (per-frame while active), and
|
|
19
|
+
* `onTrigger` (released within the threshold window — a "tap"). The current
|
|
20
|
+
* raw value is the max across all subscribed channels.
|
|
21
|
+
*
|
|
22
|
+
* Construct ad-hoc, or via {@link InputManager.add}. Driven by the
|
|
23
|
+
* {@link InputManager} update loop which feeds the unified channel buffer.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const jump = new Input([Keyboard.Space, GamepadChannel.FaceA], {
|
|
28
|
+
* onTrigger: () => player.jump(),
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
13
32
|
export declare class Input {
|
|
14
33
|
static triggerThreshold: number;
|
|
15
34
|
private readonly channels;
|
|
@@ -22,6 +41,11 @@ export declare class Input {
|
|
|
22
41
|
constructor(channels: Array<InputChannel> | InputChannel, { onStart, onStop, onActive, onTrigger, context, threshold }?: InputOptions);
|
|
23
42
|
get activeChannels(): Set<number>;
|
|
24
43
|
get value(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Read the latest values from the unified channel buffer and dispatch
|
|
46
|
+
* the appropriate Signals. Called once per frame by {@link InputManager}.
|
|
47
|
+
* No-op for inputs not bound to any channel.
|
|
48
|
+
*/
|
|
25
49
|
update(channels: Float32Array): this;
|
|
26
50
|
destroy(): void;
|
|
27
51
|
}
|