@ue-too/board 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -0
- package/board.tsbuildinfo +1 -0
- package/{dist/boardify → boardify}/index.d.ts +26 -44
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/base.d.ts +1 -1
- package/camera/camera-edge-auto-input.d.ts +13 -0
- package/{dist/camera → camera}/camera-rig/camera-rig.d.ts +1 -0
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/pan-handler.d.ts +1 -0
- package/{dist/camera → camera}/default-camera.d.ts +3 -3
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/index.d.ts +1 -0
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/position.d.ts +2 -2
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/{dist/input-interpretation → input-interpretation}/input-state-machine/kmt-input-context.d.ts +77 -11
- package/{dist/input-interpretation → input-interpretation}/input-state-machine/kmt-input-state-machine.d.ts +26 -16
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/input-state-machine/touch-input-context.d.ts +4 -4
- package/{dist/input-interpretation → input-interpretation}/raw-input-parser/vanilla-kmt-event-parser.d.ts +3 -2
- package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/raw-input-parser/vanilla-touch-event-parser.d.ts +2 -7
- package/package.json +10 -11
- package/{dist/utils → utils}/canvas-position-dimension.d.ts +7 -5
- package/utils/observable.d.ts +18 -0
- package/{dist/utils → utils}/zoomlevel-adjustment.d.ts +1 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/board.tsbuildinfo +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify/index.d.ts +0 -192
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify/index.js +0 -475
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/boardify/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/base.js +0 -340
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/base.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/animation-and-lock.js +0 -88
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/animation-and-lock.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/index.js +0 -5
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/pan-control-state-machine.js +0 -157
- 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 +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/rotation-control-state-machine.js +0 -151
- 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 +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/animation-and-lock/zoom-control-state-machine.js +0 -153
- 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 +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/index.js +0 -4
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/interface.js +0 -2
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/interface.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/relay.js +0 -38
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-mux/relay.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/camera-rig.d.ts +0 -207
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/camera-rig.js +0 -454
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/camera-rig.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/index.js +0 -6
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/pan-handler.js +0 -124
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/pan-handler.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/rotation-handler.js +0 -71
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/rotation-handler.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/index.js +0 -4
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/position-update-batcher.js +0 -97
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/position-update-batcher.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/rotation-update-batcher.js +0 -91
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/rotation-update-batcher.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.js +0 -128
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/zoom-handler.js +0 -76
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/camera-rig/zoom-handler.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/default-camera.d.ts +0 -170
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/default-camera.js +0 -258
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/default-camera.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/index.js +0 -9
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/interface.js +0 -2
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/interface.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/update-publisher.js +0 -74
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/update-publisher.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/coordinate-conversion.js +0 -150
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/coordinate-conversion.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/index.js +0 -6
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/matrix.js +0 -421
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/matrix.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/position.js +0 -177
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/position.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/rotation.js +0 -122
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/rotation.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/zoom.js +0 -46
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera/utils/zoom.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.js +0 -6
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/index.js +0 -4
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/index.js +0 -5
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-context.d.ts +0 -130
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-context.js +0 -191
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-context.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-state-machine.d.ts +0 -194
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-state-machine.js +0 -342
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/kmt-input-state-machine.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-context.js +0 -62
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-context.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-state-machine.js +0 -173
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/input-state-machine/touch-input-state-machine.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/index.js +0 -3
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.d.ts +0 -87
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.js +0 -123
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.js +0 -118
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/index.js +0 -2
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/raw-input-publisher.js +0 -99
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation/raw-input-publisher/raw-input-publisher.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/canvas-position-dimension.d.ts +0 -18
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/canvas-position-dimension.js +0 -184
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/canvas-position-dimension.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/coorindate-conversion.js +0 -10
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/coorindate-conversion.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing-utils.js +0 -450
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing-utils.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing.js +0 -192
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/drawing.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/handler-pipeline.js +0 -27
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/handler-pipeline.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/index.js +0 -9
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/observable.d.ts +0 -9
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/observable.js +0 -47
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/observable.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/ruler.js +0 -21
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/ruler.js.map +0 -1
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/zoomlevel-adjustment.d.ts +0 -28
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/zoomlevel-adjustment.js +0 -102
- package/.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils/zoomlevel-adjustment.js.map +0 -1
- package/dist/board.tsbuildinfo +0 -1
- package/dist/camera/base.d.ts +0 -189
- package/dist/camera/camera-mux/animation-and-lock/animation-and-lock.d.ts +0 -50
- package/dist/camera/camera-mux/animation-and-lock/index.d.ts +0 -4
- package/dist/camera/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +0 -137
- package/dist/camera/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +0 -131
- package/dist/camera/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +0 -143
- package/dist/camera/camera-mux/index.d.ts +0 -3
- package/dist/camera/camera-mux/interface.d.ts +0 -12
- package/dist/camera/camera-mux/relay.d.ts +0 -27
- package/dist/camera/camera-rig/index.d.ts +0 -5
- package/dist/camera/camera-rig/pan-handler.d.ts +0 -113
- package/dist/camera/camera-rig/rotation-handler.d.ts +0 -78
- package/dist/camera/camera-rig/update-batcher/index.d.ts +0 -3
- package/dist/camera/camera-rig/update-batcher/position-update-batcher.d.ts +0 -58
- package/dist/camera/camera-rig/update-batcher/rotation-update-batcher.d.ts +0 -54
- package/dist/camera/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +0 -60
- package/dist/camera/camera-rig/zoom-handler.d.ts +0 -77
- package/dist/camera/index.d.ts +0 -8
- package/dist/camera/interface.d.ts +0 -59
- package/dist/camera/update-publisher.d.ts +0 -172
- package/dist/camera/utils/coordinate-conversion.d.ts +0 -75
- package/dist/camera/utils/index.d.ts +0 -5
- package/dist/camera/utils/matrix.d.ts +0 -114
- package/dist/camera/utils/position.d.ts +0 -71
- package/dist/camera/utils/rotation.d.ts +0 -64
- package/dist/camera/utils/zoom.d.ts +0 -25
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/input-interpretation/index.d.ts +0 -3
- package/dist/input-interpretation/input-state-machine/index.d.ts +0 -4
- package/dist/input-interpretation/input-state-machine/touch-input-context.d.ts +0 -44
- package/dist/input-interpretation/input-state-machine/touch-input-state-machine.d.ts +0 -64
- package/dist/input-interpretation/raw-input-parser/index.d.ts +0 -2
- package/dist/input-interpretation/raw-input-parser/vanilla-touch-event-parser.d.ts +0 -55
- package/dist/input-interpretation/raw-input-publisher/index.d.ts +0 -1
- package/dist/input-interpretation/raw-input-publisher/raw-input-publisher.d.ts +0 -130
- package/dist/package.json +0 -39
- package/dist/utils/coorindate-conversion.d.ts +0 -5
- package/dist/utils/drawing-utils.d.ts +0 -55
- package/dist/utils/drawing.d.ts +0 -30
- package/dist/utils/handler-pipeline.d.ts +0 -30
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/observable.d.ts +0 -9
- package/dist/utils/ruler.d.ts +0 -1
- package/jest.config.js +0 -18
- package/project.json +0 -34
- package/rollup.config.js +0 -29
- package/src/boardify/index.ts +0 -562
- package/src/camera/base.ts +0 -387
- package/src/camera/camera-mux/animation-and-lock/animation-and-lock.ts +0 -114
- package/src/camera/camera-mux/animation-and-lock/index.ts +0 -4
- package/src/camera/camera-mux/animation-and-lock/pan-control-state-machine.ts +0 -248
- package/src/camera/camera-mux/animation-and-lock/rotation-control-state-machine.ts +0 -237
- package/src/camera/camera-mux/animation-and-lock/zoom-control-state-machine.ts +0 -263
- package/src/camera/camera-mux/index.ts +0 -3
- package/src/camera/camera-mux/interface.ts +0 -13
- package/src/camera/camera-mux/relay.ts +0 -50
- package/src/camera/camera-rig/camera-rig.ts +0 -560
- package/src/camera/camera-rig/index.ts +0 -5
- package/src/camera/camera-rig/pan-handler.ts +0 -192
- package/src/camera/camera-rig/rotation-handler.ts +0 -124
- package/src/camera/camera-rig/update-batcher/index.ts +0 -3
- package/src/camera/camera-rig/update-batcher/position-update-batcher.ts +0 -133
- package/src/camera/camera-rig/update-batcher/rotation-update-batcher.ts +0 -123
- package/src/camera/camera-rig/update-batcher/zoom-udpate-batcher.ts +0 -157
- package/src/camera/camera-rig/zoom-handler.ts +0 -123
- package/src/camera/default-camera.ts +0 -297
- package/src/camera/index.ts +0 -8
- package/src/camera/interface.ts +0 -45
- package/src/camera/update-publisher.ts +0 -222
- package/src/camera/utils/coordinate-conversion.ts +0 -160
- package/src/camera/utils/index.ts +0 -5
- package/src/camera/utils/matrix.ts +0 -558
- package/src/camera/utils/position.ts +0 -196
- package/src/camera/utils/rotation.ts +0 -147
- package/src/camera/utils/zoom.ts +0 -55
- package/src/index.ts +0 -5
- package/src/input-interpretation/index.ts +0 -3
- package/src/input-interpretation/input-state-machine/index.ts +0 -4
- package/src/input-interpretation/input-state-machine/kmt-input-context.ts +0 -283
- package/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts +0 -491
- package/src/input-interpretation/input-state-machine/touch-input-context.ts +0 -106
- package/src/input-interpretation/input-state-machine/touch-input-state-machine.ts +0 -215
- package/src/input-interpretation/raw-input-parser/index.ts +0 -2
- package/src/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.ts +0 -207
- package/src/input-interpretation/raw-input-parser/vanilla-touch-event-parser.ts +0 -169
- package/src/input-interpretation/raw-input-publisher/index.ts +0 -1
- package/src/input-interpretation/raw-input-publisher/raw-input-publisher.ts +0 -227
- package/src/utils/canvas-position-dimension.ts +0 -215
- package/src/utils/coorindate-conversion.ts +0 -12
- package/src/utils/drawing-utils.ts +0 -439
- package/src/utils/drawing.ts +0 -266
- package/src/utils/handler-pipeline.ts +0 -41
- package/src/utils/index.ts +0 -8
- package/src/utils/observable.ts +0 -63
- package/src/utils/ruler.ts +0 -18
- package/src/utils/zoomlevel-adjustment.ts +0 -108
- package/test/board-camera/camera-rig.test.ts +0 -78
- package/test/board-camera/camera-utils.test.ts +0 -263
- package/test/board-camera/utils/coordinate-conversion.test.ts +0 -26
- package/test/board-camera/utils/matrix.test.ts +0 -35
- package/test/boardify/utils/canvas.test.ts +0 -20
- package/test/util/drawing.test.ts +0 -83
- package/test/util/handler-pipeline.test.ts +0 -74
- package/test/util/observable.test.ts +0 -42
- package/test/util/ruler.test.ts +0 -41
- package/tsconfig.json +0 -23
- package/tsconfig.spec.json +0 -12
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/animation-and-lock/animation-and-lock.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/animation-and-lock/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/interface.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-mux/relay.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/rotation-handler.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/update-batcher/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/update-batcher/position-update-batcher.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/update-batcher/rotation-update-batcher.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/camera-rig/zoom-handler.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/interface.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/update-publisher.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/coordinate-conversion.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/matrix.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/rotation.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/camera → camera}/utils/zoom.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/index.d.ts → index.d.ts} +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/input-state-machine/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/input-state-machine/touch-input-state-machine.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/raw-input-parser/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/raw-input-publisher/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/input-interpretation → input-interpretation}/raw-input-publisher/raw-input-publisher.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/coorindate-conversion.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/drawing-utils.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/drawing.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/handler-pipeline.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/index.d.ts +0 -0
- /package/{.rollup.cache/home/runner/work/ue-too/ue-too/packages/board/dist/utils → utils}/ruler.d.ts +0 -0
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { Point, PointCal } from "@ue-too/math";
|
|
2
|
-
import { BoardCamera } from "../interface";
|
|
3
|
-
import { createHandlerChain } from "../../utils/handler-pipeline";
|
|
4
|
-
import { clampPoint, clampPointEntireViewPort } from "../utils/position";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @description Configuration for the pan handler functions.
|
|
8
|
-
*
|
|
9
|
-
* @category Camera
|
|
10
|
-
*/
|
|
11
|
-
export type PanHandlerConfig = PanHandlerRestrictionConfig & PanHandlerClampConfig;
|
|
12
|
-
|
|
13
|
-
export type PanHandlerClampConfig = {
|
|
14
|
-
/**
|
|
15
|
-
* @description Whether to limit the pan to the entire view port.
|
|
16
|
-
*/
|
|
17
|
-
limitEntireViewPort: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* @description Whether to clamp the translation.
|
|
20
|
-
*/
|
|
21
|
-
clampTranslation: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type PanHandlerRestrictionConfig = {
|
|
25
|
-
/**
|
|
26
|
-
* @description Whether to restrict the x translation.
|
|
27
|
-
*/
|
|
28
|
-
restrictXTranslation: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* @description Whether to restrict the y translation.
|
|
31
|
-
*/
|
|
32
|
-
restrictYTranslation: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @description Whether to restrict the relative x translation. (because the camera can be rotated, the relative x translation is the horizontal direction of what the user sees on the screen)
|
|
35
|
-
*/
|
|
36
|
-
restrictRelativeXTranslation: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* @description Whether to restrict the relative y translation. (because the camera can be rotated, the relative y translation is the vertical direction of what the user sees on the screen)
|
|
39
|
-
*/
|
|
40
|
-
restrictRelativeYTranslation: boolean;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @description Function Type that is used to define the "pan to" handler.
|
|
45
|
-
* The destination is in "stage/context/world" space.
|
|
46
|
-
* This is structured as a handler pipeline.
|
|
47
|
-
* @see {@link createHandlerChain}
|
|
48
|
-
* @category Camera
|
|
49
|
-
*/
|
|
50
|
-
export type PanToHandlerFunction = (destination: Point, camera: BoardCamera, config: PanHandlerConfig) => Point;
|
|
51
|
-
/**
|
|
52
|
-
* @description Function Type that is used to define the "pan by" handler.
|
|
53
|
-
* The delta is in "stage/context/world" space.
|
|
54
|
-
* This is structured as a handler pipeline.
|
|
55
|
-
* @see {@link createHandlerChain}
|
|
56
|
-
* @category Camera
|
|
57
|
-
*/
|
|
58
|
-
export type PanByHandlerFunction = (delta: Point, camera: BoardCamera, config: PanHandlerConfig) => Point;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @description Helper function that creates a default "pan to" handler.
|
|
62
|
-
* The default pan to handler will first restrict the pan to the view port, then clamp the pan to the boundaries, and then pan to the destination.
|
|
63
|
-
*
|
|
64
|
-
* @see {@link createHandlerChain} to create your own custom pan handler pipeline. (you can also use this function as a part of your own custom pan handler pipeline)
|
|
65
|
-
* @category Camera
|
|
66
|
-
*/
|
|
67
|
-
export function createDefaultPanToHandler(): PanToHandlerFunction {
|
|
68
|
-
return createHandlerChain<Point, [BoardCamera, PanHandlerConfig]>(
|
|
69
|
-
restrictPanToHandler,
|
|
70
|
-
clampToHandler,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @description Helper function that creates a default "pan by" handler.
|
|
76
|
-
* The resulting pan by handler takes in a delta that is in "stage/context/world" space.
|
|
77
|
-
* The default pan by handler will first restrict the pan by the view port, then clamp the pan by the boundaries, and then pan by the delta.
|
|
78
|
-
*
|
|
79
|
-
* @see {@link createHandlerChain} to create your own custom pan handler pipeline. (you can also use this function as a part of your own custom pan handler pipeline)
|
|
80
|
-
* @category Camera
|
|
81
|
-
*/
|
|
82
|
-
export function createDefaultPanByHandler(): PanByHandlerFunction {
|
|
83
|
-
return createHandlerChain<Point, [BoardCamera, PanHandlerConfig]>(
|
|
84
|
-
restrictPanByHandler,
|
|
85
|
-
clampByHandler,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @description Function that is part of the "pan to" handler pipeline. It restricts the "pan to" destination to within a single axis based on the config. (relative to the current camera position)
|
|
91
|
-
* You can use this function standalone to restrict the "pan to" destination to within a single axis based on the config.
|
|
92
|
-
* But it is recommended to use this kind of function as part of the pan handler pipeline. (to include this function in your own custom pan handler pipeline)
|
|
93
|
-
*
|
|
94
|
-
* @category Camera
|
|
95
|
-
*/
|
|
96
|
-
export function restrictPanToHandler(destination: Point, camera: BoardCamera, config: PanHandlerRestrictionConfig): Point {
|
|
97
|
-
let delta = PointCal.subVector(destination, camera.position);
|
|
98
|
-
delta = convertDeltaToComplyWithRestriction(delta, camera, config);
|
|
99
|
-
if (delta.x === 0 && delta.y === 0) {
|
|
100
|
-
return destination;
|
|
101
|
-
}
|
|
102
|
-
const dest = PointCal.addVector(camera.position, delta);
|
|
103
|
-
return dest;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @description Function that is part of the "pan by" handler pipeline. It restricts the pan delta to within a single axis based on the config. (relative to the current camera position)
|
|
108
|
-
* You can use this function standalone to restrict the pan delta to within a single axis based on the config.
|
|
109
|
-
* But it is recommended to use this kind of function as part of the pan handler pipeline. (to include this function in your own custom pan handler pipeline)
|
|
110
|
-
*
|
|
111
|
-
* @category Camera
|
|
112
|
-
*/
|
|
113
|
-
export function restrictPanByHandler(delta: Point, camera: BoardCamera, config: PanHandlerRestrictionConfig): Point {
|
|
114
|
-
delta = convertDeltaToComplyWithRestriction(delta, camera, config);
|
|
115
|
-
return delta;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @description Function that is part of the "pan to" handler pipeline. It clamps the pan destination within the boundaries of the view port.
|
|
120
|
-
* You can use this function standalone to clamp the pan destination within the boundaries of the view port.
|
|
121
|
-
* But it is recommended to use this kind of function as part of the pan handler pipeline. (to include this function in your own custom pan handler pipeline)
|
|
122
|
-
*
|
|
123
|
-
* @category Camera
|
|
124
|
-
*/
|
|
125
|
-
export function clampToHandler(destination: Point, camera: BoardCamera, config: PanHandlerClampConfig): Point {
|
|
126
|
-
if(!config.clampTranslation){
|
|
127
|
-
return destination;
|
|
128
|
-
}
|
|
129
|
-
let actualDest = clampPoint(destination, camera.boundaries);
|
|
130
|
-
if(config.limitEntireViewPort){
|
|
131
|
-
actualDest = clampPointEntireViewPort(destination, camera.viewPortWidth, camera.viewPortHeight, camera.boundaries, camera.zoomLevel, camera.rotation);
|
|
132
|
-
}
|
|
133
|
-
return actualDest;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @description Function that is part of the "pan by" handler pipeline. It clamps the pan delta within the boundaries of the view port.
|
|
138
|
-
* You can use this function standalone to clamp the pan delta within the boundaries of the view port.
|
|
139
|
-
* But it is recommended to use this kind of function as part of the pan handler pipeline. (to include this function in your own custom pan handler pipeline)
|
|
140
|
-
*
|
|
141
|
-
* @category Camera
|
|
142
|
-
*/
|
|
143
|
-
export function clampByHandler(delta: Point, camera: BoardCamera, config: PanHandlerClampConfig): Point {
|
|
144
|
-
if(!config.clampTranslation){
|
|
145
|
-
return delta;
|
|
146
|
-
}
|
|
147
|
-
let actualDelta = PointCal.subVector(clampPoint(PointCal.addVector(camera.position, delta), camera.boundaries), camera.position);
|
|
148
|
-
if(config.limitEntireViewPort){
|
|
149
|
-
actualDelta = PointCal.subVector(clampPointEntireViewPort(PointCal.addVector(camera.position, delta), camera.viewPortWidth, camera.viewPortHeight, camera.boundaries, camera.zoomLevel, camera.rotation), camera.position);
|
|
150
|
-
}
|
|
151
|
-
return actualDelta;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @description Helper function that converts the delta to comply with the restrictions of the config.
|
|
156
|
-
*
|
|
157
|
-
* @category Camera
|
|
158
|
-
*/
|
|
159
|
-
export function convertDeltaToComplyWithRestriction(delta: Point, camera: BoardCamera, config: PanHandlerRestrictionConfig): Point {
|
|
160
|
-
if(config.restrictXTranslation && config.restrictYTranslation){
|
|
161
|
-
return {x: 0, y: 0};
|
|
162
|
-
}
|
|
163
|
-
if(config.restrictRelativeXTranslation && config.restrictRelativeYTranslation){
|
|
164
|
-
return {x: 0, y: 0};
|
|
165
|
-
}
|
|
166
|
-
if(config.restrictXTranslation){
|
|
167
|
-
delta.x = 0;
|
|
168
|
-
}
|
|
169
|
-
if(config.restrictYTranslation){
|
|
170
|
-
delta.y = 0;
|
|
171
|
-
}
|
|
172
|
-
if(config.restrictRelativeXTranslation){
|
|
173
|
-
const upDirection = PointCal.rotatePoint({x: 0, y: 1}, camera.rotation);
|
|
174
|
-
const value = PointCal.dotProduct(upDirection, delta);
|
|
175
|
-
delta = PointCal.multiplyVectorByScalar(upDirection, value);
|
|
176
|
-
}
|
|
177
|
-
if(config.restrictRelativeYTranslation){
|
|
178
|
-
const rightDirection = PointCal.rotatePoint({x: 1, y: 0}, camera.rotation);
|
|
179
|
-
const value = PointCal.dotProduct(rightDirection, delta);
|
|
180
|
-
delta = PointCal.multiplyVectorByScalar(rightDirection, value);
|
|
181
|
-
}
|
|
182
|
-
return delta;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @description Helper function that converts the user input delta to the camera delta.
|
|
187
|
-
*
|
|
188
|
-
* @category Camera
|
|
189
|
-
*/
|
|
190
|
-
export function convertUserInputDeltaToCameraDelta(delta: Point, camera: BoardCamera): Point {
|
|
191
|
-
return PointCal.multiplyVectorByScalar(PointCal.rotatePoint(delta, camera.rotation), 1 / camera.zoomLevel);
|
|
192
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { BoardCamera } from "../interface";
|
|
2
|
-
import { createHandlerChain } from "../../utils/handler-pipeline";
|
|
3
|
-
import { normalizeAngleZero2TwoPI, angleSpan, clampRotation } from "../utils/rotation";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @description This is the configuration for the rotation handler functions.
|
|
7
|
-
* This is the configuration object that is passed to the rotation handler functions.
|
|
8
|
-
*
|
|
9
|
-
* @category Camera
|
|
10
|
-
*/
|
|
11
|
-
export type RotationHandlerConfig = RotationHandlerRestrictConfig & RotationHandlerClampConfig;
|
|
12
|
-
|
|
13
|
-
export type RotationHandlerRestrictConfig = {
|
|
14
|
-
/**
|
|
15
|
-
* @description Whether to restrict the rotation. (if true, rotation input will be ignored)
|
|
16
|
-
*/
|
|
17
|
-
restrictRotation: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type RotationHandlerClampConfig = {
|
|
21
|
-
/**
|
|
22
|
-
* @description Whether to clamp the rotation if the rotation is out of the rotation boundaries.
|
|
23
|
-
*/
|
|
24
|
-
clampRotation: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @description The function that is used to rotate the camera by a specific delta.
|
|
29
|
-
* The delta is in radians.
|
|
30
|
-
* This is structured as a handler pipeline.
|
|
31
|
-
*
|
|
32
|
-
* @see {@link createHandlerChain}
|
|
33
|
-
* @category Camera
|
|
34
|
-
*/
|
|
35
|
-
export type RotateByHandlerFunction = (delta: number, camera: BoardCamera, config: RotationHandlerConfig) => number;
|
|
36
|
-
/**
|
|
37
|
-
* @description The function that is used to rotate the camera to a specific target rotation.
|
|
38
|
-
* The target rotation is in radians.
|
|
39
|
-
* This is structured as a handler pipeline.
|
|
40
|
-
*
|
|
41
|
-
* @see {@link createHandlerChain}
|
|
42
|
-
* @category Camera
|
|
43
|
-
*/
|
|
44
|
-
export type RotateToHandlerFunction = (targetRotation: number, camera: BoardCamera, config: RotationHandlerConfig) => number;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @description This is the clamp handler for the "rotate by" handler pipeline.
|
|
48
|
-
* It clamps the delta to the range of the camera's rotation boundaries.
|
|
49
|
-
*
|
|
50
|
-
* @category Camera
|
|
51
|
-
*/
|
|
52
|
-
export function clampRotateByHandler(delta: number, camera: BoardCamera, config: RotationHandlerClampConfig): number {
|
|
53
|
-
if(!config.clampRotation){
|
|
54
|
-
return delta;
|
|
55
|
-
}
|
|
56
|
-
const targetRotation = normalizeAngleZero2TwoPI(camera.rotation + delta);
|
|
57
|
-
const clampedRotation = clampRotation(targetRotation, camera.rotationBoundaries);
|
|
58
|
-
const diff = angleSpan(camera.rotation, clampedRotation);
|
|
59
|
-
return diff;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @description This is the restrict handler for the "rotate by" handler pipeline.
|
|
64
|
-
* It restricts the delta to the range of the camera's rotation boundaries.
|
|
65
|
-
*
|
|
66
|
-
* @category Camera
|
|
67
|
-
*/
|
|
68
|
-
export function restrictRotateByHandler(delta: number, camera: BoardCamera, config: RotationHandlerRestrictConfig): number {
|
|
69
|
-
if(config.restrictRotation){
|
|
70
|
-
return 0;
|
|
71
|
-
}
|
|
72
|
-
return delta;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @description This is the clamp handler for the "rotate to" handler pipeline.
|
|
77
|
-
* It clamps the target rotation to the range of the camera's rotation boundaries.
|
|
78
|
-
*
|
|
79
|
-
* @category Camera
|
|
80
|
-
*/
|
|
81
|
-
export function clampRotateToHandler(targetRotation: number, camera: BoardCamera, config: RotationHandlerClampConfig): number {
|
|
82
|
-
if(!config.clampRotation){
|
|
83
|
-
return targetRotation;
|
|
84
|
-
}
|
|
85
|
-
const clampedRotation = clampRotation(targetRotation, camera.rotationBoundaries);
|
|
86
|
-
return clampedRotation;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @description This is the restrict handler for the "rotate to" handler pipeline.
|
|
91
|
-
* It restricts the target rotation to the range of the camera's rotation boundaries.
|
|
92
|
-
*
|
|
93
|
-
* @category Camera
|
|
94
|
-
*/
|
|
95
|
-
export function restrictRotateToHandler(targetRotation: number, camera: BoardCamera, config: RotationHandlerRestrictConfig): number {
|
|
96
|
-
if(config.restrictRotation){
|
|
97
|
-
return camera.rotation;
|
|
98
|
-
}
|
|
99
|
-
return targetRotation;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @description This is the create default handler chain function for the "rotate by" handler pipeline.
|
|
104
|
-
*
|
|
105
|
-
* @category Camera
|
|
106
|
-
*/
|
|
107
|
-
export function createDefaultRotateByHandler(): RotateByHandlerFunction {
|
|
108
|
-
return createHandlerChain<number, [BoardCamera, RotationHandlerConfig]>(
|
|
109
|
-
restrictRotateByHandler,
|
|
110
|
-
clampRotateByHandler,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @description This is the create default handler chain function for the "rotate to" handler pipeline.
|
|
116
|
-
*
|
|
117
|
-
* @category Camera
|
|
118
|
-
*/
|
|
119
|
-
export function createDefaultRotateToHandler(): RotateToHandlerFunction {
|
|
120
|
-
return createHandlerChain<number, [BoardCamera, RotationHandlerConfig]>(
|
|
121
|
-
restrictRotateToHandler,
|
|
122
|
-
clampRotateToHandler,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Observable, Observer, SubscriptionOptions } from "../../../utils/observable";
|
|
2
|
-
|
|
3
|
-
export type Position = {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type Velocity = {
|
|
9
|
-
vx: number;
|
|
10
|
-
vy: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type DestinationUpdate = Position & {
|
|
14
|
-
type: 'destination';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type DeltaUpdate = Position & {
|
|
18
|
-
type: 'delta';
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type PositionUpdate = DestinationUpdate | DeltaUpdate;
|
|
22
|
-
|
|
23
|
-
export class CameraPositionUpdateBatcher {
|
|
24
|
-
private nextPosition: Position | null = null;
|
|
25
|
-
private delta: Position = { x: 0, y: 0 };
|
|
26
|
-
private observable: Observable<[PositionUpdate]>;
|
|
27
|
-
// Debug counters
|
|
28
|
-
private queuePositionUpdateCount: number = 0;
|
|
29
|
-
private queuePositionUpdateToCount: number = 0;
|
|
30
|
-
private queuePositionUpdateByCount: number = 0;
|
|
31
|
-
private lastUpdateCount: number = 0;
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
this.observable = new Observable<[PositionUpdate]>();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Queue an absolute position update to be processed in the next animation frame
|
|
39
|
-
*/
|
|
40
|
-
public queuePositionUpdate(x: number, y: number): void {
|
|
41
|
-
this.queuePositionUpdateCount++;
|
|
42
|
-
this.queuePositionUpdateTo({ x, y });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Queue a position update to a specific destination to be processed in the next animation frame
|
|
47
|
-
* This will override any pending delta updates
|
|
48
|
-
*/
|
|
49
|
-
public queuePositionUpdateTo(destination: Position): void {
|
|
50
|
-
this.queuePositionUpdateToCount++;
|
|
51
|
-
this.nextPosition = { ...destination };
|
|
52
|
-
this.delta = { x: 0, y: 0 }; // Reset any pending deltas
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Queue a position update by delta to be processed in the next animation frame
|
|
57
|
-
* This will be ignored if there's a pending destination update
|
|
58
|
-
*/
|
|
59
|
-
public queuePositionUpdateBy(delta: Position): void {
|
|
60
|
-
this.queuePositionUpdateByCount++;
|
|
61
|
-
|
|
62
|
-
// If we have a pending destination update, add the delta to it
|
|
63
|
-
if (this.nextPosition !== null) {
|
|
64
|
-
this.nextPosition = {
|
|
65
|
-
x: this.nextPosition.x + delta.x,
|
|
66
|
-
y: this.nextPosition.y + delta.y
|
|
67
|
-
};
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this.delta = {
|
|
72
|
-
x: this.delta.x + delta.x,
|
|
73
|
-
y: this.delta.y + delta.y
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Process and clear all queued position updates
|
|
79
|
-
* @returns the update to apply to the position, with type information
|
|
80
|
-
*/
|
|
81
|
-
public processQueuedUpdates(): PositionUpdate | null {
|
|
82
|
-
this.lastUpdateCount = this.queuePositionUpdateCount + this.queuePositionUpdateToCount + this.queuePositionUpdateByCount;
|
|
83
|
-
// Reset counters after update
|
|
84
|
-
this.queuePositionUpdateCount = 0;
|
|
85
|
-
this.queuePositionUpdateToCount = 0;
|
|
86
|
-
this.queuePositionUpdateByCount = 0;
|
|
87
|
-
|
|
88
|
-
if (this.nextPosition !== null) {
|
|
89
|
-
const update: DestinationUpdate = {
|
|
90
|
-
...this.nextPosition,
|
|
91
|
-
type: 'destination'
|
|
92
|
-
};
|
|
93
|
-
this.nextPosition = null;
|
|
94
|
-
this.delta = { x: 0, y: 0 };
|
|
95
|
-
this.observable.notify(update);
|
|
96
|
-
return update;
|
|
97
|
-
} else if (this.delta.x !== 0 || this.delta.y !== 0) {
|
|
98
|
-
const update: DeltaUpdate = {
|
|
99
|
-
...this.delta,
|
|
100
|
-
type: 'delta'
|
|
101
|
-
};
|
|
102
|
-
this.delta = { x: 0, y: 0 };
|
|
103
|
-
this.observable.notify(update);
|
|
104
|
-
return update;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Subscribe to position updates
|
|
112
|
-
*/
|
|
113
|
-
public subscribe(observer: Observer<[PositionUpdate]>, options?: SubscriptionOptions): () => void {
|
|
114
|
-
return this.observable.subscribe(observer, options);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Get debug information about queue method calls since last update
|
|
119
|
-
*/
|
|
120
|
-
public getDebugInfo(): {
|
|
121
|
-
lastUpdateTotalCalls: number;
|
|
122
|
-
queuePositionUpdateCalls: number;
|
|
123
|
-
queuePositionUpdateToCalls: number;
|
|
124
|
-
queuePositionUpdateByCalls: number;
|
|
125
|
-
} {
|
|
126
|
-
return {
|
|
127
|
-
lastUpdateTotalCalls: this.lastUpdateCount,
|
|
128
|
-
queuePositionUpdateCalls: this.queuePositionUpdateCount,
|
|
129
|
-
queuePositionUpdateToCalls: this.queuePositionUpdateToCount,
|
|
130
|
-
queuePositionUpdateByCalls: this.queuePositionUpdateByCount
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Observable, Observer, SubscriptionOptions } from "../../../utils/observable";
|
|
2
|
-
|
|
3
|
-
export type Rotation = number; // in radians
|
|
4
|
-
|
|
5
|
-
export type RotationVelocity = number; // in radians per millisecond
|
|
6
|
-
|
|
7
|
-
export type RotationDestinationUpdate = {
|
|
8
|
-
type: 'destination';
|
|
9
|
-
destination: Rotation;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type RotationDeltaUpdate = {
|
|
13
|
-
type: 'delta';
|
|
14
|
-
delta: Rotation;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type RotationUpdate = RotationDestinationUpdate | RotationDeltaUpdate;
|
|
18
|
-
|
|
19
|
-
export class CameraRotationUpdateBatcher {
|
|
20
|
-
private nextRotation: Rotation | null = null;
|
|
21
|
-
private delta: Rotation = 0;
|
|
22
|
-
private observable: Observable<[RotationUpdate]>;
|
|
23
|
-
// Debug counters
|
|
24
|
-
private queueRotationUpdateCount: number = 0;
|
|
25
|
-
private queueRotationUpdateToCount: number = 0;
|
|
26
|
-
private queueRotationUpdateByCount: number = 0;
|
|
27
|
-
private lastUpdateCount: number = 0;
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
this.observable = new Observable<[RotationUpdate]>();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Queue an absolute rotation update to be processed in the next animation frame
|
|
35
|
-
*/
|
|
36
|
-
public queueRotationUpdate(rotation: Rotation): void {
|
|
37
|
-
this.queueRotationUpdateCount++;
|
|
38
|
-
this.queueRotationUpdateTo(rotation);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Queue a rotation update to a specific destination to be processed in the next animation frame
|
|
43
|
-
* This will override any pending delta updates
|
|
44
|
-
*/
|
|
45
|
-
public queueRotationUpdateTo(destination: Rotation): void {
|
|
46
|
-
this.queueRotationUpdateToCount++;
|
|
47
|
-
this.nextRotation = destination;
|
|
48
|
-
this.delta = 0; // Reset any pending deltas
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Queue a rotation update by delta to be processed in the next animation frame
|
|
53
|
-
* This will be ignored if there's a pending destination update
|
|
54
|
-
*/
|
|
55
|
-
public queueRotationUpdateBy(delta: Rotation): void {
|
|
56
|
-
this.queueRotationUpdateByCount++;
|
|
57
|
-
|
|
58
|
-
// If we have a pending destination update, add the delta to it
|
|
59
|
-
if (this.nextRotation !== null) {
|
|
60
|
-
this.nextRotation = this.nextRotation + delta;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.delta = this.delta + delta;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Process and clear all queued rotation updates
|
|
69
|
-
* @returns the update to apply to the rotation, with type information
|
|
70
|
-
*/
|
|
71
|
-
public processQueuedUpdates(): RotationUpdate | null {
|
|
72
|
-
this.lastUpdateCount = this.queueRotationUpdateCount + this.queueRotationUpdateToCount + this.queueRotationUpdateByCount;
|
|
73
|
-
// Reset counters after update
|
|
74
|
-
this.queueRotationUpdateCount = 0;
|
|
75
|
-
this.queueRotationUpdateToCount = 0;
|
|
76
|
-
this.queueRotationUpdateByCount = 0;
|
|
77
|
-
|
|
78
|
-
if (this.nextRotation !== null) {
|
|
79
|
-
const update: RotationDestinationUpdate = {
|
|
80
|
-
destination: this.nextRotation,
|
|
81
|
-
type: 'destination'
|
|
82
|
-
};
|
|
83
|
-
this.nextRotation = null;
|
|
84
|
-
this.delta = 0;
|
|
85
|
-
this.observable.notify(update);
|
|
86
|
-
return update;
|
|
87
|
-
} else if (this.delta !== 0) {
|
|
88
|
-
const update: RotationDeltaUpdate = {
|
|
89
|
-
delta: this.delta,
|
|
90
|
-
type: 'delta'
|
|
91
|
-
};
|
|
92
|
-
this.delta = 0;
|
|
93
|
-
this.observable.notify(update);
|
|
94
|
-
return update;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Subscribe to rotation updates
|
|
102
|
-
*/
|
|
103
|
-
public subscribe(observer: Observer<[RotationUpdate]>, options?: SubscriptionOptions): () => void {
|
|
104
|
-
return this.observable.subscribe(observer, options);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Get debug information about queue method calls since last update
|
|
109
|
-
*/
|
|
110
|
-
public getDebugInfo(): {
|
|
111
|
-
lastUpdateTotalCalls: number;
|
|
112
|
-
queueRotationUpdateCalls: number;
|
|
113
|
-
queueRotationUpdateToCalls: number;
|
|
114
|
-
queueRotationUpdateByCalls: number;
|
|
115
|
-
} {
|
|
116
|
-
return {
|
|
117
|
-
lastUpdateTotalCalls: this.lastUpdateCount,
|
|
118
|
-
queueRotationUpdateCalls: this.queueRotationUpdateCount,
|
|
119
|
-
queueRotationUpdateToCalls: this.queueRotationUpdateToCount,
|
|
120
|
-
queueRotationUpdateByCalls: this.queueRotationUpdateByCount
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|