@weasel-js/core 1.9.4 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +918 -0
- package/README.md +38 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +92 -84
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +71 -101
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js +50 -28
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotateCursor.js +12 -0
- package/dist/affordances/rotateCursor.js.map +1 -0
- package/dist/affordances/rotationHandle.js +44 -46
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +48 -136
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +99 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +59 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +64 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +32 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +34 -37
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +13 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +54 -47
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +44 -51
- package/dist/canvas/Canvas.js +270 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +168 -190
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +24 -25
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +33 -36
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +38 -50
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +319 -270
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +71 -62
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +46 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +49 -113
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +51 -41
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +65 -101
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +8 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +301 -708
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/SurfaceCanvas.js +40 -0
- package/dist/canvas/SurfaceCanvas.js.map +1 -0
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/adapterPickSource.js +34 -0
- package/dist/canvas/adapterPickSource.js.map +1 -0
- package/dist/canvas/affordanceAt.js +12 -2
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +56 -34
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/copiesAbove.js +27 -0
- package/dist/canvas/copiesAbove.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +25 -24
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +47 -71
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +45 -25
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +149 -104
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/layout.js +9 -15
- package/dist/canvas/deps/layout.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +69 -43
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js +33 -31
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overChildren.js +29 -0
- package/dist/canvas/overChildren.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickReach.js +23 -0
- package/dist/canvas/pickReach.js.map +1 -0
- package/dist/canvas/pickWalk.js +43 -70
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +1 -3
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +12 -12
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +59 -144
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +10 -9
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +37 -42
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/useCanvasRenderer.js +23 -11
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +51 -44
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +22 -0
- package/dist/canvas/useSceneAdapter.js.map +1 -0
- package/dist/canvas/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +39 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +40 -34
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +7 -2
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-C0eADtS0.d.ts} +129 -84
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +102 -29
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +2 -4
- package/dist/core/layers/children.js.map +1 -0
- package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/create.js +2 -2
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js +19 -23
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +3 -7
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +2 -4
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
- package/dist/core/ops/reparent.js +0 -1
- package/dist/core/ops/reparent.js.map +1 -1
- package/dist/core/ops/slot.js +3 -6
- package/dist/core/ops/slot.js.map +1 -1
- package/dist/core/pages/fitViewToPage.js +15 -0
- package/dist/core/pages/fitViewToPage.js.map +1 -0
- package/dist/core/pages/pages.js +65 -0
- package/dist/core/pages/pages.js.map +1 -0
- package/dist/core/pages/pagesLayer.js +27 -0
- package/dist/core/pages/pagesLayer.js.map +1 -0
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +104 -93
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/core/scene/composePose.js +105 -0
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +42 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +122 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +16 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +67 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +4 -3
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +91 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +31 -33
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +113 -53
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +14 -11
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/core/viewport/zoomAt.js +11 -2
- package/dist/core/viewport/zoomAt.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BSKbyuvQ.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +5 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +63 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -16
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/shapeGenerator.js +89 -0
- package/dist/features/paths/shapeGenerator.js.map +1 -0
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +44 -57
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +119 -88
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewResolver.js +28 -24
- package/dist/features/viewports/viewResolver.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/icons/SliceIcon.js +24 -0
- package/dist/icons/SliceIcon.js.map +1 -0
- package/dist/index.d.ts +5200 -8777
- package/dist/index.js +284 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +24 -24
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +74 -83
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +103 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +69 -74
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
- package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
- package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/bendSegment.js +46 -0
- package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +36 -21
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +35 -40
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
- package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +18 -34
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +43 -39
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
- package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +15 -15
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/action.js +101 -0
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/preview.js +26 -0
- package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +1 -1
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/geometryProjection.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +79 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +55 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/repositionAction.js +31 -0
- package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/move/action.js +91 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +35 -28
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +108 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +47 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +17 -64
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +66 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +88 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/replay.js +47 -0
- package/dist/interactions/actions/resize/replay.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +63 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +2 -1
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +71 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/replay.js +22 -0
- package/dist/interactions/actions/rotate/replay.js.map +1 -0
- package/dist/interactions/actions/rotate/session.js +102 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/transform-again/action.js +63 -0
- package/dist/interactions/actions/transform-again/action.js.map +1 -0
- package/dist/interactions/actions/transform-again/memory.js +35 -0
- package/dist/interactions/actions/transform-again/memory.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +84 -61
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +16 -15
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +162 -164
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js +11 -14
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +15 -14
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +40 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +5 -5
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +44 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +69 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +18 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +10 -2
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-DBbbCy0i.d.ts} +103 -176
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -60
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -82
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -94
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js +0 -67
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -104
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -239
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -85
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -51
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -91
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js +0 -100
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/layout/arrivals.js +0 -36
- package/dist/layout/arrivals.js.map +0 -1
- package/dist/math-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -74
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -68
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -48
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -11
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -34
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-DM2B87-g.d.ts +0 -356
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setStroke.js","names":["repaint","state","prev","strokeWith","paintWithColor","strokeOf","setStrokeAction","createPaintAction","pick","DEFAULT_STROKE_COLOR","color","params","paint"],"sources":["../../../../src/interactions/actions/defaults/setStroke.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type {
|
|
1
|
+
{"version":3,"file":"setStroke.js","names":["repaint","state","prev","strokeWith","paintWithColor","strokeOf","setStrokeAction","createPaintAction","pick","DEFAULT_STROKE_COLOR","color","params","paint"],"sources":["../../../../src/interactions/actions/defaults/setStroke.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { Paint, Stroke } from '@weasel-js/paint';\nimport { createPaintAction } from './createPaintAction';\nimport { paintWithColor, strokeOf, strokeWith, DEFAULT_STROKE_COLOR } from '../../../util/paint';\n\n/** `setStroke`'s gesture state — `setFill`'s, against a stroke. */\ninterface SetStrokeState {\n /** May be 6- or 8-char hex. Ignored while `paint` is set. */\n color: string;\n /** `null` is an explicit no-stroke, distinct from `undefined`, which means\n * this gesture carries no paint and the color applies. */\n paint?: Paint | null;\n}\n\n/** Repaint a node's stroke, keeping its width, cap, join, dash and align, so\n * picking a paint does not discard the rest of the stroke. A node with no\n * stroke yet gets a hairline one. */\nfunction repaint(prev: Stroke | null | undefined, state: SetStrokeState): Stroke | null {\n // A stroke whose paint is none paints nothing, so the whole stroke goes\n // rather than being kept as a widthful thing that draws no ink.\n if (state.paint === null) return null;\n if (state.paint) return prev ? { ...prev, paint: state.paint } : strokeWith(state.paint);\n if (!prev) return strokeOf(state.color);\n return { ...prev, paint: paintWithColor(prev.paint, state.color) };\n}\n\n/**\n * Static descriptor for the `setStroke` Action.\n *\n * Takes either `color` (a hex string) or `paint` (a whole `Paint`, for\n * gradients and patterns). `paint` wins when both are present. A stroke's\n * width, cap, join, dash and align survive either.\n *\n * Alpha semantics: alpha lives on the stroke paint's `opacity`. A 6-char\n * (no-alpha) color adopts the alpha of the node's existing stroke paint; an\n * 8-char color states its own. A `paint` is written verbatim.\n */\nexport const setStrokeAction: Action & { requires: string[] } = createPaintAction<\n SetStrokeState,\n Stroke,\n 'stroke'\n>({\n id: 'setStroke',\n label: 'Set stroke',\n dataKey: 'stroke',\n initialState: (pick) => ({\n color: pick<string>('color') ?? DEFAULT_STROKE_COLOR,\n paint: pick<Paint | null>('paint'),\n }),\n readParams: (prev, params) => {\n const color = params?.color as string | undefined;\n const paint = params?.paint as Paint | null | undefined;\n if (color === undefined && paint === undefined) return null;\n if (color === undefined) return { ...prev, paint };\n // An explicit color supersedes a paint from an earlier tick; otherwise a\n // picker drag after a gradient would do nothing.\n return { color, paint };\n },\n merge: repaint,\n});\n"],"mappings":";;;AAiBA,SAASA,EAAQ,GAAiC,GAAsC;CAMtF,OAHIC,EAAM,UAAU,OAAa,OAC7BA,EAAM,QAAcC,IAAO;EAAE,GAAGA;EAAM,OAAOD,EAAM;CAAM,IAAIE,EAAWF,EAAM,KAAK,IAClFC,IACE;EAAE,GAAGA;EAAM,OAAOE,EAAeF,EAAK,OAAOD,EAAM,KAAK;CAAE,IAD/CI,EAASJ,EAAM,KAAK;AAExC;AAaA,IAAaK,IAAmDC,EAI9D;CACA,IAAI;CACJ,OAAO;CACP,SAAS;CACT,eAAe,OAAU;EACvB,OAAOC,EAAa,OAAO,KAAKC;EAChC,OAAOD,EAAmB,OAAO;CACnC;CACA,aAAa,GAAM,MAAW;EAC5B,IAAME,IAAQC,GAAQ,OAChBC,IAAQD,GAAQ;EAKtB,OAJID,MAAU,KAAA,KAAaE,MAAU,KAAA,IAAkB,OACnDF,MAAU,KAAA,IAAkB;GAAE,GAAGR;GAAM;EAAM,IAG1C;GAAE;GAAO;EAAM;CACxB;CACA,OAAOF;AACT,CAAC"}
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { boundsOfPath as r } from "@weasel-js/geom";
|
|
1
|
+
import { createDeleteOp as e } from "../../../core/ops/delete.js";
|
|
2
|
+
import { createInsertOp as t } from "../../../core/ops/create.js";
|
|
3
|
+
import { boundsOfPath as n, hasOpenSubpath as r } from "@weasel-js/geom";
|
|
5
4
|
import { snipPathByPolyline as i, splitPathByPolyline as a } from "@weasel-js/geom/booleans";
|
|
6
5
|
//#region src/interactions/actions/defaults/sliceOps.ts
|
|
7
|
-
function o(
|
|
8
|
-
let { cut:
|
|
9
|
-
pose: s(e.node.pose,
|
|
6
|
+
function o(o) {
|
|
7
|
+
let { cut: c, nextId: l, selection: u } = o, d = o.placePiece ?? ((e, t) => ({
|
|
8
|
+
pose: s(e.node.pose, n(t)),
|
|
10
9
|
path: t
|
|
11
|
-
})), f = [], p = new Set(u ?? []), m = /* @__PURE__ */ new Set(), h = [], g =
|
|
10
|
+
})), f = [], p = new Set(u ?? []), m = /* @__PURE__ */ new Set(), h = [], g = o.leaves.map((e, t) => ({
|
|
12
11
|
leaf: e,
|
|
13
12
|
i: t
|
|
14
13
|
})).sort((e, t) => t.leaf.index - e.leaf.index || e.i - t.i);
|
|
15
|
-
for (let { leaf:
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
18
|
-
let s =
|
|
19
|
-
m.add(s), f.push(
|
|
20
|
-
node:
|
|
21
|
-
index:
|
|
14
|
+
for (let { leaf: n } of g) {
|
|
15
|
+
let o = r(n.worldPath) ? i(n.worldPath, c) : a(n.worldPath, c);
|
|
16
|
+
if (!o) continue;
|
|
17
|
+
let s = n.node.id;
|
|
18
|
+
m.add(s), f.push(e({
|
|
19
|
+
node: n.node,
|
|
20
|
+
index: n.index,
|
|
22
21
|
label: "Slice"
|
|
23
22
|
}));
|
|
24
|
-
for (let
|
|
25
|
-
let r = d(
|
|
26
|
-
...
|
|
23
|
+
for (let e of o) {
|
|
24
|
+
let r = d(n, e), i = {
|
|
25
|
+
...n.node,
|
|
27
26
|
id: l(),
|
|
28
27
|
pose: r.pose,
|
|
29
28
|
data: {
|
|
30
|
-
...
|
|
29
|
+
...n.node.data,
|
|
31
30
|
path: r.path
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
f.push(
|
|
33
|
+
f.push(t({
|
|
35
34
|
node: i,
|
|
36
|
-
index:
|
|
35
|
+
index: n.index,
|
|
37
36
|
label: "Slice"
|
|
38
37
|
})), p.has(s) && h.push(i.id);
|
|
39
38
|
}
|
|
@@ -53,7 +52,6 @@ function s(e, t) {
|
|
|
53
52
|
height: t.height
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
var c = (t) => t.kind === "polygon" && e(t).closed.some((e) => !e);
|
|
57
55
|
//#endregion
|
|
58
56
|
export { o as computeSliceOps };
|
|
59
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceOps.js","names":["computeSliceOps","args","placePiece","piecePose","leaf","boundsOfPath","piece","ops","selected","selection","cutIds","inherited","ordered","b","a","pieces","hasOpenSubpath","snipPathByPolyline","cut","splitPathByPolyline","sourceId","createDeleteOp","stored","node","nextId","createInsertOp","id","rest","source","\"rotation\""
|
|
1
|
+
{"version":3,"file":"sliceOps.js","names":["computeSliceOps","args","placePiece","piecePose","leaf","boundsOfPath","piece","ops","selected","selection","cutIds","inherited","ordered","b","a","pieces","hasOpenSubpath","snipPathByPolyline","cut","splitPathByPolyline","sourceId","createDeleteOp","stored","node","nextId","createInsertOp","id","rest","source","\"rotation\""],"sources":["../../../../src/interactions/actions/defaults/sliceOps.ts"],"sourcesContent":["import { boundsOfPath, hasOpenSubpath, type Path } from '@weasel-js/geom';\nimport { splitPathByPolyline, snipPathByPolyline } from '@weasel-js/geom/booleans';\nimport type { Op } from 'core/ops/types';\nimport { createDeleteOp } from 'core/ops/delete';\nimport { createInsertOp } from 'core/ops/create';\n\n/** The fields a slice reads from and writes to a node. */\nexport interface SliceableNode {\n id: string;\n pose: unknown;\n data: unknown;\n}\n\n/** One scene leaf a cut is tested against. */\nexport interface SliceLeaf<TNode extends SliceableNode = SliceableNode> {\n /** The whole node, which the delete op carries so undo restores it intact. */\n node: TNode;\n /** Its ordinal among its siblings: where the delete's undo puts it back,\n * and where its pieces go in. */\n index: number;\n /** Its path with every pose above it baked in: the space the cut is in. */\n worldPath: Path;\n}\n\ninterface SliceBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Arguments to {@link computeSliceOps}. */\nexport interface ComputeSliceOpsArgs<TNode extends SliceableNode = SliceableNode> {\n leaves: readonly SliceLeaf<TNode>[];\n /** The cut, a polyline in world space. A last point equal to the first\n * closes it into a loop. */\n cut: ReadonlyArray<{ x: number; y: number }>;\n /** Mints the id of each piece. */\n nextId: () => string;\n /** The selection before the cut. Given, the result carries the selection\n * after it; omitted, `nextSelection` is `null`. */\n selection?: readonly string[];\n /** How a piece, cut in world space, is stored on its node. By default the\n * pose is the source's with the piece's bounds and no rotation, and the\n * path is the world piece itself, so any rotation is baked into it. A\n * scene with rotated poses or parent frames maps the piece back into the\n * node's own frame here. */\n placePiece?: (leaf: SliceLeaf<TNode>, piece: Path) => SlicePiece;\n}\n\n/** One piece as it is stored: the node's pose and its `data.path`. */\nexport interface SlicePiece {\n pose: unknown;\n path: Path;\n}\n\n/** Result of {@link computeSliceOps}. */\nexport interface ComputeSliceResult {\n /** A delete per cut leaf followed by an insert per piece, as one batch. */\n ops: Op[];\n /**\n * The selection after the cut: the cut sources dropped, the pieces of each\n * selected one added, everything else kept. `null` when no selection was\n * given or nothing was cut. It is not an op, so the caller sets it after\n * the batch commits; undo restores the one before either way.\n */\n nextSelection: string[] | null;\n}\n\n/**\n * Cut `leaves` along `cut` and return the ops that swap each crossed leaf for\n * its pieces.\n *\n * A path with an open subpath is snipped along its stroke\n * (`snipPathByPolyline`); a closed one is knifed into closed pieces\n * (`splitPathByPolyline`), which is also where a closed loop cuts out the\n * region it encloses. Each piece copies its source's node with the piece as\n * `data.path` and a fresh id. Leaves the cut misses produce nothing.\n */\nexport function computeSliceOps<TNode extends SliceableNode>(\n args: ComputeSliceOpsArgs<TNode>,\n): ComputeSliceResult {\n const { cut, nextId, selection } = args;\n const placePiece = args.placePiece\n ?? ((leaf: SliceLeaf<TNode>, piece: Path): SlicePiece => ({ pose: piecePose(leaf.node.pose, boundsOfPath(piece)), path: piece }));\n const ops: Op[] = [];\n const selected = new Set(selection ?? []);\n const cutIds = new Set<string>();\n const inherited: string[] = [];\n\n // Highest slot first: swapping a leaf changes how many siblings sit below\n // the next one only when the next one is above it.\n const ordered = args.leaves.map((leaf, i) => ({ leaf, i })).sort((a, b) => b.leaf.index - a.leaf.index || a.i - b.i);\n\n for (const { leaf } of ordered) {\n const pieces = hasOpenSubpath(leaf.worldPath)\n ? snipPathByPolyline(leaf.worldPath, cut)\n : splitPathByPolyline(leaf.worldPath, cut);\n if (!pieces) continue;\n\n const sourceId = leaf.node.id;\n cutIds.add(sourceId);\n ops.push(createDeleteOp({ node: leaf.node, index: leaf.index, label: 'Slice' }));\n for (const piece of pieces) {\n const stored = placePiece(leaf, piece);\n const node = {\n ...leaf.node,\n id: nextId(),\n pose: stored.pose,\n data: { ...(leaf.node.data as object), path: stored.path },\n };\n ops.push(createInsertOp({ node, index: leaf.index, label: 'Slice' }));\n if (selected.has(sourceId)) inherited.push(node.id);\n }\n }\n\n const nextSelection = selection && cutIds.size > 0\n ? [...selection.filter((id) => !cutIds.has(id)), ...inherited]\n : null;\n return { ops, nextSelection };\n}\n\nfunction piecePose(source: unknown, b: SliceBounds): SliceBounds {\n const rest = source && typeof source === 'object' ? { ...(source as Record<string, unknown>) } : {};\n delete rest['rotation'];\n return { ...rest, x: b.x, y: b.y, width: b.width, height: b.height };\n}\n"],"mappings":";;;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IAC7C,CAAC,GAAGD,EAAU,QAAQ,MAAO,CAACC,EAAO,IAAIgB,CAAE,CAAC,GAAG,GAAGf,CAAS,IAC3D;CACwB;AAC9B;AAEA,SAASR,EAAU,GAAiB,GAA6B;CAC/D,IAAMwB,IAAOC,KAAU,OAAOA,KAAW,WAAW,EAAE,GAAIA,EAAmC,IAAI,CAAC;CAElG,OADA,OAAOD,EAAKE,UACL;EAAE,GAAGF;EAAM,GAAGd,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO;AACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolActivate.js","names":["TOOL_ACTIVATE_ID","buildToolActivateBindings","specs","mods","keyOpts","makeToolActivateAction","bindings","activeTool","deps","toolId","params","isEligible"],"sources":["../../../../src/interactions/actions/defaults/toolActivate.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { BoundGesture } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\n\n/** Canonical id of the consolidated tool-activation action. One descriptor\n * serves every tool; the matched binding (or imperative caller) supplies\n * `params.toolId` to select which tool to activate. */\nexport const TOOL_ACTIVATE_ID = 'tool.activate';\n\n/** Per-tool key spec consumed by `makeToolActivateAction`. `mod/alt/shift`\n * sit at the top level, mirroring the `KeyBinding` shape tools declare. */\nexport interface ToolActivateKeyOpts {\n key: string;\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Single entry pairing a tool id with the key spec that activates it. */\nexport interface ToolActivateBindingSpec {\n toolId: string;\n keyOpts: ToolActivateKeyOpts;\n}\n\n/** Build the per-tool `BoundGesture` list for the consolidated action's\n * `defaultBinding`. Each entry carries `opts.params.toolId` so the\n * invoker's `run` can pick out which tool to activate. */\nexport function buildToolActivateBindings(\n specs: readonly ToolActivateBindingSpec[],\n): BoundGesture[] {\n return specs.map(({ toolId, keyOpts }) => {\n // Modifiers belong under `mods` (a `ModSpec`), not at the top level of\n // the spec
|
|
1
|
+
{"version":3,"file":"toolActivate.js","names":["TOOL_ACTIVATE_ID","buildToolActivateBindings","specs","mods","keyOpts","makeToolActivateAction","bindings","activeTool","deps","toolId","params","isEligible"],"sources":["../../../../src/interactions/actions/defaults/toolActivate.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { BoundGesture } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\n\n/** Canonical id of the consolidated tool-activation action. One descriptor\n * serves every tool; the matched binding (or imperative caller) supplies\n * `params.toolId` to select which tool to activate. */\nexport const TOOL_ACTIVATE_ID = 'tool.activate';\n\n/** Per-tool key spec consumed by `makeToolActivateAction`. `mod/alt/shift`\n * sit at the top level, mirroring the `KeyBinding` shape tools declare. */\nexport interface ToolActivateKeyOpts {\n key: string;\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Single entry pairing a tool id with the key spec that activates it. */\nexport interface ToolActivateBindingSpec {\n toolId: string;\n keyOpts: ToolActivateKeyOpts;\n}\n\n/** Build the per-tool `BoundGesture` list for the consolidated action's\n * `defaultBinding`. Each entry carries `opts.params.toolId` so the\n * invoker's `run` can pick out which tool to activate. */\nexport function buildToolActivateBindings(\n specs: readonly ToolActivateBindingSpec[],\n): BoundGesture[] {\n return specs.map(({ toolId, keyOpts }) => {\n // Modifiers belong under `mods` (a `ModSpec`), not at the top level of\n // the spec: the matcher treats an absent modifier as \"must NOT be held\".\n const mods: Record<string, boolean | 'optional'> = {};\n if (keyOpts.mod !== undefined) mods.mod = keyOpts.mod;\n if (keyOpts.alt !== undefined) mods.alt = keyOpts.alt;\n if (keyOpts.shift !== undefined) mods.shift = keyOpts.shift;\n return {\n spec: {\n kind: 'key',\n key: keyOpts.key,\n ...(Object.keys(mods).length > 0 ? { mods } : {}),\n },\n opts: { params: { toolId } },\n } as BoundGesture;\n });\n}\n\n/** Build the consolidated `tool.activate` action. `bindings` enumerates one\n * `{ spec, opts: { params: { toolId } } }` per tool. Imperative callers reach\n * the same effect via `registry.trigger('tool.activate', { toolId })`.\n *\n * `isEligible` gates activation per tool, which the static per-action\n * `Action.eligible` cannot. Omit it for consumers with no mode registry. */\nexport function makeToolActivateAction(\n bindings: BoundGesture[],\n isEligible?: (toolId: string) => boolean,\n): Action {\n const invoker: ImmediateInvoker = {\n timing: 'immediate',\n run: (deps, params) => {\n const activeTool = deps.activeTool;\n const toolId = params?.toolId as string | undefined;\n if (!activeTool || !toolId) return;\n // Grayed out in the palette ⇒ not reachable by shortcut either.\n if (isEligible && !isEligible(toolId)) return;\n activeTool.setActive(toolId);\n },\n };\n\n return {\n id: TOOL_ACTIVATE_ID,\n label: 'Activate tool',\n defaultBinding: bindings,\n scope: 'hotkey',\n invoker,\n requires: ['activeTool'],\n } as Action & { requires: string[] };\n}\n"],"mappings":";AAOA,IAAaA,IAAmB;AAoBhC,SAAgBC,EACd,GACgB;CAChB,OAAOC,EAAM,KAAK,EAAE,WAAQ,iBAAc;EAGxC,IAAMC,IAA6C,CAAC;EAIpD,OAHIC,EAAQ,QAAQ,KAAA,MAAW,EAAK,MAAMA,EAAQ,MAC9CA,EAAQ,QAAQ,KAAA,MAAW,EAAK,MAAMA,EAAQ,MAC9CA,EAAQ,UAAU,KAAA,MAAW,EAAK,QAAQA,EAAQ,QAC/C;GACL,MAAM;IACJ,MAAM;IACN,KAAKA,EAAQ;IACb,GAAI,OAAO,KAAKD,CAAI,CAAC,CAAC,SAAS,IAAI,EAAE,QAAK,IAAI,CAAC;GACjD;GACA,MAAM,EAAE,QAAQ,EAAE,UAAO,EAAE;EAC7B;CACF,CAAC;AACH;AAQA,SAAgBE,EACd,GACA,GACQ;CAaR,OAAO;EACL,IAAIL;EACJ,OAAO;EACP,gBAAgBM;EAChB,OAAO;EACP,SAAA;GAhBA,QAAQ;GACR,MAAM,GAAM,MAAW;IACrB,IAAMC,IAAaC,EAAK,YAClBC,IAASC,GAAQ;IACvB,AAAKH,KAAeE,MAEhB,MAAeE,EAAWF,CAAM,MACpCF,EAAW,UAAUE,CAAM;GAC7B;EAQA;EACA,UAAU,CAAC,YAAY;CACzB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolResetToDefault.js","names":["TOOL_RESET_TO_DEFAULT_ID","makeToolResetToDefaultAction","activeTool","deps","target","getTarget","ActionDisabledReason"],"sources":["../../../../src/interactions/actions/defaults/toolResetToDefault.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\n\n/** Canonical id of the \"Escape returns to the default tool\" action. */\nexport const TOOL_RESET_TO_DEFAULT_ID = 'tool.resetToDefault';\n\n/**\n * Build the Escape-returns-to-default-tool action.\n *\n *
|
|
1
|
+
{"version":3,"file":"toolResetToDefault.js","names":["TOOL_RESET_TO_DEFAULT_ID","makeToolResetToDefaultAction","activeTool","deps","target","getTarget","ActionDisabledReason"],"sources":["../../../../src/interactions/actions/defaults/toolResetToDefault.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\n\n/** Canonical id of the \"Escape returns to the default tool\" action. */\nexport const TOOL_RESET_TO_DEFAULT_ID = 'tool.resetToDefault';\n\n/**\n * Build the Escape-returns-to-default-tool action.\n *\n * It joins the dispatcher's Escape order, which is first-match-wins, at\n * ambient scope, the lowest priority, so one Escape press does exactly one\n * thing, in this order:\n *\n * 1. cancel an in-flight gesture\n * 2. exit path-anchor edit mode\n * 3. clear the selection\n * 4. return to the default tool ← this action\n *\n * `getTarget` returns the tool id to return to, or `null` when the behavior\n * is disabled (consumer passed `defaultTool: null`) or already satisfied.\n */\nexport function makeToolResetToDefaultAction(\n getTarget: () => string | null,\n): Action {\n const invoker: ImmediateInvoker = {\n timing: 'immediate',\n run: (deps) => {\n const activeTool = deps.activeTool;\n const target = getTarget();\n if (!activeTool || !target) return;\n activeTool.setActive(target);\n },\n };\n\n return {\n id: TOOL_RESET_TO_DEFAULT_ID,\n label: 'Return to default tool',\n defaultBinding: { kind: 'key', key: 'Escape' },\n invoker,\n requires: ['activeTool'],\n // Report disabled (rather than silently no-op'ing) when there's nothing\n // to return to, so the dispatcher falls through and the keypress isn't\n // swallowed.\n enabled: () => (getTarget() ? true : ActionDisabledReason.NotApplicable),\n } as Action & { requires: string[] };\n}\n"],"mappings":";;AAKA,IAAaA,IAA2B;AAiBxC,SAAgBC,EACd,GACQ;CAWR,OAAO;EACL,IAAID;EACJ,OAAO;EACP,gBAAgB;GAAE,MAAM;GAAO,KAAK;EAAS;EAC7C,SAAA;GAbA,QAAQ;GACR,MAAM,MAAS;IACb,IAAME,IAAaC,EAAK,YAClBC,IAASC,EAAU;IACzB,AAAKH,KAAeE,KACpBF,EAAW,UAAUE,CAAM;GAC7B;EAOA;EACA,UAAU,CAAC,YAAY;EAIvB,eAAgBC,EAAU,IAAI,KAAOC,EAAqB;CAC5D;AACF"}
|
|
@@ -23,7 +23,7 @@ var i = {
|
|
|
23
23
|
start(i, a) {
|
|
24
24
|
let o = i.deps.view;
|
|
25
25
|
if (!o) return {};
|
|
26
|
-
let s = o.get(), c = t(a?.params) ?? {}, l = c.inertia === !
|
|
26
|
+
let s = o.get(), c = t(a?.params) ?? {}, l = c.inertia === !0 ? {} : c.inertia || void 0, u = {
|
|
27
27
|
startView: s,
|
|
28
28
|
base: s,
|
|
29
29
|
baseScreen: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewportDragPan.js","names":["screenDeltaFromWorld","v0","scratch","now","drag","sameCamera","a","b","viewportDragPanAction","view","ctx","startView","params","resolveParams","opts","inertia","createVelocityTracker","debug","grab","moveCtx","screen","screenDx","screenDy","sv","next","v","reason","tracker","scale","vx","vy","cur","dx","dy"],"sources":["../../../../src/interactions/actions/defaults/viewportDragPan.ts"],"sourcesContent":["/**\n * `viewportDragPanAction` — ongoing Action descriptor for drag-to-pan the viewport.\n *\n * ## Bindings\n * None of its own. The hand tool binds a drag to it, and a canvas that pans on\n * any unclaimed drag adds `dragPanContribution`.\n *\n * ## Design notes\n * The drag delta from the dispatcher is in screen space (pixels). The pan\n * formula converts screen pixels to world units by dividing by zoom:\n *\n * newView.x = startView.x - screenDx / startView.scale.x\n * newView.y = startView.y - screenDy / startView.scale.y\n *\n * where `screenDx` / `screenDy` are the screen-space pixel deltas from the\n * drag origin. This ensures that at any zoom level, the drag behavior is\n * consistent: 1 screen pixel always pans the same amount relative to the\n * viewport's zoom (e.g., at 1x zoom: 100px → 100 world units; at 2x zoom:\n * 100px → 50 world units). The camera moves opposite to the drag direction\n * so that the scene content appears to follow the pointer.\n *\n * The descriptor captures `startView` in its own scratch at `start` time,\n * parallel to `useHandTool`'s `startView` capture in its scratch object.\n *\n * ## Axis locking and inertia\n * Both are read from the binding's `params` at `start`, so any consumer\n * binding this action gets them — not just `useHandTool`. `axis` drops one\n * component of every pan delta. `inertia` coasts the view after release,\n * through the optional `view.decay` dep; with no such dep wired the pan\n * simply lands, which is what an unconfigured consumer already expects.\n *\n * @see useHandTool — the React hook this descriptor parallels.\n */\n\nimport type { Action } from '@weasel-js/routing';\nimport { resolveParams, type InvocationCtx, type OngoingHandle, type BindingOpts } from '@weasel-js/routing';\nimport type { View } from 'core/viewport/view';\nimport type { ViewApi } from '../depSchema';\nimport type { InertiaConfig } from 'core/viewport/useDecayLoop';\nimport { createVelocityTracker, type VelocityTracker } from 'core/viewport/createVelocityTracker';\n\n// ---------------------------------------------------------------------------\n// Internal scratch\n// ---------------------------------------------------------------------------\n\ninterface DragPanScratch {\n startView: View;\n /** The view the pan is measured from, and the cumulative screen delta it\n * was taken at. The press, until something else moves the camera. */\n base: View;\n baseScreen: { x: number; y: number };\n /** The view as this pan last left it. */\n seen: View;\n view: ViewApi;\n axis: 'both' | 'x' | 'y';\n inertia: InertiaConfig | undefined;\n tracker: VelocityTracker | undefined;\n lastScreen: { x: number; y: number };\n}\n\n/**\n * Rebuild the client-pixel drag delta from the world one, for an event source\n * that supplied no `clientX`/`clientY`.\n *\n * A world delta is self-referential mid-pan — its two ends were measured under\n * different views — so it cannot simply be scaled. Undoing each end against the\n * view that produced it recovers the client delta exactly, since\n * `world = (client - origin) / scale + view` and neither the canvas origin nor\n * the scale moves during a pan.\n */\nfunction screenDeltaFromWorld(\n drag: NonNullable<InvocationCtx['drag']>,\n scratch: DragPanScratch,\n): { x: number; y: number } {\n const v0 = scratch.startView;\n const now = scratch.view.get();\n return {\n x: (drag.current.x - now.x - (drag.start.x - v0.x)) * v0.scale.x,\n y: (drag.current.y - now.y - (drag.start.y - v0.y)) * v0.scale.y,\n };\n}\n\nfunction sameCamera(a: View, b: View): boolean {\n return a === b\n || (a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y);\n}\n\n/** Binding params `viewport.dragPan` understands. `useHandTool` supplies both;\n * a bare binding supplies neither and pans both axes with no coasting. */\nexport interface DragPanParams {\n axis?: 'both' | 'x' | 'y';\n inertia?: false | InertiaConfig;\n}\n\n// ---------------------------------------------------------------------------\n// Descriptor\n// ---------------------------------------------------------------------------\n\n/**\n * @experimental\n * Static descriptor for the `viewport.dragPan` Action.\n *\n * Requires dep-schema entry: `view`.\n *\n * Translates the viewport by the screen-space drag delta so the canvas content\n * follows the pointer. Produces no scene ops — view changes are not undoable.\n */\n// No `eligible` field → viewport pan is always eligible across all modes.\nexport const viewportDragPanAction: Action & { requires: string[] } = {\n id: 'viewport.dragPan',\n label: 'Drag to pan viewport',\n group: 'viewport',\n // Hover hint: when this action would win the drag at the hovered point\n // (e.g. empty canvas with no marquee-capable tool ahead of it), the\n // hover-cursor pump shows the open hand.\n cursor: 'grab',\n // ...and the closed hand once the pan is actually running. This was\n // `useHandTool`'s `engaged: { cursor: 'grabbing' }` — a phase-table entry\n // on a tool, which meant a consumer who bound `viewport.dragPan` without\n // the hand tool got no state cursor at all.\n activeCursor: 'grabbing',\n requires: ['view', 'debug'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const view = ctx.deps.view;\n if (!view) return {};\n\n const startView = view.get();\n // Gesture-driven ongoing actions never see `ctx.params` — the dispatcher\n // hands the binding's unresolved `opts` here and nowhere else, and pumps\n // `onMove` / `onEnd` with an empty deps bag. Everything the gesture needs\n // has to be captured now.\n const params = (resolveParams(opts?.params) ?? {}) as DragPanParams;\n const inertia = params.inertia === false ? undefined : params.inertia;\n const scratch: DragPanScratch = {\n startView,\n base: startView,\n baseScreen: { x: 0, y: 0 },\n seen: startView,\n view,\n axis: params.axis ?? 'both',\n inertia,\n // Only track when a coast could actually happen, so the common\n // no-inertia drag does no per-move work.\n tracker: inertia && view.decay ? createVelocityTracker() : undefined,\n lastScreen: { x: 0, y: 0 },\n };\n const debug = ctx.deps.debug;\n const grab = ctx.drag?.start;\n\n return {\n kind: 'pan',\n onMove(moveCtx: InvocationCtx): void {\n if (!moveCtx.drag) return;\n // Use `screenDelta` (client/CSS pixels), NOT `delta` (world). Pan\n // mutates the view itself, so world deltas are self-referential —\n // after the first commit, `toWorld(currentClient)` returns a\n // position offset by the just-applied pan, halving the apparent\n // movement on every subsequent pointermove. Screen coords come\n // straight from the DOM event and don't drift.\n const screen = moveCtx.drag.screenDelta ?? screenDeltaFromWorld(moveCtx.drag, scratch);\n // An axis lock drops the other component of the *cumulative* delta,\n // so the locked axis never moves however the pointer wanders.\n const screenDx = scratch.axis === 'y' ? 0 : screen.x;\n const screenDy = scratch.axis === 'x' ? 0 : screen.y;\n scratch.tracker?.record(\n screenDx - scratch.lastScreen.x,\n screenDy - scratch.lastScreen.y,\n performance.now(),\n );\n // A zoom or pan from elsewhere while the drag is held (a wheel, a\n // key) is kept: the pan carries on from where it left the camera.\n const now = scratch.view.get();\n if (!sameCamera(now, scratch.seen)) {\n scratch.base = now;\n scratch.baseScreen = scratch.lastScreen;\n }\n scratch.lastScreen = { x: screenDx, y: screenDy };\n const sv = scratch.base;\n // 1 screen px maps to 1/scale world units (at 2x zoom, 100 px →\n // 50 world units of pan).\n const next = {\n ...sv,\n x: sv.x - (screenDx - scratch.baseScreen.x) / sv.scale.x,\n y: sv.y - (screenDy - scratch.baseScreen.y) / sv.scale.y,\n };\n scratch.view.set(next);\n scratch.seen = scratch.view.get();\n debug?.recordViewport('pan', sv, next, grab && { x: grab.x, y: grab.y });\n },\n onEnd(_endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n // No scene ops to commit; the pan itself is already live. What is\n // left is the coast, and only for a drag that actually ended.\n const { tracker, inertia, view: v } = scratch;\n if (reason === 'cancel' || !tracker || !inertia || !v.decay) return;\n const { vx, vy } = tracker.getVelocity();\n const scale = scratch.base.scale;\n v.decay({\n // Screen px/ms → world units/ms, matching the onMove conversion.\n velocity: { vx: -vx / scale.x, vy: -vy / scale.y },\n friction: inertia.friction,\n minSpeed: inertia.minSpeed,\n boundary: inertia.boundary,\n viewBounds: inertia.bounds,\n initialPosition: { x: v.get().x, y: v.get().y },\n onTick: (dx, dy) => {\n const cur = v.get();\n v.set({ ...cur, x: cur.x + dx, y: cur.y + dy });\n },\n });\n },\n };\n },\n },\n enabled: () => true,\n};\n"],"mappings":";;;AAsEA,SAASA,EACP,GACA,GAC0B;CAC1B,IAAMC,IAAKC,EAAQ,WACbC,IAAMD,EAAQ,KAAK,IAAI;CAC7B,OAAO;EACL,IAAIE,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM;EAC/D,IAAIG,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM;CACjE;AACF;AAEA,SAASI,EAAW,GAAS,GAAkB;CAC7C,OAAOC,MAAMC,KACPD,EAAE,MAAMC,EAAE,KAAKD,EAAE,MAAMC,EAAE,KAAKD,EAAE,MAAM,MAAMC,EAAE,MAAM,KAAKD,EAA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rB,EAAQ,MAGbsB,IAAO;MACX,GAAGD;MACH,GAAGA,EAAG,KAAKF,IAAWnB,EAAQ,WAAW,KAAKqB,EAAG,MAAM;MACvD,GAAGA,EAAG,KAAKD,IAAWpB,EAAQ,WAAW,KAAKqB,EAAG,MAAM;KACzD;KAGA,AAFArB,EAAQ,KAAK,IAAIsB,CAAI,GACrB,EAAQ,OAAOtB,EAAQ,KAAK,IAAI,GAChCe,GAAO,eAAe,OAAOM,GAAIC,GAAMN,KAAQ;MAAE,GAAGA,EAAK;MAAG,GAAGA,EAAK;KAAE,CAAC;IACzE;IACA,MAAM,GAAwB,GAAmC;KAG/D,IAAM,EAAE,YAAS,YAAS,MAAMO,MAAMvB;KACtC,IAAIwB,MAAW,YAAY,CAACC,KAAW,CAACZ,KAAW,CAACU,EAAE,OAAO;KAC7D,IAAM,EAAE,OAAI,UAAOE,EAAQ,YAAY,GACjCC,IAAQ1B,EAAQ,KAAK;KAC3B,EAAE,MAAM;MAEN,UAAU;OAAE,IAAI,CAAC2B,IAAKD,EAAM;OAAG,IAAI,CAACE,IAAKF,EAAM;MAAE;MACjD,UAAUb,EAAQ;MAClB,UAAUA,EAAQ;MAClB,UAAUA,EAAQ;MAClB,YAAYA,EAAQ;MACpB,iBAAiB;OAAE,GAAGU,EAAE,IAAI,CAAC,CAAC;OAAG,GAAGA,EAAE,IAAI,CAAC,CAAC;MAAE;MAC9C,SAAS,GAAI,MAAO;OAClB,IAAMM,IAAMN,EAAE,IAAI;OAClB,EAAE,IAAI;QAAE,GAAGM;QAAK,GAAGA,EAAI,IAAIC;QAAI,GAAGD,EAAI,IAAIE;OAAG,CAAC;MAChD;KACF,CAAC;IACH;GACF;EACF;CACF;CACA,eAAe;AACjB"}
|
|
1
|
+
{"version":3,"file":"viewportDragPan.js","names":["screenDeltaFromWorld","v0","scratch","now","drag","sameCamera","a","b","viewportDragPanAction","view","ctx","startView","params","resolveParams","opts","inertia","createVelocityTracker","debug","grab","moveCtx","screen","screenDx","screenDy","sv","next","v","reason","tracker","scale","vx","vy","cur","dx","dy"],"sources":["../../../../src/interactions/actions/defaults/viewportDragPan.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { resolveParams, type InvocationCtx, type OngoingHandle, type BindingOpts } from '@weasel-js/routing';\nimport type { View } from 'core/viewport/view';\nimport type { ViewApi } from '../depSchema';\nimport type { InertiaConfig } from 'core/viewport/useDecayLoop';\nimport { createVelocityTracker, type VelocityTracker } from 'core/viewport/createVelocityTracker';\n\ninterface DragPanScratch {\n startView: View;\n /** The view the pan is measured from, and the cumulative screen delta it\n * was taken at. The press, until something else moves the camera. */\n base: View;\n baseScreen: { x: number; y: number };\n /** The view as this pan last left it. */\n seen: View;\n view: ViewApi;\n axis: 'both' | 'x' | 'y';\n inertia: InertiaConfig | undefined;\n tracker: VelocityTracker | undefined;\n lastScreen: { x: number; y: number };\n}\n\n/**\n * Rebuild the client-pixel drag delta from the world one, for an event source\n * that supplied no `clientX`/`clientY`.\n *\n * A world delta is self-referential mid-pan — its two ends were measured under\n * different views — so it cannot simply be scaled. Undoing each end against the\n * view that produced it recovers the client delta exactly, since\n * `world = (client - origin) / scale + view` and neither the canvas origin nor\n * the scale moves during a pan.\n */\nfunction screenDeltaFromWorld(\n drag: NonNullable<InvocationCtx['drag']>,\n scratch: DragPanScratch,\n): { x: number; y: number } {\n const v0 = scratch.startView;\n const now = scratch.view.get();\n return {\n x: (drag.current.x - now.x - (drag.start.x - v0.x)) * v0.scale.x,\n y: (drag.current.y - now.y - (drag.start.y - v0.y)) * v0.scale.y,\n };\n}\n\nfunction sameCamera(a: View, b: View): boolean {\n return a === b\n || (a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y);\n}\n\n/** Binding params `viewport.dragPan` understands, read at `start`. A bare\n * binding pans both axes with no coasting. `inertia` coasts the view after\n * release through the optional `view.decay` dep; with none wired the pan\n * simply lands. `true` coasts with the kit defaults. */\nexport interface DragPanParams {\n axis?: 'both' | 'x' | 'y';\n inertia?: boolean | InertiaConfig;\n}\n\n/**\n * @experimental\n * Translates the viewport by the screen-space drag delta so the canvas content\n * follows the pointer. Produces no scene ops — view changes are not undoable.\n * It has no binding of its own: the hand tool binds a drag to it, and a canvas\n * that pans on any unclaimed drag adds `dragPanContribution`.\n */\n// No `eligible` field → viewport pan is always eligible across all modes.\nexport const viewportDragPanAction: Action & { requires: string[] } = {\n id: 'viewport.dragPan',\n label: 'Drag to pan viewport',\n group: 'viewport',\n cursor: 'grab',\n activeCursor: 'grabbing',\n requires: ['view', 'debug'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const view = ctx.deps.view;\n if (!view) return {};\n\n const startView = view.get();\n // The dispatcher hands the binding's unresolved `opts` here and nowhere\n // else, and pumps `onMove` / `onEnd` with an empty deps bag. Everything\n // the gesture needs has to be captured now.\n const params = (resolveParams(opts?.params) ?? {}) as DragPanParams;\n const inertia = params.inertia === true ? {} : params.inertia || undefined;\n const scratch: DragPanScratch = {\n startView,\n base: startView,\n baseScreen: { x: 0, y: 0 },\n seen: startView,\n view,\n axis: params.axis ?? 'both',\n inertia,\n // Only track when a coast could actually happen, so the common\n // no-inertia drag does no per-move work.\n tracker: inertia && view.decay ? createVelocityTracker() : undefined,\n lastScreen: { x: 0, y: 0 },\n };\n const debug = ctx.deps.debug;\n const grab = ctx.drag?.start;\n\n return {\n kind: 'pan',\n onMove(moveCtx: InvocationCtx): void {\n if (!moveCtx.drag) return;\n // Use `screenDelta` (client/CSS pixels), NOT `delta` (world). Pan\n // mutates the view itself, so world deltas are self-referential and\n // halve the apparent movement on every pointermove after the first.\n const screen = moveCtx.drag.screenDelta ?? screenDeltaFromWorld(moveCtx.drag, scratch);\n // An axis lock drops the other component of the *cumulative* delta,\n // so the locked axis never moves however the pointer wanders.\n const screenDx = scratch.axis === 'y' ? 0 : screen.x;\n const screenDy = scratch.axis === 'x' ? 0 : screen.y;\n scratch.tracker?.record(\n screenDx - scratch.lastScreen.x,\n screenDy - scratch.lastScreen.y,\n performance.now(),\n );\n // A zoom or pan from elsewhere while the drag is held (a wheel, a\n // key) is kept: the pan carries on from where it left the camera.\n const now = scratch.view.get();\n if (!sameCamera(now, scratch.seen)) {\n scratch.base = now;\n scratch.baseScreen = scratch.lastScreen;\n }\n scratch.lastScreen = { x: screenDx, y: screenDy };\n const sv = scratch.base;\n const next = {\n ...sv,\n x: sv.x - (screenDx - scratch.baseScreen.x) / sv.scale.x,\n y: sv.y - (screenDy - scratch.baseScreen.y) / sv.scale.y,\n };\n scratch.view.set(next);\n scratch.seen = scratch.view.get();\n debug?.recordViewport('pan', sv, next, grab && { x: grab.x, y: grab.y });\n },\n onEnd(_endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n // No scene ops to commit; the pan itself is already live. What is\n // left is the coast, and only for a drag that actually ended.\n const { tracker, inertia, view: v } = scratch;\n if (reason === 'cancel' || !tracker || !inertia || !v.decay) return;\n const { vx, vy } = tracker.getVelocity();\n const scale = scratch.base.scale;\n v.decay({\n // Screen px/ms → world units/ms, matching the onMove conversion.\n velocity: { vx: -vx / scale.x, vy: -vy / scale.y },\n friction: inertia.friction,\n minSpeed: inertia.minSpeed,\n boundary: inertia.boundary,\n viewBounds: inertia.bounds,\n initialPosition: { x: v.get().x, y: v.get().y },\n onTick: (dx, dy) => {\n const cur = v.get();\n v.set({ ...cur, x: cur.x + dx, y: cur.y + dy });\n },\n });\n },\n };\n },\n },\n enabled: () => true,\n};\n"],"mappings":";;;AAgCA,SAASA,EACP,GACA,GAC0B;CAC1B,IAAMC,IAAKC,EAAQ,WACbC,IAAMD,EAAQ,KAAK,IAAI;CAC7B,OAAO;EACL,IAAIE,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM;EAC/D,IAAIG,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM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AAe;AACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewportWheelPan.js","names":["viewportWheelPanAction","view","deps","axis","params","deltaX","deltaY","from","next","wheelPan","makeViewportWheelPanAction","opts"],"sources":["../../../../src/interactions/actions/defaults/viewportWheelPan.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"viewportWheelPan.js","names":["viewportWheelPanAction","view","deps","axis","params","deltaX","deltaY","from","next","wheelPan","makeViewportWheelPanAction","opts"],"sources":["../../../../src/interactions/actions/defaults/viewportWheelPan.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { wheelPan } from 'core/viewport/wheelHandler';\n\n/**\n * @experimental\n * Wheel and trackpad pan. Shift+wheel pans horizontally, by routing deltaY\n * into the x axis (`params.swapAxis`). `params.axis` locks the pan to one\n * axis, and outranks `swapAxis`: a shift-wheel routed into a barred axis\n * moves nothing.\n */\nexport const viewportWheelPanAction: Action & { requires: string[] } = {\n id: 'viewport.wheelPan',\n label: 'Pan (wheel)',\n group: 'viewport',\n /**\n * The matcher's strict modifier check keeps the bindings exclusive, and\n * leaves Cmd+wheel to `viewportZoomAction`: omitting `mods` forbids any\n * modifier, and `mods: { shift: true }` forbids the others.\n */\n defaultBinding: [\n { spec: { kind: 'wheel' }, opts: {} },\n { spec: { kind: 'wheel', mods: { shift: true } }, opts: { params: { swapAxis: true } } },\n ],\n requires: ['view', 'debug'],\n invoker: {\n timing: 'immediate',\n run(deps, params) {\n const view = deps.view;\n if (!view) return;\n const axis = (params?.axis as 'both' | 'x' | 'y' | undefined) ?? 'both';\n const deltaX = (params?.deltaX as number | undefined) ?? 0;\n const deltaY = (params?.deltaY as number | undefined) ?? 0;\n const from = view.get();\n const next = wheelPan(from, { deltaX, deltaY }, { axis, swapAxis: params?.swapAxis === true });\n view.set(next);\n deps.debug?.recordViewport('pan', from, next);\n },\n },\n enabled: () => true,\n};\n\n/** Tuning for {@link makeViewportWheelPanAction}. */\nexport interface WheelPanOptions {\n /** Lock the pan to one axis. Default `'both'`. */\n axis?: 'both' | 'x' | 'y';\n}\n\n/** Builds a `viewport.wheelPan` descriptor with `opts` baked into both of its\n * default bindings. `viewportWheelPanAction` is the unconfigured one. */\nexport function makeViewportWheelPanAction(\n opts: WheelPanOptions = {},\n): Action & { requires: string[] } {\n const axis = opts.axis ?? 'both';\n return {\n ...viewportWheelPanAction,\n defaultBinding: [\n { spec: { kind: 'wheel' }, opts: { params: { axis } } },\n { spec: { kind: 'wheel', mods: { shift: true } }, opts: { params: { swapAxis: true, axis } } },\n ],\n };\n}\n"],"mappings":";;AAUA,IAAaA,IAA0D;CACrE,IAAI;CACJ,OAAO;CACP,OAAO;CAMP,gBAAgB,CACd;EAAE,MAAM,EAAE,MAAM,QAAQ;EAAG,MAAM,CAAC;CAAE,GACpC;EAAE,MAAM;GAAE,MAAM;GAAS,MAAM,EAAE,OAAO,GAAK;EAAE;EAAG,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAK,EAAE;CAAE,CACzF;CACA,UAAU,CAAC,QAAQ,OAAO;CAC1B,SAAS;EACP,QAAQ;EACR,IAAI,GAAM,GAAQ;GAChB,IAAMC,IAAOC,EAAK;GAClB,IAAI,CAACD,GAAM;GACX,IAAME,IAAQC,GAAQ,QAA2C,QAC3DC,IAAUD,GAAQ,UAAiC,GACnDE,IAAUF,GAAQ,UAAiC,GACnDG,IAAON,EAAK,IAAI,GAChBO,IAAOC,EAASF,GAAM;IAAE;IAAQ;GAAO,GAAG;IAAE;IAAM,UAAUH,GAAQ,aAAa;GAAK,CAAC;GAE7F,AADAH,EAAK,IAAIO,CAAI,GACbN,EAAK,OAAO,eAAe,OAAOK,GAAMC,CAAI;EAC9C;CACF;CACA,eAAe;AACjB;AAUA,SAAgBE,EACd,IAAwB,CAAC,GACQ;CACjC,IAAMP,IAAOQ,EAAK,QAAQ;CAC1B,OAAO;EACL,GAAGX;EACH,gBAAgB,CACd;GAAE,MAAM,EAAE,MAAM,QAAQ;GAAG,MAAM,EAAE,QAAQ,EAAE,QAAK,EAAE;EAAE,GACtD;GAAE,MAAM;IAAE,MAAM;IAAS,MAAM,EAAE,OAAO,GAAK;GAAE;GAAG,MAAM,EAAE,QAAQ;IAAE,UAAU;IAAM;GAAK,EAAE;EAAE,CAC/F;CACF;AACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_MAX_ZOOM as e, DEFAULT_MIN_ZOOM as t } from "../../../core/viewport/zoomBounds.js";
|
|
2
2
|
import { viewToTransform as n } from "../../../core/viewport/view.js";
|
|
3
3
|
import { screenToWorld as r } from "../../../core/viewport/viewTransform.js";
|
|
4
|
-
import {
|
|
5
|
-
import { wheelZoomFactor as
|
|
4
|
+
import { axisZoomFactor as i, zoomAt as a } from "../../../core/viewport/zoomAt.js";
|
|
5
|
+
import { wheelZoomFactor as o } from "../../../core/viewport/wheelHandler.js";
|
|
6
6
|
//#region src/interactions/actions/defaults/viewportZoom.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var s = 1.25;
|
|
8
|
+
function c(e) {
|
|
9
9
|
let t = e.hostSize?.();
|
|
10
10
|
return t ? {
|
|
11
11
|
x: t.width / 2,
|
|
@@ -15,107 +15,110 @@ function s(e) {
|
|
|
15
15
|
y: 0
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
mods: { mod: !0 }
|
|
25
|
-
}, d = c.animate === !0 ? {} : c.animate || null, { resetMs: f, ...p } = d ?? {}, m = d ? p : null;
|
|
26
|
-
return {
|
|
27
|
-
id: "viewport.zoom",
|
|
28
|
-
label: "Zoom",
|
|
29
|
-
group: "viewport",
|
|
30
|
-
defaultBinding: [
|
|
31
|
-
{
|
|
32
|
-
spec: u,
|
|
33
|
-
opts: { params: { kind: "wheel" } }
|
|
18
|
+
function l(e) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
spec: e === "plain" ? { kind: "wheel" } : {
|
|
22
|
+
kind: "wheel",
|
|
23
|
+
mods: { mod: !0 }
|
|
34
24
|
},
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
opts: { params: { kind: "wheel" } }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
spec: {
|
|
29
|
+
kind: "wheel",
|
|
30
|
+
mods: { ctrl: !0 }
|
|
41
31
|
},
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
opts: { params: { kind: "wheel" } }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
spec: { kind: "pinch" },
|
|
36
|
+
opts: { params: { kind: "pinch" } }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
spec: {
|
|
40
|
+
kind: "key",
|
|
41
|
+
key: "=",
|
|
42
|
+
mods: {
|
|
43
|
+
mod: !0,
|
|
44
|
+
shift: "optional"
|
|
45
|
+
}
|
|
45
46
|
},
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
opts: { params: { kind: "in" } }
|
|
47
|
+
opts: { params: { kind: "in" } }
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
spec: {
|
|
51
|
+
kind: "key",
|
|
52
|
+
key: "-",
|
|
53
|
+
mods: { mod: !0 }
|
|
56
54
|
},
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
opts: { params: { kind: "out" } }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
spec: {
|
|
59
|
+
kind: "key",
|
|
60
|
+
key: "0",
|
|
61
|
+
mods: { mod: !0 }
|
|
64
62
|
},
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
opts: { params: { kind: "reset" } }
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
function u(u = {}) {
|
|
68
|
+
let d = {
|
|
69
|
+
min: u.min ?? t,
|
|
70
|
+
max: u.max ?? e
|
|
71
|
+
}, f = u.axis ?? "both", p = u.animate === !0 ? {} : u.animate || null, { resetMs: m, ...h } = p ?? {}, g = p ? h : null;
|
|
72
|
+
return {
|
|
73
|
+
id: "viewport.zoom",
|
|
74
|
+
label: "Zoom",
|
|
75
|
+
group: "viewport",
|
|
76
|
+
defaultBinding: l(u.wheel),
|
|
74
77
|
requires: ["view", "debug"],
|
|
75
78
|
invoker: {
|
|
76
79
|
timing: "immediate",
|
|
77
80
|
run(e, t) {
|
|
78
|
-
let
|
|
79
|
-
if (!
|
|
80
|
-
let u = e.debug,
|
|
81
|
+
let l = e.view;
|
|
82
|
+
if (!l) return;
|
|
83
|
+
let u = e.debug, p = l.get(), h = (e, t, i) => {
|
|
81
84
|
if (!u) return;
|
|
82
85
|
let [a, o] = r(i.x, i.y, n(e));
|
|
83
86
|
u.recordViewport("zoom", e, t, {
|
|
84
87
|
x: a,
|
|
85
88
|
y: o
|
|
86
89
|
});
|
|
87
|
-
},
|
|
88
|
-
if (!
|
|
89
|
-
|
|
90
|
+
}, _ = t?.kind, v = g !== null && typeof l.animate == "function", y = (e, t) => {
|
|
91
|
+
if (!v) {
|
|
92
|
+
l.set(e);
|
|
90
93
|
return;
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
...
|
|
94
|
-
ms: t ??
|
|
95
|
+
l.animate(e, {
|
|
96
|
+
...g,
|
|
97
|
+
ms: t ?? g.ms
|
|
95
98
|
});
|
|
96
|
-
},
|
|
99
|
+
}, b = () => v && l.animationTarget?.() || p, x = () => ({
|
|
97
100
|
x: t?.clientX ?? 0,
|
|
98
101
|
y: t?.clientY ?? 0
|
|
99
|
-
}),
|
|
102
|
+
}), S = (e) => {
|
|
100
103
|
if (!(e > 0) || !Number.isFinite(e)) return;
|
|
101
|
-
let t =
|
|
102
|
-
|
|
104
|
+
let t = a(p, x(), i(e, f), d);
|
|
105
|
+
l.set(t), h(p, t, x());
|
|
103
106
|
};
|
|
104
|
-
switch (
|
|
107
|
+
switch (_) {
|
|
105
108
|
case "wheel":
|
|
106
|
-
|
|
109
|
+
S(o(t?.deltaY ?? 0));
|
|
107
110
|
break;
|
|
108
111
|
case "pinch":
|
|
109
|
-
|
|
112
|
+
S(t?.scale ?? NaN);
|
|
110
113
|
break;
|
|
111
114
|
case "in":
|
|
112
115
|
case "out": {
|
|
113
|
-
let e =
|
|
114
|
-
|
|
116
|
+
let e = b(), t = i(_ === "in" ? s : 1 / s, f), n = a(e, c(l), t, d);
|
|
117
|
+
y(n), h(e, n, c(l));
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
117
120
|
case "reset": {
|
|
118
|
-
let e =
|
|
121
|
+
let e = l.recenter ? l.recenter() : {
|
|
119
122
|
x: 0,
|
|
120
123
|
y: 0,
|
|
121
124
|
scale: {
|
|
@@ -123,21 +126,21 @@ function c(c = {}) {
|
|
|
123
126
|
y: 1
|
|
124
127
|
}
|
|
125
128
|
};
|
|
126
|
-
e &&
|
|
129
|
+
e && y(e, m);
|
|
127
130
|
break;
|
|
128
131
|
}
|
|
129
|
-
default: t === void 0 &&
|
|
132
|
+
default: t === void 0 && l.set(a(p, {
|
|
130
133
|
x: 0,
|
|
131
134
|
y: 0
|
|
132
|
-
},
|
|
135
|
+
}, i(s, f), d));
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
},
|
|
136
139
|
enabled: () => !0
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
|
-
var
|
|
142
|
+
var d = u();
|
|
140
143
|
//#endregion
|
|
141
|
-
export {
|
|
144
|
+
export { u as makeViewportZoomAction, d as viewportZoomAction };
|
|
142
145
|
|
|
143
146
|
//# sourceMappingURL=viewportZoom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewportZoom.js","names":["KEY_STEP","keyAnchor","size","view","makeViewportZoomAction","clamp","opts","DEFAULT_MIN_ZOOM","DEFAULT_MAX_ZOOM","wheelSpec","rawAnimate","animateRest","tweenOpts","deps","debug","current","record","wx","wy","screenToWorld","anchor","viewToTransform","from","to","kind","params","canAnimate","stepTo","target","ms","stepFrom","focal","scaleBy","factor","next","zoomAt","wheelZoomFactor","resetMs","viewportZoomAction"],"sources":["../../../../src/interactions/actions/defaults/viewportZoom.ts"],"sourcesContent":["/**\n * `viewportZoomAction` — immediate Action descriptor for viewport zoom.\n *\n * ## Bindings (parametric — each passes `params.kind`)\n * - `{ kind: 'wheel', mods: { mod: true } }` → Cmd+wheel, params: `{ kind: 'wheel' }`\n * - `{ kind: 'wheel', mods: { ctrl: true } }` → trackpad pinch, params: `{ kind: 'wheel' }`.\n * Browsers synthesize a trackpad pinch as ctrl+wheel. On a Mac that is a\n * *different* event from the `mod` binding above (`mod` is metaKey there), so\n * pinch needs its own binding or nothing claims it and the page zooms instead.\n * - `{ kind: 'pinch' }` → Safari trackpad pinch (WebKit `gesturechange`),\n * params: `{ kind: 'pinch' }`. Safari may send the same pinch as ctrl+wheel\n * as well; the dispatcher swallows that copy while a claimed gesture is live,\n * so only one of the two bindings fires per pinch.\n * - `{ kind: 'key', key: '=' }` → zoom in, params: `{ kind: 'in' }`\n * - `{ kind: 'key', key: '-' }` → zoom out, params: `{ kind: 'out' }`\n * - `{ kind: 'key', key: '0' }` → reset zoom, params: `{ kind: 'reset' }`\n *\n * ## Design notes\n * The invoker switches on `params.kind`:\n * - `'wheel'` and `'pinch'`: both reduce to a scale factor about a focal\n * point and share one `zoomAt` call. A wheel sample's factor is\n * `wheelZoomFactor(deltaY)`, the kit's one statement of the wheel\n * convention; a pinch sample carries its factor as `scale`. The dispatcher\n * merges event data into params and converts client coords to canvas-local\n * (subtracting the canvas's bounding rect) before merging — `zoomAt`\n * expects canvas-local.\n * - `'in'`/`'out'`: step zoom by ×1.25 / ×0.8, anchored at the host center\n * when the `view` dep wires `hostSize()` (SceneCanvas does), falling back\n * to the canvas top-left origin for consumers that don't.\n * - `'reset'`: resets scale to 1, translation to 0, or calls the `view` dep's\n * `recenter()`.\n *\n * The three discrete branches glide instead of jumping when the `animate`\n * option is configured and the `view` dep implements `animate` — they hand the\n * action a target and nothing in between, which is the whole condition for\n * tweening. `'wheel'` and `'pinch'` always jump per sample.\n *\n * ## Key binding modifier notes\n * The key bindings (`=`, `-`, `0`) require `mod: true` (Cmd on Mac, Ctrl elsewhere).\n * This matches the behaviour of the dissolved `useKeyboardZoomTool`.\n */\n\nimport type { Action } from '@weasel-js/routing';\nimport type { ViewApi } from '../depSchema';\nimport { zoomAt } from 'core/viewport/zoomAt';\nimport { wheelZoomFactor } from 'core/viewport/wheelHandler';\nimport { DEFAULT_MIN_ZOOM, DEFAULT_MAX_ZOOM } from 'core/viewport/zoomBounds';\nimport { viewToTransform, type View } from 'core/viewport/view';\nimport { screenToWorld } from 'core/viewport/viewTransform';\nimport type { ViewAnimationOptions } from 'core/viewport/useViewAnimation';\n\n// Multiplicative step for keyboard zoom (matches useKeyboardZoomTool default).\nconst KEY_STEP = 1.25;\n\n/** Keyboard-zoom anchor: the host center when the view dep can measure it,\n * else the canvas top-left origin (see design notes). */\nfunction keyAnchor(view: ViewApi): { x: number; y: number } {\n const size = view.hostSize?.();\n return size ? { x: size.width / 2, y: size.height / 2 } : { x: 0, y: 0 };\n}\n// ---------------------------------------------------------------------------\n// Descriptor\n// ---------------------------------------------------------------------------\n\n/**\n * @experimental\n * Tuning for the animated form of the discrete zoom steps.\n */\nexport interface ViewportZoomAnimateOptions extends ViewAnimationOptions {\n /** Duration for the Cmd+0 reset branch. Defaults to `ms`. */\n resetMs?: number;\n}\n\n/**\n * @experimental\n * Tuning for {@link makeViewportZoomAction}.\n */\nexport interface ViewportZoomOptions {\n /**\n * Which wheel gesture triggers zoom.\n * - `'mod'` (default): Cmd/Ctrl+wheel — coexists with plain-wheel pan\n * (`viewport.wheelPan`). A Mac trackpad pinch arrives as ctrl+wheel, which\n * `mod: true` forbids on Mac; nothing here handles it.\n * - `'plain'`: bare wheel, no modifier. Pair with `viewport.pan: false`,\n * since plain wheel otherwise drives pan and the two would compete.\n */\n wheel?: 'plain' | 'mod';\n /** Lower clamp on the resulting view scale, forwarded to `zoomAt`. Default 0.1. */\n min?: number;\n /** Upper clamp on the resulting view scale, forwarded to `zoomAt`. Default 8. */\n max?: number;\n /**\n * Glide the discrete steps (Cmd+=, Cmd+-, Cmd+0) instead of jumping.\n * `true` uses the kit defaults; an object tunes them. Wheel and pinch never\n * animate — their input already samples every frame. Requires a `view` dep\n * that implements `animate`; without one this is ignored.\n */\n animate?: boolean | ViewportZoomAnimateOptions;\n}\n\n/**\n * @experimental\n * Build a `viewport.zoom` Action descriptor with a configurable wheel trigger\n * and scale clamp. The keyboard bindings (Cmd+=/-/0) are fixed; only the wheel\n * binding and the `zoomAt` clamp vary.\n *\n * Requires dep-schema entry: `view`.\n */\nexport function makeViewportZoomAction(\n opts: ViewportZoomOptions = {},\n): Action & { requires: string[] } {\n const clamp = { min: opts.min ?? DEFAULT_MIN_ZOOM, max: opts.max ?? DEFAULT_MAX_ZOOM };\n // 'plain': bare wheel (omitting `mods` forbids any modifier — see the\n // matcher's strict modifier check). 'mod': Cmd/Ctrl+wheel.\n const wheelSpec =\n opts.wheel === 'plain'\n ? { kind: 'wheel' as const }\n : { kind: 'wheel' as const, mods: { mod: true } };\n\n const rawAnimate: ViewportZoomAnimateOptions | null =\n opts.animate === true ? {} : (opts.animate || null);\n const { resetMs, ...animateRest } = rawAnimate ?? {};\n const tweenOpts: ViewAnimationOptions | null = rawAnimate ? animateRest : null;\n\n return {\n id: 'viewport.zoom',\n label: 'Zoom',\n group: 'viewport',\n defaultBinding: [\n // wheel → wheel zoom (mod-gated by default; plain when configured)\n {\n spec: wheelSpec,\n opts: { params: { kind: 'wheel' } },\n },\n // Trackpad pinch, which the browser delivers as ctrl+wheel. Distinct from\n // the `mod` binding on mac; a duplicate of it elsewhere, where `matchBest`\n // picks a single winner. `viewport.wheelPan` forbids ctrl, so no contest.\n {\n spec: { kind: 'wheel' as const, mods: { ctrl: true } },\n opts: { params: { kind: 'wheel' } },\n },\n // Safari's trackpad pinch, reported as a scale rather than a wheel.\n {\n spec: { kind: 'pinch' as const },\n opts: { params: { kind: 'pinch' } },\n },\n // Cmd+= → zoom in (also accepts Cmd+Shift+= which is Cmd++ on many keyboards)\n {\n spec: { kind: 'key', key: '=', mods: { mod: true, shift: 'optional' } },\n opts: { params: { kind: 'in' } },\n },\n // Cmd+- → zoom out\n {\n spec: { kind: 'key', key: '-', mods: { mod: true } },\n opts: { params: { kind: 'out' } },\n },\n // Cmd+0 → reset zoom\n {\n spec: { kind: 'key', key: '0', mods: { mod: true } },\n opts: { params: { kind: 'reset' } },\n },\n ],\n requires: ['view', 'debug'],\n invoker: {\n timing: 'immediate',\n run(deps, params) {\n const view = deps.view;\n if (!view) return;\n const debug = deps.debug;\n const current = view.get();\n // Report a zoom about `anchor` (canvas-local px) from `from` to `to`.\n const record = (from: View, to: View, anchor: { x: number; y: number }) => {\n if (!debug) return;\n const [wx, wy] = screenToWorld(anchor.x, anchor.y, viewToTransform(from));\n debug.recordViewport('zoom', from, to, { x: wx, y: wy });\n };\n const kind = params?.kind as string | undefined;\n\n const canAnimate = tweenOpts !== null && typeof view.animate === 'function';\n const stepTo = (target: View, ms?: number) => {\n if (!canAnimate) { view.set(target); return; }\n view.animate!(target, { ...tweenOpts!, ms: ms ?? tweenOpts!.ms });\n };\n // Successive presses compound off where the camera is heading, not off\n // whichever frame the tween happens to be on.\n const stepFrom = (): View => (canAnimate && view.animationTarget?.()) || current;\n\n const focal = () => ({\n x: (params?.clientX as number | undefined) ?? 0,\n y: (params?.clientY as number | undefined) ?? 0,\n });\n const scaleBy = (factor: number) => {\n if (!(factor > 0) || !Number.isFinite(factor)) return;\n const next = zoomAt(current, focal(), factor, clamp);\n view.set(next);\n record(current, next, focal());\n };\n\n switch (kind) {\n case 'wheel':\n scaleBy(wheelZoomFactor((params?.deltaY as number | undefined) ?? 0));\n break;\n case 'pinch':\n scaleBy((params?.scale as number | undefined) ?? Number.NaN);\n break;\n case 'in':\n case 'out': {\n const from = stepFrom();\n const target = zoomAt(from, keyAnchor(view), kind === 'in' ? KEY_STEP : 1 / KEY_STEP, clamp);\n stepTo(target);\n record(from, target, keyAnchor(view));\n break;\n }\n case 'reset': {\n // Prefer the consumer-supplied recenter when available — typically\n // re-fits the document page into the workspace. A recenter that\n // returns its target can be animated; one that returns nothing\n // dispatched the view itself and is already done.\n const target = view.recenter\n ? view.recenter()\n : { x: 0, y: 0, scale: { x: 1, y: 1 } };\n if (target) stepTo(target, resetMs);\n break;\n }\n default:\n // Unknown kind — no-op. Legacy bridge calls with params=undefined;\n // default to zoom-in as a sensible fallback.\n if (params === undefined) {\n view.set(zoomAt(current, { x: 0, y: 0 }, KEY_STEP, clamp));\n }\n break;\n }\n },\n },\n enabled: () => true,\n };\n}\n\n/**\n * @experimental\n * Default `viewport.zoom` descriptor: Cmd/Ctrl+wheel zoom with the kit's\n * default 0.1–8 scale clamp. Equivalent to `makeViewportZoomAction()`.\n *\n * Requires dep-schema entry: `view`.\n */\nexport const viewportZoomAction: Action & { requires: string[] } = makeViewportZoomAction();\n"],"mappings":";;;;;;AAoDA,IAAMA,IAAW;AAIjB,SAASC,EAAU,GAAyC;CAC1D,IAAMC,IAAOC,EAAK,WAAW;CAC7B,OAAOD,IAAO;EAAE,GAAGA,EAAK,QAAQ;EAAG,GAAGA,EAAK,SAAS;CAAE,IAAI;EAAE,GAAG;EAAG,GAAG;CAAE;AACzE;AAiDA,SAAgBE,EACd,IAA4B,CAAC,GACI;CACjC,IAAMC,IAAQ;EAAE,KAAKC,EAAK,OAAOC;EAAkB,KAAK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,SAAS,IACd;OAAE,GAAG;OAAG,GAAG;OAAG,OAAO;QAAE,GAAG;QAAG,GAAG;OAAE;MAAE;MACxC,AAAIyB,KAAQD,EAAOC,GAAQS,CAAO;MAClC;KACF;KACA,SAGE,AAAIZ,MAAW,KAAA,KACbtB,EAAK,IAAIgC,EAAOpB,GAAS;MAAE,GAAG;MAAG,GAAG;KAAE,GAAGf,GAAUK,CAAK,CAAC;IAG/D;GACF;EACF;EACA,eAAe;CACjB;AACF;AASA,IAAaiC,IAAsDlC,EAAuB"}
|
|
1
|
+
{"version":3,"file":"viewportZoom.js","names":["KEY_STEP","keyAnchor","size","view","zoomBindings","wheel","makeViewportZoomAction","clamp","opts","DEFAULT_MIN_ZOOM","DEFAULT_MAX_ZOOM","axis","rawAnimate","animateRest","tweenOpts","deps","debug","current","record","wx","wy","screenToWorld","anchor","viewToTransform","from","to","kind","params","canAnimate","stepTo","target","ms","stepFrom","focal","scaleBy","factor","next","zoomAt","axisZoomFactor","wheelZoomFactor","step","resetMs","viewportZoomAction"],"sources":["../../../../src/interactions/actions/defaults/viewportZoom.ts"],"sourcesContent":["import type { Action, BoundGesture } from '@weasel-js/routing';\nimport type { ViewApi } from '../depSchema';\nimport { axisZoomFactor, zoomAt, type ZoomAxis } from 'core/viewport/zoomAt';\nimport { wheelZoomFactor } from 'core/viewport/wheelHandler';\nimport { DEFAULT_MIN_ZOOM, DEFAULT_MAX_ZOOM } from 'core/viewport/zoomBounds';\nimport { viewToTransform, type View } from 'core/viewport/view';\nimport { screenToWorld } from 'core/viewport/viewTransform';\nimport type { ViewAnimationOptions } from 'core/viewport/useViewAnimation';\n\n// Multiplicative step for keyboard zoom (matches useKeyboardZoomTool default).\nconst KEY_STEP = 1.25;\n\n/** Keyboard-zoom anchor: the host center when the view dep can measure it,\n * else the canvas top-left origin. */\nfunction keyAnchor(view: ViewApi): { x: number; y: number } {\n const size = view.hostSize?.();\n return size ? { x: size.width / 2, y: size.height / 2 } : { x: 0, y: 0 };\n}\n\n/**\n * @experimental\n * Tuning for the animated form of the discrete zoom steps.\n */\nexport interface ViewportZoomAnimateOptions extends ViewAnimationOptions {\n /** Duration for the Cmd+0 reset branch. Defaults to `ms`. */\n resetMs?: number;\n}\n\n/**\n * @experimental\n * Tuning for {@link makeViewportZoomAction}.\n */\nexport interface ViewportZoomOptions {\n /**\n * Which wheel gesture triggers zoom.\n * - `'mod'` (default): Cmd/Ctrl+wheel — coexists with plain-wheel pan\n * (`viewport.wheelPan`).\n * - `'plain'`: bare wheel, no modifier. Pair with `viewport.pan: false`,\n * since plain wheel otherwise drives pan and the two would compete.\n */\n wheel?: 'plain' | 'mod';\n /** Lower clamp on the resulting view scale, forwarded to `zoomAt`. Default 0.1. */\n min?: number;\n /** Upper clamp on the resulting view scale, forwarded to `zoomAt`. Default 8. */\n max?: number;\n /** Hold wheel, trackpad-pinch, and key zoom to one axis; the other keeps its\n * scale and its translation. Default `'both'`. Cmd+0 still resets both. */\n axis?: ZoomAxis;\n /**\n * Glide the discrete steps (Cmd+=, Cmd+-, Cmd+0) instead of jumping.\n * `true` uses the kit defaults; an object tunes them. Wheel and pinch never\n * animate — their input already samples every frame. Requires a `view` dep\n * that implements `animate`; without one this is ignored.\n */\n animate?: boolean | ViewportZoomAnimateOptions;\n}\n\n/** The gestures `viewport.zoom` answers: the configurable wheel trigger, then\n * the fixed pinch and key bindings. */\nfunction zoomBindings(wheel: ViewportZoomOptions['wheel']): BoundGesture[] {\n // 'plain': bare wheel (omitting `mods` forbids any modifier — see the\n // matcher's strict modifier check). 'mod': Cmd/Ctrl+wheel.\n const wheelSpec =\n wheel === 'plain'\n ? { kind: 'wheel' as const }\n : { kind: 'wheel' as const, mods: { mod: true } };\n return [\n {\n spec: wheelSpec,\n opts: { params: { kind: 'wheel' } },\n },\n // Trackpad pinch, which the browser delivers as ctrl+wheel. Distinct from\n // the `mod` binding on mac (`mod` is metaKey there), so without its own\n // binding nothing claims it and the page zooms instead. Elsewhere it\n // duplicates `mod`, and `matchBest` picks a single winner.\n {\n spec: { kind: 'wheel' as const, mods: { ctrl: true } },\n opts: { params: { kind: 'wheel' } },\n },\n // Safari's trackpad pinch, reported as a scale rather than a wheel. Safari\n // may send the same pinch as ctrl+wheel too; the dispatcher swallows that\n // copy while a claimed gesture is live.\n {\n spec: { kind: 'pinch' as const },\n opts: { params: { kind: 'pinch' } },\n },\n // Cmd+= → zoom in (also accepts Cmd+Shift+= which is Cmd++ on many keyboards)\n {\n spec: { kind: 'key', key: '=', mods: { mod: true, shift: 'optional' } },\n opts: { params: { kind: 'in' } },\n },\n {\n spec: { kind: 'key', key: '-', mods: { mod: true } },\n opts: { params: { kind: 'out' } },\n },\n {\n spec: { kind: 'key', key: '0', mods: { mod: true } },\n opts: { params: { kind: 'reset' } },\n },\n ];\n}\n\n/**\n * @experimental\n * Build a `viewport.zoom` Action descriptor with a configurable wheel trigger\n * and scale clamp. The keyboard bindings (Cmd+=/-/0) and the two trackpad\n * pinch bindings are fixed. A wheel or pinch sample zooms about its focal\n * point, which `zoomAt` expects in canvas-local pixels.\n */\nexport function makeViewportZoomAction(\n opts: ViewportZoomOptions = {},\n): Action & { requires: string[] } {\n const clamp = { min: opts.min ?? DEFAULT_MIN_ZOOM, max: opts.max ?? DEFAULT_MAX_ZOOM };\n const axis = opts.axis ?? 'both';\n\n const rawAnimate: ViewportZoomAnimateOptions | null =\n opts.animate === true ? {} : (opts.animate || null);\n const { resetMs, ...animateRest } = rawAnimate ?? {};\n const tweenOpts: ViewAnimationOptions | null = rawAnimate ? animateRest : null;\n\n return {\n id: 'viewport.zoom',\n label: 'Zoom',\n group: 'viewport',\n defaultBinding: zoomBindings(opts.wheel),\n requires: ['view', 'debug'],\n invoker: {\n timing: 'immediate',\n run(deps, params) {\n const view = deps.view;\n if (!view) return;\n const debug = deps.debug;\n const current = view.get();\n // Report a zoom about `anchor` (canvas-local px) from `from` to `to`.\n const record = (from: View, to: View, anchor: { x: number; y: number }) => {\n if (!debug) return;\n const [wx, wy] = screenToWorld(anchor.x, anchor.y, viewToTransform(from));\n debug.recordViewport('zoom', from, to, { x: wx, y: wy });\n };\n const kind = params?.kind as string | undefined;\n\n const canAnimate = tweenOpts !== null && typeof view.animate === 'function';\n const stepTo = (target: View, ms?: number) => {\n if (!canAnimate) { view.set(target); return; }\n view.animate!(target, { ...tweenOpts!, ms: ms ?? tweenOpts!.ms });\n };\n // Successive presses compound off where the camera is heading, not off\n // whichever frame the tween happens to be on.\n const stepFrom = (): View => (canAnimate && view.animationTarget?.()) || current;\n\n const focal = () => ({\n x: (params?.clientX as number | undefined) ?? 0,\n y: (params?.clientY as number | undefined) ?? 0,\n });\n const scaleBy = (factor: number) => {\n if (!(factor > 0) || !Number.isFinite(factor)) return;\n const next = zoomAt(current, focal(), axisZoomFactor(factor, axis), clamp);\n view.set(next);\n record(current, next, focal());\n };\n\n switch (kind) {\n case 'wheel':\n scaleBy(wheelZoomFactor((params?.deltaY as number | undefined) ?? 0));\n break;\n case 'pinch':\n scaleBy((params?.scale as number | undefined) ?? Number.NaN);\n break;\n case 'in':\n case 'out': {\n const from = stepFrom();\n const step = axisZoomFactor(kind === 'in' ? KEY_STEP : 1 / KEY_STEP, axis);\n const target = zoomAt(from, keyAnchor(view), step, clamp);\n stepTo(target);\n record(from, target, keyAnchor(view));\n break;\n }\n case 'reset': {\n // A recenter that returns its target can be animated; one that\n // returns nothing dispatched the view itself and is already done.\n const target = view.recenter\n ? view.recenter()\n : { x: 0, y: 0, scale: { x: 1, y: 1 } };\n if (target) stepTo(target, resetMs);\n break;\n }\n default:\n // Unknown kind — no-op. Legacy bridge calls with params=undefined;\n // default to zoom-in as a sensible fallback.\n if (params === undefined) {\n view.set(zoomAt(current, { x: 0, y: 0 }, axisZoomFactor(KEY_STEP, axis), clamp));\n }\n break;\n }\n },\n },\n enabled: () => true,\n };\n}\n\n/**\n * @experimental\n * Default `viewport.zoom` descriptor: Cmd/Ctrl+wheel zoom with the kit's\n * default 0.1–8 scale clamp. Equivalent to `makeView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