@ue-too/board 0.5.1 → 0.5.2
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/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify/index.js +475 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/base.js +340 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/base.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/animation-and-lock.js +88 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/animation-and-lock.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/index.js +5 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/pan-control-state-machine.js +157 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/pan-control-state-machine.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/rotation-control-state-machine.js +151 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/rotation-control-state-machine.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/zoom-control-state-machine.js +153 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/zoom-control-state-machine.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/index.js +4 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/interface.js +2 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/interface.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/relay.js +38 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/relay.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/camera-rig.js +454 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/camera-rig.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/index.js +6 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/pan-handler.js +124 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/pan-handler.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/rotation-handler.js +71 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/rotation-handler.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/index.js +4 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/position-update-batcher.js +97 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/position-update-batcher.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/rotation-update-batcher.js +91 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/rotation-update-batcher.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.js +128 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/zoom-handler.js +76 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/zoom-handler.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/default-camera.js +258 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/default-camera.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/index.js +9 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/interface.js +2 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/interface.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/update-publisher.js +74 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/update-publisher.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/coordinate-conversion.js +150 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/coordinate-conversion.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/index.js +6 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/matrix.js +421 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/matrix.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/position.js +177 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/position.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/rotation.js +122 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/rotation.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/zoom.js +46 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/zoom.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.js +6 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/index.js +4 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/index.js +5 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-context.js +191 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-context.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-state-machine.js +342 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-state-machine.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-context.js +62 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-context.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-state-machine.js +173 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-state-machine.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/index.js +3 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.js +123 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.js +118 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/index.js +2 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/raw-input-publisher.js +99 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/raw-input-publisher.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/canvas-position-dimension.js +184 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/canvas-position-dimension.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/coorindate-conversion.js +10 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/coorindate-conversion.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing-utils.js +450 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing-utils.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing.js +192 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/handler-pipeline.js +27 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/handler-pipeline.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/index.js +9 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/observable.js +47 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/observable.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/ruler.js +21 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/ruler.js.map +1 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/zoomlevel-adjustment.js +102 -0
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/zoomlevel-adjustment.js.map +1 -0
- package/dist/board.tsbuildinfo +1 -0
- package/dist/boardify/index.d.ts +192 -0
- package/dist/camera/base.d.ts +189 -0
- package/dist/camera/camera-mux/animation-and-lock/animation-and-lock.d.ts +50 -0
- package/dist/camera/camera-mux/animation-and-lock/index.d.ts +4 -0
- package/dist/camera/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +137 -0
- package/dist/camera/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +131 -0
- package/dist/camera/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +143 -0
- package/dist/camera/camera-mux/index.d.ts +3 -0
- package/dist/camera/camera-mux/interface.d.ts +12 -0
- package/dist/camera/camera-mux/relay.d.ts +27 -0
- package/dist/camera/camera-rig/camera-rig.d.ts +207 -0
- package/dist/camera/camera-rig/index.d.ts +5 -0
- package/dist/camera/camera-rig/pan-handler.d.ts +113 -0
- package/dist/camera/camera-rig/rotation-handler.d.ts +78 -0
- package/dist/camera/camera-rig/update-batcher/index.d.ts +3 -0
- package/dist/camera/camera-rig/update-batcher/position-update-batcher.d.ts +58 -0
- package/dist/camera/camera-rig/update-batcher/rotation-update-batcher.d.ts +54 -0
- package/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +60 -0
- package/dist/camera/camera-rig/zoom-handler.d.ts +77 -0
- package/dist/camera/default-camera.d.ts +170 -0
- package/dist/camera/index.d.ts +8 -0
- package/dist/camera/interface.d.ts +59 -0
- package/dist/camera/update-publisher.d.ts +172 -0
- package/dist/camera/utils/coordinate-conversion.d.ts +75 -0
- package/dist/camera/utils/index.d.ts +5 -0
- package/dist/camera/utils/matrix.d.ts +114 -0
- package/dist/camera/utils/position.d.ts +71 -0
- package/dist/camera/utils/rotation.d.ts +64 -0
- package/dist/camera/utils/zoom.d.ts +25 -0
- package/dist/index.d.ts +5 -0
- package/dist/input-interpretation/index.d.ts +3 -0
- package/dist/input-interpretation/input-state-machine/index.d.ts +4 -0
- package/dist/input-interpretation/input-state-machine/kmt-input-context.d.ts +130 -0
- package/dist/input-interpretation/input-state-machine/kmt-input-state-machine.d.ts +194 -0
- package/dist/input-interpretation/input-state-machine/touch-input-context.d.ts +44 -0
- package/dist/input-interpretation/input-state-machine/touch-input-state-machine.d.ts +64 -0
- package/dist/input-interpretation/raw-input-parser/index.d.ts +2 -0
- package/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.d.ts +87 -0
- package/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.d.ts +55 -0
- package/dist/input-interpretation/raw-input-publisher/index.d.ts +1 -0
- package/dist/input-interpretation/raw-input-publisher/raw-input-publisher.d.ts +130 -0
- package/dist/package.json +39 -0
- package/dist/utils/canvas-position-dimension.d.ts +18 -0
- package/dist/utils/coorindate-conversion.d.ts +5 -0
- package/dist/utils/drawing-utils.d.ts +55 -0
- package/dist/utils/drawing.d.ts +30 -0
- package/dist/utils/handler-pipeline.d.ts +30 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/observable.d.ts +9 -0
- package/dist/utils/ruler.d.ts +1 -0
- package/dist/utils/zoomlevel-adjustment.d.ts +28 -0
- package/jest.config.js +18 -0
- package/package.json +11 -10
- package/project.json +34 -0
- package/rollup.config.js +29 -0
- package/src/boardify/index.ts +562 -0
- package/src/camera/base.ts +387 -0
- package/src/camera/camera-mux/animation-and-lock/animation-and-lock.ts +114 -0
- package/src/camera/camera-mux/animation-and-lock/index.ts +4 -0
- package/src/camera/camera-mux/animation-and-lock/pan-control-state-machine.ts +248 -0
- package/src/camera/camera-mux/animation-and-lock/rotation-control-state-machine.ts +237 -0
- package/src/camera/camera-mux/animation-and-lock/zoom-control-state-machine.ts +263 -0
- package/src/camera/camera-mux/index.ts +3 -0
- package/src/camera/camera-mux/interface.ts +13 -0
- package/src/camera/camera-mux/relay.ts +50 -0
- package/src/camera/camera-rig/camera-rig.ts +560 -0
- package/src/camera/camera-rig/index.ts +5 -0
- package/src/camera/camera-rig/pan-handler.ts +192 -0
- package/src/camera/camera-rig/rotation-handler.ts +124 -0
- package/src/camera/camera-rig/update-batcher/index.ts +3 -0
- package/src/camera/camera-rig/update-batcher/position-update-batcher.ts +133 -0
- package/src/camera/camera-rig/update-batcher/rotation-update-batcher.ts +123 -0
- package/src/camera/camera-rig/update-batcher/zoom-udpate-batcher.ts +157 -0
- package/src/camera/camera-rig/zoom-handler.ts +123 -0
- package/src/camera/default-camera.ts +297 -0
- package/src/camera/index.ts +8 -0
- package/src/camera/interface.ts +45 -0
- package/src/camera/update-publisher.ts +222 -0
- package/src/camera/utils/coordinate-conversion.ts +160 -0
- package/src/camera/utils/index.ts +5 -0
- package/src/camera/utils/matrix.ts +558 -0
- package/src/camera/utils/position.ts +196 -0
- package/src/camera/utils/rotation.ts +147 -0
- package/src/camera/utils/zoom.ts +55 -0
- package/src/index.ts +5 -0
- package/src/input-interpretation/index.ts +3 -0
- package/src/input-interpretation/input-state-machine/index.ts +4 -0
- package/src/input-interpretation/input-state-machine/kmt-input-context.ts +283 -0
- package/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts +491 -0
- package/src/input-interpretation/input-state-machine/touch-input-context.ts +106 -0
- package/src/input-interpretation/input-state-machine/touch-input-state-machine.ts +215 -0
- package/src/input-interpretation/raw-input-parser/index.ts +2 -0
- package/src/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.ts +207 -0
- package/src/input-interpretation/raw-input-parser/vanilla-touch-event-parser.ts +169 -0
- package/src/input-interpretation/raw-input-publisher/index.ts +1 -0
- package/src/input-interpretation/raw-input-publisher/raw-input-publisher.ts +227 -0
- package/src/utils/canvas-position-dimension.ts +215 -0
- package/src/utils/coorindate-conversion.ts +12 -0
- package/src/utils/drawing-utils.ts +439 -0
- package/src/utils/drawing.ts +266 -0
- package/src/utils/handler-pipeline.ts +41 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/observable.ts +63 -0
- package/src/utils/ruler.ts +18 -0
- package/src/utils/zoomlevel-adjustment.ts +108 -0
- package/test/board-camera/camera-rig.test.ts +78 -0
- package/test/board-camera/camera-utils.test.ts +263 -0
- package/test/board-camera/utils/coordinate-conversion.test.ts +26 -0
- package/test/board-camera/utils/matrix.test.ts +35 -0
- package/test/boardify/utils/canvas.test.ts +20 -0
- package/test/util/drawing.test.ts +83 -0
- package/test/util/handler-pipeline.test.ts +74 -0
- package/test/util/observable.test.ts +42 -0
- package/test/util/ruler.test.ts +41 -0
- package/tsconfig.json +23 -0
- package/tsconfig.spec.json +12 -0
- /package/{board.tsbuildinfo → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/board.tsbuildinfo} +0 -0
- /package/{boardify → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify}/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/base.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/animation-and-lock/animation-and-lock.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/animation-and-lock/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/interface.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-mux/relay.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/camera-rig.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/pan-handler.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/rotation-handler.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/update-batcher/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/update-batcher/position-update-batcher.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/update-batcher/rotation-update-batcher.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/camera-rig/zoom-handler.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/default-camera.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/interface.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/update-publisher.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/coordinate-conversion.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/index.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/matrix.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/position.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/rotation.d.ts +0 -0
- /package/{camera → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera}/utils/zoom.d.ts +0 -0
- /package/{index.d.ts → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.d.ts} +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/index.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/input-state-machine/index.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/input-state-machine/kmt-input-context.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/input-state-machine/kmt-input-state-machine.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/input-state-machine/touch-input-context.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/input-state-machine/touch-input-state-machine.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/raw-input-parser/index.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/raw-input-parser/vanilla-kmt-event-parser.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/raw-input-parser/vanilla-touch-event-parser.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/raw-input-publisher/index.d.ts +0 -0
- /package/{input-interpretation → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation}/raw-input-publisher/raw-input-publisher.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/canvas-position-dimension.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/coorindate-conversion.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/drawing-utils.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/drawing.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/handler-pipeline.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/index.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/observable.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/ruler.d.ts +0 -0
- /package/{utils → .rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils}/zoomlevel-adjustment.d.ts +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{index.js.map → dist/index.js.map} +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { withinBoundaries, normalizeAngleZero2TwoPI, angleSpan, convert2WorldSpace, invertFromWorldSpace, convert2WorldSpaceAnchorAtCenter, convert2ViewPortSpaceAnchorAtCenter, transformationMatrixFromCamera, convert2WorldSpaceWithTransformationMatrix } from "../../src/camera";
|
|
2
|
+
import { clampRotation, RotationLimits, rotationWithinBoundary, RotationBoundary, rotationWithinLimits } from "../../src/camera/utils/rotation";
|
|
3
|
+
|
|
4
|
+
import { Boundaries, halfTranslationWidthOf, translationWidthOf, translationHeightOf, halfTranslationHeightOf } from "../../src/camera/utils/position";
|
|
5
|
+
|
|
6
|
+
describe("withinBoundaries", () => {
|
|
7
|
+
|
|
8
|
+
test("should return true if no boundaries", () => {
|
|
9
|
+
expect(withinBoundaries({x: 0, y: 0}, undefined)).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("should return true if point is within boundaries", () => {
|
|
13
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: -1, y: -1}, max: {x: 1, y: 1}})).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("should return false if point is outside boundaries", () => {
|
|
17
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: 1, y: 1}, max: {x: 2, y: 2}})).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("should still work if only one boundary is defined", () => {
|
|
21
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: -1, y: -1}})).toBe(true);
|
|
22
|
+
expect(withinBoundaries({x: 0, y: 0}, {max: {x: 1, y: 1}})).toBe(true);
|
|
23
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: 1, y: 1}})).toBe(false);
|
|
24
|
+
expect(withinBoundaries({x: 0, y: 0}, {max: {x: -1, y: -1}})).toBe(false);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("should still work if only one axis is defined", () => {
|
|
28
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: -1}})).toBe(true);
|
|
29
|
+
expect(withinBoundaries({x: 0, y: 0}, {max: {x: 1}})).toBe(true);
|
|
30
|
+
expect(withinBoundaries({x: 0, y: 0}, {min: {x: 1}})).toBe(false);
|
|
31
|
+
expect(withinBoundaries({x: 0, y: 0}, {max: {x: -1}})).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("rotation boundaries testing", ()=>{
|
|
37
|
+
test("should return true if the rotation is within the boundaries", ()=>{
|
|
38
|
+
const rotationBoundaries: RotationBoundary = {start: 0, end: Math.PI, positiveDirection: true, startAsTieBreaker: true};
|
|
39
|
+
expect(rotationWithinBoundary(0, rotationBoundaries)).toBe(true);
|
|
40
|
+
expect(rotationWithinBoundary(Math.PI, rotationBoundaries)).toBe(true);
|
|
41
|
+
expect(rotationWithinBoundary(Math.PI / 2, rotationBoundaries)).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("should return false if the rotation is outside the boundaries", ()=>{
|
|
45
|
+
const rotationBoundaries: RotationBoundary = {start: 0, end: Math.PI, positiveDirection: true, startAsTieBreaker: true};
|
|
46
|
+
expect(rotationWithinBoundary(-Math.PI / 2, rotationBoundaries)).toBe(false);
|
|
47
|
+
expect(rotationWithinBoundary(Math.PI * 3 / 2, rotationBoundaries)).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("should still work if the boundaries cross the 0 degree mark", ()=>{
|
|
51
|
+
const rotationBoundaries: RotationBoundary = {start: (360 - 45) * Math.PI / 180, end: 45 * Math.PI / 180, positiveDirection: true, startAsTieBreaker: true};
|
|
52
|
+
expect(rotationWithinBoundary(0, rotationBoundaries)).toBe(true);
|
|
53
|
+
expect(rotationWithinBoundary(50 * Math.PI / 180, rotationBoundaries)).toBe(false);
|
|
54
|
+
expect(rotationWithinBoundary(330 * Math.PI / 180, rotationBoundaries)).toBe(true);
|
|
55
|
+
expect(rotationWithinBoundary(300 * Math.PI / 180, rotationBoundaries)).toBe(false);
|
|
56
|
+
expect(rotationWithinBoundary(-50 * Math.PI / 180, rotationBoundaries)).toBe(false);
|
|
57
|
+
expect(rotationWithinBoundary(315 * Math.PI / 180, rotationBoundaries)).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("should return false if the rotation is outside the boundaries", ()=>{
|
|
61
|
+
const rotationBoundaries: RotationBoundary = {start: (360 - 45) * Math.PI / 180, end: 45 * Math.PI / 180, positiveDirection: true, startAsTieBreaker: true};
|
|
62
|
+
expect(rotationWithinBoundary(50 * Math.PI / 180, rotationBoundaries)).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("should return true for a full revolution boundary", ()=>{
|
|
66
|
+
const rotationBoundaries: RotationBoundary = {start: 0, end: Math.PI * 2, positiveDirection: true, startAsTieBreaker: true};
|
|
67
|
+
expect(rotationWithinBoundary(0, rotationBoundaries)).toBe(true);
|
|
68
|
+
expect(rotationWithinBoundary(Math.PI * 2, rotationBoundaries)).toBe(true);
|
|
69
|
+
expect(rotationWithinBoundary(1, rotationBoundaries)).toBe(true);
|
|
70
|
+
expect(rotationWithinBoundary(Math.PI * 2 - 1, rotationBoundaries)).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("rotationLimits", ()=>{
|
|
75
|
+
test("should return true if the rotation is within the boundaries", ()=>{
|
|
76
|
+
const rotationLimits: RotationLimits = {start: 0, end: Math.PI, ccw: true, startAsTieBreaker: true};
|
|
77
|
+
expect(rotationWithinLimits(0, rotationLimits)).toBe(true);
|
|
78
|
+
expect(rotationWithinLimits(Math.PI, rotationLimits)).toBe(true);
|
|
79
|
+
expect(rotationWithinLimits(Math.PI / 2, rotationLimits)).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("should return false if the rotation is outside the boundaries", ()=>{
|
|
83
|
+
const rotationLimits: RotationLimits = {start: 0, end: Math.PI, ccw: true, startAsTieBreaker: true};
|
|
84
|
+
expect(rotationWithinLimits(-Math.PI / 2, rotationLimits)).toBe(false);
|
|
85
|
+
expect(rotationWithinLimits(Math.PI * 3 / 2, rotationLimits)).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("should still work if the boundaries cross the 0 degree mark", ()=>{
|
|
89
|
+
const rotationLimits: RotationLimits = {start: (360 - 45) * Math.PI / 180, end: 45 * Math.PI / 180, ccw: true, startAsTieBreaker: true};
|
|
90
|
+
expect(rotationWithinLimits(0, rotationLimits)).toBe(true);
|
|
91
|
+
expect(rotationWithinLimits(50 * Math.PI / 180, rotationLimits)).toBe(false);
|
|
92
|
+
expect(rotationWithinLimits(330 * Math.PI / 180, rotationLimits)).toBe(true);
|
|
93
|
+
expect(rotationWithinLimits(300 * Math.PI / 180, rotationLimits)).toBe(false);
|
|
94
|
+
expect(rotationWithinLimits(-50 * Math.PI / 180, rotationLimits)).toBe(false);
|
|
95
|
+
expect(rotationWithinLimits(315 * Math.PI / 180, rotationLimits)).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("should return false if the rotation is outside the boundaries", ()=>{
|
|
99
|
+
const rotationLimits: RotationLimits = {start: (360 - 45) * Math.PI / 180, end: 45 * Math.PI / 180, ccw: true, startAsTieBreaker: true};
|
|
100
|
+
expect(rotationWithinLimits(50 * Math.PI / 180, rotationLimits)).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("should return true for a full revolution limit", ()=>{
|
|
104
|
+
const rotationLimits: RotationLimits = {start: 0, end: Math.PI * 2, ccw: true, startAsTieBreaker: true};
|
|
105
|
+
expect(rotationWithinLimits(0, rotationLimits)).toBe(true);
|
|
106
|
+
expect(rotationWithinLimits(Math.PI * 2, rotationLimits)).toBe(true);
|
|
107
|
+
expect(rotationWithinLimits(Math.PI * 2 + 1, rotationLimits)).toBe(true);
|
|
108
|
+
expect(rotationWithinLimits(Math.PI * 2 - 1, rotationLimits)).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("get the translation dimensions from boundaries", () => {
|
|
113
|
+
|
|
114
|
+
test("translation width from boundaries", ()=>{
|
|
115
|
+
let boundaries: Boundaries | undefined = undefined;
|
|
116
|
+
|
|
117
|
+
expect(translationWidthOf(boundaries)).toBe(undefined);
|
|
118
|
+
boundaries = {min: {x: 0}, max: {x: 10}};
|
|
119
|
+
expect(translationWidthOf(boundaries)).toBe(10);
|
|
120
|
+
expect(halfTranslationWidthOf(boundaries)).toBe(5);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("translation height from boundaries", ()=>{
|
|
124
|
+
let boundaries: Boundaries | undefined = undefined;
|
|
125
|
+
|
|
126
|
+
expect(translationHeightOf(boundaries)).toBe(undefined);
|
|
127
|
+
boundaries = {min: {y: 0}, max: {y: 10}};
|
|
128
|
+
expect(translationHeightOf(boundaries)).toBe(10);
|
|
129
|
+
expect(halfTranslationHeightOf(boundaries)).toBe(5);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe("normalizeAngleZero2TwoPI", () => {
|
|
135
|
+
test("should return the same angle if it is already between 0 and 2PI", () => {
|
|
136
|
+
expect(normalizeAngleZero2TwoPI(0)).toBe(0);
|
|
137
|
+
expect(normalizeAngleZero2TwoPI(Math.PI)).toBe(Math.PI);
|
|
138
|
+
expect(normalizeAngleZero2TwoPI(Math.PI * 2)).toBe(0);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("should return the normalized angle if it is not between 0 and 2PI", () => {
|
|
142
|
+
expect(normalizeAngleZero2TwoPI(-45 * Math.PI / 180)).toBeCloseTo(315 * Math.PI / 180);
|
|
143
|
+
expect(normalizeAngleZero2TwoPI(-Math.PI)).toBe(Math.PI);
|
|
144
|
+
expect(normalizeAngleZero2TwoPI(-Math.PI * 2)).toBe(0);
|
|
145
|
+
expect(normalizeAngleZero2TwoPI(Math.PI * 3)).toBe(Math.PI);
|
|
146
|
+
expect(normalizeAngleZero2TwoPI(Math.PI * 4)).toBe(0);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe("angle clamping", ()=>{
|
|
151
|
+
|
|
152
|
+
test("should return the same angle if it is within the limits", ()=>{
|
|
153
|
+
const limits:RotationLimits = {start: 0, end: Math.PI, ccw: true, startAsTieBreaker: true};
|
|
154
|
+
expect(clampRotation(0, limits)).toBe(0);
|
|
155
|
+
expect(clampRotation(Math.PI, limits)).toBe(Math.PI);
|
|
156
|
+
expect(clampRotation(Math.PI / 2, limits)).toBe(Math.PI / 2);
|
|
157
|
+
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("should return the clamped angle if out of limits with tie", ()=>{
|
|
161
|
+
const limits:RotationLimits = {start: 0, end: Math.PI, ccw: true, startAsTieBreaker: true};
|
|
162
|
+
expect(clampRotation(-Math.PI / 2, limits)).toBe(0);
|
|
163
|
+
expect(clampRotation(Math.PI * 3 / 2, limits)).toBeCloseTo(0);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("counter-clockwise rotation limits crossing the 0 degree mark", ()=>{
|
|
167
|
+
const limits: RotationLimits = {start: (360 - 45) * Math.PI / 180, end: 45 * Math.PI / 180, ccw: true, startAsTieBreaker: true};
|
|
168
|
+
expect(clampRotation(0, limits)).toBe(0);
|
|
169
|
+
expect(clampRotation(50 * Math.PI / 180, limits)).toBe(45 * Math.PI / 180);
|
|
170
|
+
expect(clampRotation(330 * Math.PI / 180, limits)).toBeCloseTo(330 * Math.PI / 180);
|
|
171
|
+
expect(clampRotation(300 * Math.PI / 180, limits)).toBe(315 * Math.PI / 180);
|
|
172
|
+
expect(clampRotation(-50 * Math.PI / 180, limits)).toBe(315 * Math.PI / 180);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("clockwise rotation limits crossing the 0 degree mark", ()=>{
|
|
176
|
+
const limits: RotationLimits = {start: 45 * Math.PI / 180, end: 315 * Math.PI / 180, ccw: false, startAsTieBreaker: true};
|
|
177
|
+
expect(clampRotation(0, limits)).toBe(0);
|
|
178
|
+
expect(clampRotation(50 * Math.PI / 180, limits)).toBe(45 * Math.PI / 180);
|
|
179
|
+
expect(clampRotation(-50 * Math.PI / 180, limits)).toBe(315 * Math.PI / 180);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe("calculate the minimum angle span from an angle to another", () => {
|
|
185
|
+
|
|
186
|
+
test("a full revolution meaning no angle span", () => {
|
|
187
|
+
expect(angleSpan(0, Math.PI * 2)).toBe(0);
|
|
188
|
+
expect(angleSpan(0, -Math.PI * 2)).toBe(0);
|
|
189
|
+
expect(angleSpan(Math.PI * 2, Math.PI * 4)).toBe(0);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("testing the angle span between 0 and 90 degrees", ()=>{
|
|
193
|
+
expect(angleSpan(0, Math.PI / 2)).toBe(Math.PI / 2);
|
|
194
|
+
expect(angleSpan(-Math.PI / 2, 0)).toBe(Math.PI / 2);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test("testing the angle span that rotating clockwise is smaller than rotating counter clockwise", ()=>{
|
|
198
|
+
expect(angleSpan(0, 270 * Math.PI / 180)).toBeCloseTo(-90 * Math.PI / 180);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test("testing the angle span that cross the 0 degree mark", ()=>{
|
|
202
|
+
expect(angleSpan(22.5 * Math.PI / 180, -22.5 * Math.PI / 180)).toBeCloseTo(- 45 * Math.PI / 180);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe("coordinate conversion", () => {
|
|
207
|
+
test("Convert point within camera view to world space", ()=>{
|
|
208
|
+
const testRes = convert2WorldSpace({x: 100, y: 100}, 1000, 1000, {x: 30, y: 50}, 10, -45 * Math.PI / 180);
|
|
209
|
+
expect(testRes.x).toBeCloseTo(30 - (800 / (Math.sqrt(2) * 10)));
|
|
210
|
+
expect(testRes.y).toBeCloseTo(50);
|
|
211
|
+
const testRes2 = convert2WorldSpace({x: 100, y: 100}, 1000, 1000, {x: 10, y: 10}, 1, 0);
|
|
212
|
+
expect(testRes2.x).toBeCloseTo(-390);
|
|
213
|
+
expect(testRes2.y).toBeCloseTo(-390);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("Convert point within camera view to world space with the camera position as view port origin", ()=>{
|
|
217
|
+
const testRes = convert2WorldSpaceAnchorAtCenter({x: -400, y: -400}, {x: 30, y: 50}, 10, -45 * Math.PI / 180);
|
|
218
|
+
expect(testRes.x).toBeCloseTo(30 - (800 / (Math.sqrt(2) * 10)));
|
|
219
|
+
expect(testRes.y).toBeCloseTo(50);
|
|
220
|
+
const testRes2 = convert2WorldSpaceAnchorAtCenter({x: -400, y: -400}, {x: 10, y: 10}, 1, 0);
|
|
221
|
+
expect(testRes2.x).toBeCloseTo(-390);
|
|
222
|
+
expect(testRes2.y).toBeCloseTo(-390);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("Convert point within world space to camera view", ()=>{
|
|
226
|
+
const point = {x: 10, y: 30};
|
|
227
|
+
const cameraCenterInViewPort = {x: 500, y: 500};
|
|
228
|
+
const testRes = invertFromWorldSpace(point, 1000, 1000, {x: 30, y: 50}, 1, 0);
|
|
229
|
+
expect(testRes.x).toBeCloseTo(cameraCenterInViewPort.x - 20);
|
|
230
|
+
expect(testRes.y).toBeCloseTo(cameraCenterInViewPort.y - 20);
|
|
231
|
+
const test2Point = {x: 10, y: 50};
|
|
232
|
+
const testRes2 = invertFromWorldSpace(test2Point, 1000, 1000, {x: 30, y: 50}, 1, -45 * Math.PI / 180);
|
|
233
|
+
const expectedRes = {x: 500 - 20 / Math.sqrt(2), y: 500 - 20 / Math.sqrt(2)};
|
|
234
|
+
expect(testRes2.x).toBeCloseTo(expectedRes.x);
|
|
235
|
+
expect(testRes2.y).toBeCloseTo(expectedRes.y);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test("Convert point within world space to camera view with camera position as viewport origin", ()=>{
|
|
239
|
+
const point = {x: 10, y: 30};
|
|
240
|
+
const testRes = convert2ViewPortSpaceAnchorAtCenter(point, {x: 30, y: 50}, 1, 0);
|
|
241
|
+
expect(testRes.x).toBeCloseTo(-20);
|
|
242
|
+
expect(testRes.y).toBeCloseTo(-20);
|
|
243
|
+
const test2Point = {x: 10, y: 50};
|
|
244
|
+
const testRes2 = convert2ViewPortSpaceAnchorAtCenter(test2Point, {x: 30, y: 50}, 1, -45 * Math.PI / 180);
|
|
245
|
+
const expectedRes = {x: - 20 / Math.sqrt(2), y: - 20 / Math.sqrt(2)};
|
|
246
|
+
expect(testRes2.x).toBeCloseTo(expectedRes.x);
|
|
247
|
+
expect(testRes2.y).toBeCloseTo(expectedRes.y);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
describe('coorindate conversion using transformation matrix', ()=>{
|
|
251
|
+
test("should convert point within world space to camera view", ()=>{
|
|
252
|
+
const point = {x: -400, y: -400};
|
|
253
|
+
const transformationMatrix = transformationMatrixFromCamera({x: 30, y: 50}, 10, -45 * Math.PI / 180);
|
|
254
|
+
const testRes = convert2WorldSpaceWithTransformationMatrix(point, transformationMatrix);
|
|
255
|
+
expect(testRes.x).toBeCloseTo(30 - (800 / (Math.sqrt(2) * 10)));
|
|
256
|
+
expect(testRes.y).toBeCloseTo(50);
|
|
257
|
+
const transformationMatrix2 = transformationMatrixFromCamera({x: 10, y: 10}, 1, 0);
|
|
258
|
+
const testRes2 = convert2WorldSpaceWithTransformationMatrix(point, transformationMatrix2);
|
|
259
|
+
expect(testRes2.x).toBeCloseTo(-390);
|
|
260
|
+
expect(testRes2.y).toBeCloseTo(-390);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { convertDeltaInViewPortToWorldSpace, convertDeltaInWorldToViewPortSpace } from "../../../src/camera/utils/coordinate-conversion";
|
|
2
|
+
|
|
3
|
+
const testcases = [
|
|
4
|
+
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
describe("convertDeltaInWorldToViewPortSpace", ()=>{
|
|
8
|
+
it("should convert delta in world space to view port space", ()=>{
|
|
9
|
+
const delta = {x: -7.071067811865475, y: 7.071067811865475};
|
|
10
|
+
const cameraZoomLevel = 1;
|
|
11
|
+
const cameraRotation = 45 * Math.PI / 180;
|
|
12
|
+
const result = convertDeltaInWorldToViewPortSpace(delta, cameraZoomLevel, cameraRotation);
|
|
13
|
+
expect(result.x).toBeCloseTo(0);
|
|
14
|
+
expect(result.y).toBeCloseTo(10);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should convert delta in view port space to world space", ()=>{
|
|
18
|
+
const delta = {x: 0, y: 10};
|
|
19
|
+
const cameraZoomLevel = 1;
|
|
20
|
+
const cameraRotation = 45 * Math.PI / 180;
|
|
21
|
+
const result = convertDeltaInViewPortToWorldSpace(delta, cameraZoomLevel, cameraRotation);
|
|
22
|
+
expect(result.x).toBeCloseTo(-7.071067811865475);
|
|
23
|
+
expect(result.y).toBeCloseTo(7.071067811865475);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createCameraMatrix, decomposeCameraMatrix } from "../../../src/camera/utils/matrix";
|
|
2
|
+
|
|
3
|
+
describe("matrix operations", ()=>{
|
|
4
|
+
it("should decompose the matrix correctly", ()=>{
|
|
5
|
+
const originalCamera = {
|
|
6
|
+
position: { x: 100, y: 50 },
|
|
7
|
+
zoom: 2.0,
|
|
8
|
+
rotation: Math.PI / 6 // 30 degrees
|
|
9
|
+
};
|
|
10
|
+
const devicePixelRatio = 1.5;
|
|
11
|
+
const canvasWidth = 800;
|
|
12
|
+
const canvasHeight = 600;
|
|
13
|
+
|
|
14
|
+
const matrix = createCameraMatrix(
|
|
15
|
+
originalCamera.position,
|
|
16
|
+
originalCamera.zoom,
|
|
17
|
+
originalCamera.rotation,
|
|
18
|
+
devicePixelRatio,
|
|
19
|
+
canvasWidth,
|
|
20
|
+
canvasHeight
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const decomposed = decomposeCameraMatrix(
|
|
24
|
+
matrix,
|
|
25
|
+
devicePixelRatio,
|
|
26
|
+
canvasWidth,
|
|
27
|
+
canvasHeight
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
expect(decomposed.position.x).toBeCloseTo(originalCamera.position.x);
|
|
31
|
+
expect(decomposed.position.y).toBeCloseTo(originalCamera.position.y);
|
|
32
|
+
expect(decomposed.zoom).toBeCloseTo(originalCamera.zoom);
|
|
33
|
+
expect(decomposed.rotation).toBeCloseTo(originalCamera.rotation);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { invertYAxisForDrawImageWith9Args } from "../../../src/utils";
|
|
2
|
+
|
|
3
|
+
// Mock Image class for testing
|
|
4
|
+
class MockImage {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
constructor(width: number, height: number) {
|
|
8
|
+
this.width = width;
|
|
9
|
+
this.height = height;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe("canvas", () => {
|
|
14
|
+
it("should invert the y-axis for drawImage with 9 arguments", () => {
|
|
15
|
+
const image = new MockImage(1200, 1500);
|
|
16
|
+
const args = [image, 0, 0, 300, 300, 200, 200, 300, 300];
|
|
17
|
+
const newArgs = invertYAxisForDrawImageWith9Args(args);
|
|
18
|
+
expect(newArgs).toEqual([image, 0, 1500, 300, -300, 200, -500, 300, 300]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { calculateTickValues } from '../../src/utils/drawing';
|
|
2
|
+
|
|
3
|
+
describe('calculateTickValues', () => {
|
|
4
|
+
it('should calculate correct tick values for a basic range', () => {
|
|
5
|
+
const result = calculateTickValues(0, 100);
|
|
6
|
+
|
|
7
|
+
expect(result.minMajorTickValue).toBe(0);
|
|
8
|
+
expect(result.maxMajorTickValue).toBe(100);
|
|
9
|
+
expect(result.majorTickStep).toBe(100);
|
|
10
|
+
expect(result.minMinTickValue).toBe(0);
|
|
11
|
+
expect(result.maxMaxTickValue).toBe(100);
|
|
12
|
+
expect(result.minTickStep).toBe(10);
|
|
13
|
+
expect(result.minHalfTickValue).toBe(0);
|
|
14
|
+
expect(result.maxHalfTickValue).toBe(100);
|
|
15
|
+
expect(result.halfTickStep).toBe(50);
|
|
16
|
+
expect(result.calibrationMultiplier).toBe(1);
|
|
17
|
+
expect(result.normalizedOrderOfMagnitude).toBe(2);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should handle negative ranges correctly', () => {
|
|
21
|
+
const result = calculateTickValues(-100, 0);
|
|
22
|
+
|
|
23
|
+
expect(result.minMajorTickValue).toBe(-100);
|
|
24
|
+
expect(result.maxMajorTickValue).toBe(0);
|
|
25
|
+
expect(result.majorTickStep).toBe(100);
|
|
26
|
+
expect(result.minMinTickValue).toBe(-100);
|
|
27
|
+
expect(result.maxMaxTickValue).toBe(0);
|
|
28
|
+
expect(result.minTickStep).toBe(10);
|
|
29
|
+
expect(result.minHalfTickValue).toBe(-100);
|
|
30
|
+
expect(result.maxHalfTickValue).toBe(0);
|
|
31
|
+
expect(result.halfTickStep).toBe(50);
|
|
32
|
+
expect(result.calibrationMultiplier).toBe(1);
|
|
33
|
+
expect(result.normalizedOrderOfMagnitude).toBe(2);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should handle large ranges with appropriate order of magnitude', () => {
|
|
37
|
+
const result = calculateTickValues(0, 1000);
|
|
38
|
+
|
|
39
|
+
expect(result.minMajorTickValue).toBe(0);
|
|
40
|
+
expect(result.maxMajorTickValue).toBe(1000);
|
|
41
|
+
expect(result.majorTickStep).toBe(1000);
|
|
42
|
+
expect(result.minMinTickValue).toBe(0);
|
|
43
|
+
expect(result.maxMaxTickValue).toBe(1000);
|
|
44
|
+
expect(result.minTickStep).toBe(100);
|
|
45
|
+
expect(result.minHalfTickValue).toBe(0);
|
|
46
|
+
expect(result.maxHalfTickValue).toBe(1000);
|
|
47
|
+
expect(result.halfTickStep).toBe(500);
|
|
48
|
+
expect(result.calibrationMultiplier).toBe(1);
|
|
49
|
+
expect(result.normalizedOrderOfMagnitude).toBe(3);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should respect provided order of magnitude', () => {
|
|
53
|
+
const result = calculateTickValues(0, 100, 2);
|
|
54
|
+
|
|
55
|
+
expect(result.minMajorTickValue).toBe(0);
|
|
56
|
+
expect(result.maxMajorTickValue).toBe(100);
|
|
57
|
+
expect(result.majorTickStep).toBe(100);
|
|
58
|
+
expect(result.minMinTickValue).toBe(0);
|
|
59
|
+
expect(result.maxMaxTickValue).toBe(100);
|
|
60
|
+
expect(result.minTickStep).toBe(10);
|
|
61
|
+
expect(result.minHalfTickValue).toBe(0);
|
|
62
|
+
expect(result.maxHalfTickValue).toBe(100);
|
|
63
|
+
expect(result.halfTickStep).toBe(50);
|
|
64
|
+
expect(result.calibrationMultiplier).toBe(1);
|
|
65
|
+
expect(result.normalizedOrderOfMagnitude).toBe(2);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should handle small ranges with appropriate precision', () => {
|
|
69
|
+
const result = calculateTickValues(0, 0.1);
|
|
70
|
+
|
|
71
|
+
expect(result.minMajorTickValue).toBe(0);
|
|
72
|
+
expect(result.maxMajorTickValue).toBe(10);
|
|
73
|
+
expect(result.majorTickStep).toBe(10);
|
|
74
|
+
expect(result.minMinTickValue).toBe(0);
|
|
75
|
+
expect(result.maxMaxTickValue).toBe(10);
|
|
76
|
+
expect(result.minTickStep).toBe(1);
|
|
77
|
+
expect(result.minHalfTickValue).toBe(0);
|
|
78
|
+
expect(result.maxHalfTickValue).toBe(10);
|
|
79
|
+
expect(result.halfTickStep).toBe(5);
|
|
80
|
+
expect(result.calibrationMultiplier).toBe(0.01);
|
|
81
|
+
expect(result.normalizedOrderOfMagnitude).toBe(1);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createHandlerChain } from "../../src/utils/handler-pipeline";
|
|
2
|
+
|
|
3
|
+
describe("handler-pipeline", ()=>{
|
|
4
|
+
it("should create a handler chain from an array of handlers", ()=>{
|
|
5
|
+
const handler1 = jest.fn().mockReturnValue(2);
|
|
6
|
+
const handler2 = jest.fn().mockReturnValue(3);
|
|
7
|
+
const handler3 = jest.fn().mockReturnValue(4);
|
|
8
|
+
const handlerChain = createHandlerChain(handler1, handler2, handler3);
|
|
9
|
+
const result = handlerChain(1);
|
|
10
|
+
expect(handler1).toHaveBeenCalledWith(1);
|
|
11
|
+
expect(handler2).toHaveBeenCalledWith(2);
|
|
12
|
+
expect(handler3).toHaveBeenCalledWith(3);
|
|
13
|
+
expect(result).toBe(4);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should pass additional arguments to each handler", () => {
|
|
17
|
+
const handler1 = jest.fn().mockReturnValue(2);
|
|
18
|
+
const handler2 = jest.fn().mockReturnValue(3);
|
|
19
|
+
const handler3 = jest.fn().mockReturnValue(4);
|
|
20
|
+
const handlerChain = createHandlerChain(handler1, handler2, handler3);
|
|
21
|
+
const result = handlerChain(1, "arg1", "arg2");
|
|
22
|
+
expect(handler1).toHaveBeenCalledWith(1, "arg1", "arg2");
|
|
23
|
+
expect(handler2).toHaveBeenCalledWith(2, "arg1", "arg2");
|
|
24
|
+
expect(handler3).toHaveBeenCalledWith(3, "arg1", "arg2");
|
|
25
|
+
expect(result).toBe(4);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should work with a single handler", () => {
|
|
29
|
+
const handler = jest.fn().mockReturnValue(2);
|
|
30
|
+
const handlerChain = createHandlerChain(handler);
|
|
31
|
+
const result = handlerChain(1);
|
|
32
|
+
expect(handler).toHaveBeenCalledWith(1);
|
|
33
|
+
expect(result).toBe(2);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should work with an array of handlers", () => {
|
|
37
|
+
const handler1 = jest.fn().mockReturnValue(2);
|
|
38
|
+
const handler2 = jest.fn().mockReturnValue(3);
|
|
39
|
+
const handler3 = jest.fn().mockReturnValue(4);
|
|
40
|
+
const handlers = [handler1, handler2, handler3];
|
|
41
|
+
const handlerChain = createHandlerChain(handlers);
|
|
42
|
+
const result = handlerChain(1);
|
|
43
|
+
expect(handler1).toHaveBeenCalledWith(1);
|
|
44
|
+
expect(handler2).toHaveBeenCalledWith(2);
|
|
45
|
+
expect(handler3).toHaveBeenCalledWith(3);
|
|
46
|
+
expect(result).toBe(4);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("should return the initial value if no handlers are provided", () => {
|
|
50
|
+
const handlerChain = createHandlerChain();
|
|
51
|
+
const result = handlerChain(1);
|
|
52
|
+
expect(result).toBe(1);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should handle handlers that return undefined", () => {
|
|
56
|
+
const handler1 = jest.fn().mockReturnValue(undefined);
|
|
57
|
+
const handler2 = jest.fn().mockReturnValue(3);
|
|
58
|
+
const handlerChain = createHandlerChain(handler1, handler2);
|
|
59
|
+
const result = handlerChain(1);
|
|
60
|
+
expect(handler1).toHaveBeenCalledWith(1);
|
|
61
|
+
expect(handler2).toHaveBeenCalledWith(undefined);
|
|
62
|
+
expect(result).toBe(3);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should handle handlers that return null", () => {
|
|
66
|
+
const handler1 = jest.fn().mockReturnValue(null);
|
|
67
|
+
const handler2 = jest.fn().mockReturnValue(3);
|
|
68
|
+
const handlerChain = createHandlerChain(handler1, handler2);
|
|
69
|
+
const result = handlerChain(1);
|
|
70
|
+
expect(handler1).toHaveBeenCalledWith(1);
|
|
71
|
+
expect(handler2).toHaveBeenCalledWith(null);
|
|
72
|
+
expect(result).toBe(3);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Observable } from "../../src/utils/observable";
|
|
2
|
+
|
|
3
|
+
describe("observable", ()=>{
|
|
4
|
+
it("should notify observers when data is changed", async ()=>{
|
|
5
|
+
const observable = new Observable<[number]>();
|
|
6
|
+
const observer = jest.fn();
|
|
7
|
+
observable.subscribe(observer);
|
|
8
|
+
observable.notify(1);
|
|
9
|
+
|
|
10
|
+
// Wait for microtasks to complete
|
|
11
|
+
await Promise.resolve();
|
|
12
|
+
|
|
13
|
+
expect(observer).toHaveBeenCalledWith(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should unsubscribe observer when unsubscribe function is called", async ()=>{
|
|
17
|
+
const observable = new Observable<[number]>();
|
|
18
|
+
const observer = jest.fn();
|
|
19
|
+
const unsubscribe = observable.subscribe(observer);
|
|
20
|
+
observable.notify(1);
|
|
21
|
+
await Promise.resolve();
|
|
22
|
+
expect(observer).toHaveBeenCalledWith(1);
|
|
23
|
+
unsubscribe();
|
|
24
|
+
observable.notify(2);
|
|
25
|
+
await Promise.resolve();
|
|
26
|
+
expect(observer).toHaveBeenCalledTimes(1);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should unsubscribe observer when signal is aborted", async ()=>{
|
|
30
|
+
const observable = new Observable<[number]>();
|
|
31
|
+
const observer = jest.fn();
|
|
32
|
+
const abortController = new AbortController();
|
|
33
|
+
observable.subscribe(observer, {signal: abortController.signal});
|
|
34
|
+
observable.notify(1);
|
|
35
|
+
await Promise.resolve();
|
|
36
|
+
expect(observer).toHaveBeenCalledWith(1);
|
|
37
|
+
abortController.abort();
|
|
38
|
+
observable.notify(2);
|
|
39
|
+
await Promise.resolve();
|
|
40
|
+
expect(observer).toHaveBeenCalledTimes(1);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { calculateOrderOfMagnitude } from "../../src/utils";
|
|
2
|
+
|
|
3
|
+
describe("Ruler related utility functions", () => {
|
|
4
|
+
describe("calculateOrderOfMagnitude", () => {
|
|
5
|
+
test("should return 0 for 1", () => {
|
|
6
|
+
expect(calculateOrderOfMagnitude(1)).toBe(0);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("should return 0 for 9", () => {
|
|
10
|
+
expect(calculateOrderOfMagnitude(9)).toBe(0);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("should return 1 for 10", () => {
|
|
14
|
+
expect(calculateOrderOfMagnitude(10)).toBe(1);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("should return 1 for 99", () => {
|
|
18
|
+
expect(calculateOrderOfMagnitude(99)).toBe(1);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("should return 2 for 100", () => {
|
|
22
|
+
expect(calculateOrderOfMagnitude(100)).toBe(2);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("should return -1 for 0.1", () => {
|
|
26
|
+
expect(calculateOrderOfMagnitude(0.1)).toBe(-1);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("should return -1 for 0.9", () => {
|
|
30
|
+
expect(calculateOrderOfMagnitude(0.9)).toBe(-1);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("should return -2 for 0.01", () => {
|
|
34
|
+
expect(calculateOrderOfMagnitude(0.01)).toBe(-2);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("should return -3 for 0.001", () => {
|
|
38
|
+
expect(calculateOrderOfMagnitude(0.001)).toBe(-3);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "src",
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"tsBuildInfoFile": "dist/board.tsbuildinfo",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*"
|
|
14
|
+
],
|
|
15
|
+
"references": [
|
|
16
|
+
{
|
|
17
|
+
"path": "../being"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "../math"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|