@weasel-js/core 1.9.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +750 -0
- package/README.md +5 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -83
- 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 +54 -100
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +5 -4
- 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 +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -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 +31 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +35 -39
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +12 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +42 -36
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +41 -51
- package/dist/canvas/Canvas.js +281 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +169 -188
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +22 -23
- 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 +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
- 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 +40 -29
- 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 +73 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- 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/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.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 +38 -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 +29 -29
- 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 +39 -37
- 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 +76 -80
- 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 +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +303 -707
- 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/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- 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.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/defaultDrawOne.js +12 -12
- 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 +49 -68
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +65 -54
- 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/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 +43 -41
- 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.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/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/pickWalk.js +52 -50
- 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 +68 -132
- 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 +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +36 -35
- 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/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- 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 +46 -37
- 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/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +42 -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 +25 -27
- 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.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
- 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 +61 -14
- 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 +1 -1
- 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/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js.map +1 -1
- 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} +103 -92
- 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/{features/groups → core/scene}/composePose.js +18 -18
- 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 +38 -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 +116 -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 +9 -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 +66 -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 +3 -2
- 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 +90 -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 +8 -8
- 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 +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +7 -7
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.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 +47 -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/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +42 -55
- 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 +95 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +4507 -8459
- package/dist/index.js +275 -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 +23 -23
- 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 +69 -78
- 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 +98 -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 +41 -43
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- 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/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +19 -19
- package/dist/interactions/actions/defaults/duplicate.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/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.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 +14 -15
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +30 -31
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- 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/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.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 +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +19 -21
- 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/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/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 +72 -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 +48 -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/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 +87 -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 +24 -23
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -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 +59 -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/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 +55 -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 +74 -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/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- 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 +56 -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/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +77 -72
- 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/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.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-PPT88jZv.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.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.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +161 -163
- 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.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +4 -4
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +43 -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 +67 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +8 -0
- 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-CIKDwlsP.d.ts} +84 -164
- 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.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.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/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
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { unionAABB as e } from "../../../core/geometry/unionBounds.js";
|
|
2
|
+
import { visualBoundsViaDescriptor as t } from "../../../core/geometry/poseDescriptor.js";
|
|
3
|
+
import { poseDescriptorOf as n } from "../poseDescriptorDep.js";
|
|
4
|
+
import { shapeSources as r } from "../selectionSubtree.js";
|
|
5
|
+
import { createTransformOp as i } from "../../../core/ops/transform.js";
|
|
6
|
+
import { geometryDataOp as a } from "../geometryProjection.js";
|
|
7
|
+
import { scenePoseFrame as o } from "../poseFrame.js";
|
|
8
|
+
import { defaultCommitAdapter as s } from "../defaultCommitAdapter.js";
|
|
9
|
+
import { FlipXIcon as c, FlipYIcon as l } from "../defaults/icons/editIcons.js";
|
|
10
|
+
import { requiresSelection as u } from "../defaults/requiresSelection.js";
|
|
11
|
+
import { flipPoseAboutBounds as d, flipPoseViaDescriptor as f } from "./helpers.js";
|
|
12
|
+
import { actionReferenceSources as p, resolveSpatialReference as m } from "../spatialReference.js";
|
|
13
|
+
import { multiply as h, rotate as g, translate as _ } from "@weasel-js/geom";
|
|
14
|
+
import { createElement as v } from "react";
|
|
15
|
+
//#region src/interactions/actions/flip/action.ts
|
|
16
|
+
function y(e, t, n, r) {
|
|
17
|
+
let i = t.local(n, {
|
|
18
|
+
x: r.x + r.width / 2,
|
|
19
|
+
y: r.y + r.height / 2,
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0,
|
|
22
|
+
rotation: 0
|
|
23
|
+
}), a = i.rotation ?? 0, o = e === "x" ? [
|
|
24
|
+
-1,
|
|
25
|
+
0,
|
|
26
|
+
0,
|
|
27
|
+
1,
|
|
28
|
+
0,
|
|
29
|
+
0
|
|
30
|
+
] : [
|
|
31
|
+
1,
|
|
32
|
+
0,
|
|
33
|
+
0,
|
|
34
|
+
-1,
|
|
35
|
+
0,
|
|
36
|
+
0
|
|
37
|
+
], s = h(h(g(a), o), g(-a));
|
|
38
|
+
return h(_(i.x, i.y), h(s, _(-i.x, -i.y)));
|
|
39
|
+
}
|
|
40
|
+
function b(n, c, l, u, h, g, _, v, b) {
|
|
41
|
+
let x = n.get();
|
|
42
|
+
if (x.length === 0) return;
|
|
43
|
+
let S = o(c), C = [], w = /* @__PURE__ */ new Map();
|
|
44
|
+
for (let e of x) {
|
|
45
|
+
let n = r(c, [e]), i = n.length !== 1 || n[0] !== e ? t(S.world(e), _) : null;
|
|
46
|
+
for (let e of n) C.includes(e) || (C.push(e), i && w.set(e, i));
|
|
47
|
+
}
|
|
48
|
+
let T = /* @__PURE__ */ new Map();
|
|
49
|
+
for (let e of C) c.get(e) !== void 0 && T.set(e, S.world(e));
|
|
50
|
+
let E = null;
|
|
51
|
+
if (u === "union") E = e([...T.values()].map((e) => t(e, _)));
|
|
52
|
+
else if (u !== "each" && (E = m(u, p(v, b, c, S, _)), E === null)) return;
|
|
53
|
+
let D = [];
|
|
54
|
+
for (let e of C) {
|
|
55
|
+
let t = c.get(e);
|
|
56
|
+
if (!t) continue;
|
|
57
|
+
let n = T.get(e), r = E ?? w.get(e) ?? null, o = r ? d(n, l, _, r) : f(n, l, _);
|
|
58
|
+
D.push(i({
|
|
59
|
+
id: e,
|
|
60
|
+
from: t.pose,
|
|
61
|
+
to: S.local(e, o),
|
|
62
|
+
label: "Flip"
|
|
63
|
+
}));
|
|
64
|
+
let s = r ?? _.getBounds(n), u = a(g, {
|
|
65
|
+
id: e,
|
|
66
|
+
data: t.data,
|
|
67
|
+
pose: t.pose
|
|
68
|
+
}, y(l, S, e, s), "Flip");
|
|
69
|
+
u && D.push(u);
|
|
70
|
+
}
|
|
71
|
+
D.length !== 0 && (h ? h(D, "Flip") : c.applyBatch(D, "Flip", s(c, n.adapterMethods)));
|
|
72
|
+
}
|
|
73
|
+
var x = {
|
|
74
|
+
id: "flip",
|
|
75
|
+
label: "Flip",
|
|
76
|
+
group: "flip",
|
|
77
|
+
variants: [{
|
|
78
|
+
key: "x",
|
|
79
|
+
label: "Flip Horizontal",
|
|
80
|
+
icon: v(c),
|
|
81
|
+
params: { axis: "x" }
|
|
82
|
+
}, {
|
|
83
|
+
key: "y",
|
|
84
|
+
label: "Flip Vertical",
|
|
85
|
+
icon: v(l),
|
|
86
|
+
params: { axis: "y" }
|
|
87
|
+
}],
|
|
88
|
+
defaultBinding: [{
|
|
89
|
+
spec: {
|
|
90
|
+
kind: "key",
|
|
91
|
+
key: ["h", "H"],
|
|
92
|
+
mods: { shift: !0 }
|
|
93
|
+
},
|
|
94
|
+
opts: { params: { axis: "x" } }
|
|
95
|
+
}, {
|
|
96
|
+
spec: {
|
|
97
|
+
kind: "key",
|
|
98
|
+
key: ["v", "V"],
|
|
99
|
+
mods: { shift: !0 }
|
|
100
|
+
},
|
|
101
|
+
opts: { params: { axis: "y" } }
|
|
102
|
+
}],
|
|
103
|
+
eligible: { capability: "transforms-selection" },
|
|
104
|
+
requires: [
|
|
105
|
+
"selection",
|
|
106
|
+
"scene",
|
|
107
|
+
"applyOps",
|
|
108
|
+
"geometryProjection",
|
|
109
|
+
"poseDescriptor",
|
|
110
|
+
"pointer"
|
|
111
|
+
],
|
|
112
|
+
invoker: {
|
|
113
|
+
timing: "immediate",
|
|
114
|
+
run: (e, t) => {
|
|
115
|
+
let r = t?.axis ?? "x", i = t?.pivot ?? "each", a = e.selection, o = e.scene, s = e.applyOps, c = e.geometryProjection;
|
|
116
|
+
a && o && b(a, o, r, i, s, c, n(e.poseDescriptor), t, e.pointer);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
enabled: u
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
export { x as flipAction };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","names":["localMirror","at","frame","id","pivotWorld","theta","mirror","axis","turned","multiply","rotate","translate","flipSelection","selected","selection","scenePoseFrame","scene","ids","ownPivot","members","shapeSources","box","visualBoundsViaDescriptor","geom","member","worlds","sharedPivot","pivot","unionAABB","p","resolveSpatialReference","actionReferenceSources","params","pointer","ops","node","world","about","flipped","flipPoseAboutBounds","flipPoseViaDescriptor","createTransformOp","g","dataOp","geometryDataOp","geometryProjection","applyOps","defaultCommitAdapter","flipAction","createElement","FlipXIcon","FlipYIcon","deps","poseDescriptorOf","requiresSelection"],"sources":["../../../../src/interactions/actions/flip/action.ts"],"sourcesContent":["import type { NodeId, Scene } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { shapeSources } from '../selectionSubtree';\nimport { createElement } from 'react';\nimport { FlipXIcon, FlipYIcon } from '../defaults/icons/editIcons';\nimport type { Op } from 'core/ops/types';\nimport { multiply, rotate, translate, type Mat3 } from '@weasel-js/geom';\nimport { createTransformOp } from 'core/ops/transform';\nimport type { PoseDescriptor } from '../resize/geometry';\nimport { poseDescriptorOf } from '../poseDescriptorDep';\nimport {\n flipPoseAboutBounds,\n flipPoseViaDescriptor,\n type FlipAxis,\n type FlipPivot,\n} from './helpers';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { visualBoundsViaDescriptor } from '../align/align';\nimport { scenePoseFrame, type PoseFrame } from '../poseFrame';\nimport { actionReferenceSources, resolveSpatialReference } from '../spatialReference';\nimport type { PointerContextValue } from '@weasel-js/routing/react';\nimport type { RectPose } from 'core/scene/types';\nimport type { Action } from '@weasel-js/routing';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\nimport { requiresSelection } from '../defaults/requiresSelection';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport { geometryDataOp, type GeometryProjection } from '../geometryProjection';\n\n/**\n * The world mirror about `axis` through the center of `pivotWorld`, written in\n * the frame `id` stores its data in. `geometryProjection.transform` is given\n * the affine the node's own pose underwent, and data-held geometry is local —\n * so a world mirror has to be conjugated by the frame or an asymmetric shape\n * reflects across the wrong line while its pose lands correctly.\n *\n * The frame's turn comes back as the rotation on a rebased zero-size pose at\n * the pivot point, so no composition strategy has to expose one.\n */\nfunction localMirror(\n axis: FlipAxis,\n frame: PoseFrame<unknown>,\n id: Parameters<PoseFrame<unknown>['local']>[0],\n pivotWorld: { x: number; y: number; width: number; height: number },\n): Mat3 {\n const at = frame.local(id, {\n x: pivotWorld.x + pivotWorld.width / 2,\n y: pivotWorld.y + pivotWorld.height / 2,\n width: 0,\n height: 0,\n rotation: 0,\n }) as RectPose;\n const theta = at.rotation ?? 0;\n const mirror: Mat3 = axis === 'x' ? [-1, 0, 0, 1, 0, 0] : [1, 0, 0, -1, 0, 0];\n const turned = multiply(multiply(rotate(theta), mirror), rotate(-theta));\n return multiply(translate(at.x, at.y), multiply(turned, translate(-at.x, -at.y)));\n}\n\n/**\n * Flip the current selection in `scene` along `axis`, as one undo entry.\n *\n * Pivot: `'each'` (per-item own AABB) unless the caller passes `'union'`,\n * which mirrors every pose about the selection's *visual* union AABB — the\n * rotated ink extents — so items swap sides as well as reflect, or a\n * `SpatialReference`, which mirrors about the center of what it names. A rotated\n * member's own mirrored position needs no expansion: `axisAlignedBounds`\n * keeps the stored box's center, so mirroring either box lands the same place.\n */\nfunction flipSelection(\n selection: SelectionApi,\n scene: Scene<unknown, string, unknown>,\n axis: FlipAxis,\n pivot: FlipPivot,\n applyOps: ((ops: Op[], label: string) => void) | undefined,\n geometryProjection: GeometryProjection | undefined,\n geom: PoseDescriptor<unknown>,\n params: Record<string, unknown> | undefined,\n pointer: PointerContextValue | undefined,\n): void {\n const selected = selection.get();\n if (selected.length === 0) return;\n const frame = scenePoseFrame(scene);\n\n // A group whose pose derives from its children mirrors by mirroring them,\n // about the group's own box where each selected node flips in place.\n const ids: NodeId[] = [];\n const ownPivot = new Map<string, Bounds>();\n for (const id of selected) {\n const members = shapeSources(scene, [id]) as NodeId[];\n const stoodIn = members.length !== 1 || members[0] !== id;\n const box = stoodIn ? visualBoundsViaDescriptor(frame.world(id), geom) : null;\n for (const member of members) {\n if (ids.includes(member)) continue;\n ids.push(member);\n if (box) ownPivot.set(member, box);\n }\n }\n\n const worlds = new Map<string, unknown>();\n for (const id of ids) {\n if (scene.get(id) !== undefined) worlds.set(id as string, frame.world(id));\n }\n let sharedPivot: ReturnType<typeof unionAABB> = null;\n if (pivot === 'union') {\n sharedPivot = unionAABB([...worlds.values()].map((p) => visualBoundsViaDescriptor(p, geom)));\n } else if (pivot !== 'each') {\n sharedPivot = resolveSpatialReference(pivot, actionReferenceSources(params, pointer, scene, frame, geom));\n if (sharedPivot === null) return;\n }\n\n const ops: Op[] = [];\n for (const id of ids) {\n const node = scene.get(id);\n if (!node) continue;\n const world = worlds.get(id as string)!;\n const about = sharedPivot ?? ownPivot.get(id as string) ?? null;\n const flipped = about\n ? flipPoseAboutBounds(world, axis, geom, about)\n : flipPoseViaDescriptor(world, axis, geom);\n ops.push(createTransformOp<unknown>({\n id: id as string,\n from: node.pose,\n to: frame.local(id, flipped),\n label: 'Flip',\n }));\n // Mirror the data-held geometry about the SAME pivot the pose flip uses.\n // A pose-only flip of a bare-AABB pose is identity, so this data op is\n // the only way an asymmetric shape actually mirrors.\n const g = about ?? geom.getBounds(world);\n const dataOp = geometryDataOp(\n geometryProjection,\n { id: id as string, data: node.data, pose: node.pose },\n localMirror(axis, frame, id, g),\n 'Flip',\n );\n if (dataOp) ops.push(dataOp);\n }\n if (ops.length === 0) return;\n\n if (applyOps) applyOps(ops, 'Flip');\n else scene.applyBatch(ops, 'Flip', defaultCommitAdapter(scene, selection.adapterMethods));\n}\n\n/**\n * @experimental\n * Flips the selection. `params.axis` (`'x'` | `'y'`, default `'x'`) picks the\n * direction, and the optional `params.pivot` (a `FlipPivot`, default `'each'`)\n * picks what it mirrors about.\n */\nexport const flipAction: Action & { requires: string[] } = {\n id: 'flip',\n label: 'Flip',\n group: 'flip',\n variants: [\n { key: 'x', label: 'Flip Horizontal', icon: createElement(FlipXIcon), params: { axis: 'x' } },\n { key: 'y', label: 'Flip Vertical', icon: createElement(FlipYIcon), params: { axis: 'y' } },\n ],\n defaultBinding: [\n { spec: { kind: 'key', key: ['h', 'H'], mods: { shift: true } }, opts: { params: { axis: 'x' } } },\n { spec: { kind: 'key', key: ['v', 'V'], mods: { shift: true } }, opts: { params: { axis: 'y' } } },\n ],\n eligible: { capability: 'transforms-selection' },\n requires: ['selection', 'scene', 'applyOps', 'geometryProjection', 'poseDescriptor', 'pointer'],\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const axis = (params?.axis as FlipAxis | undefined) ?? 'x';\n const pivot = (params?.pivot as FlipPivot | undefined) ?? 'each';\n const selection = deps.selection;\n const scene = deps.scene;\n const applyOps = deps.applyOps;\n const geometryProjection = deps.geometryProjection;\n if (!selection || !scene) return;\n flipSelection(\n selection, scene, axis, pivot, applyOps, geometryProjection,\n poseDescriptorOf(deps.poseDescriptor),\n params, deps.pointer,\n );\n },\n },\n enabled: requiresSelection,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAsCA,SAASA,EACP,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAKC,EAAM,MAAMC,GAAI;EACzB,GAAGC,EAAW,IAAIA,EAAW,QAAQ;EACrC,GAAGA,EAAW,IAAIA,EAAW,SAAS;EACtC,OAAO;EACP,QAAQ;EACR,UAAU;CACZ,CAAC,GACKC,IAAQJ,EAAG,YAAY,GACvBK,IAAeC,MAAS,MAAM;EAAC;EAAI;EAAG;EAAG;EAAG;EAAG;CAAC,IAAI;EAAC;EAAG;EAAG;EAAG;EAAI;EAAG;CAAC,GACtEC,IAASC,EAASA,EAASC,EAAOL,CAAK,GAAGC,CAAM,GAAGI,EAAO,CAACL,CAAK,CAAC;CACvE,OAAOI,EAASE,EAAUV,EAAG,GAAGA,EAAG,CAAC,GAAGQ,EAASD,GAAQG,EAAU,CAACV,EAAG,GAAG,CAACA,EAAG,CAAC,CAAC,CAAC;AAClF;AAYA,SAASW,EACP,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAWC,EAAU,IAAI;CAC/B,IAAID,EAAS,WAAW,GAAG;CAC3B,IAAMX,IAAQa,EAAeC,CAAK,GAI5BC,IAAgB,CAAC,GACjBC,oBAAW,IAAI,IAAoB;CACzC,KAAK,IAAMf,KAAMU,GAAU;EACzB,IAAMM,IAAUC,EAAaJ,GAAO,CAACb,CAAE,CAAC,GAElCkB,IADUF,EAAQ,WAAW,KAAKA,EAAQ,OAAOhB,IACjCmB,EAA0BpB,EAAM,MAAMC,CAAE,GAAGoB,CAAI,IAAI;EACzE,KAAK,IAAMC,KAAUL,GACnB,AAAIF,EAAI,SAASO,CAAM,MACvBP,EAAI,KAAKO,CAAM,GACXH,KAAKH,EAAS,IAAIM,GAAQH,CAAG;CAErC;CAEA,IAAMI,oBAAS,IAAI,IAAqB;CACxC,KAAK,IAAMtB,KAAMc,GACf,AAAID,EAAM,IAAIb,CAAE,MAAM,KAAA,KAAWsB,EAAO,IAAItB,GAAcD,EAAM,MAAMC,CAAE,CAAC;CAE3E,IAAIuB,IAA4C;CAChD,IAAIC,MAAU,SACZ,IAAcC,EAAU,CAAC,GAAGH,EAAO,OAAO,CAAC,CAAC,CAAC,KAAK,MAAMH,EAA0BO,GAAGN,CAAI,CAAC,CAAC;MACtF,IAAII,MAAU,WACnB,IAAcG,EAAwBH,GAAOI,EAAuBC,GAAQC,GAASjB,GAAOd,GAAOqB,CAAI,CAAC,GACpGG,MAAgB,OAAM;CAG5B,IAAMQ,IAAY,CAAC;CACnB,KAAK,IAAM/B,KAAMc,GAAK;EACpB,IAAMkB,IAAOnB,EAAM,IAAIb,CAAE;EACzB,IAAI,CAACgC,GAAM;EACX,IAAMC,IAAQX,EAAO,IAAItB,CAAY,GAC/BkC,IAAQX,KAAeR,EAAS,IAAIf,CAAY,KAAK,MACrDmC,IAAUD,IACZE,EAAoBH,GAAO7B,GAAMgB,GAAMc,CAAK,IAC5CG,EAAsBJ,GAAO7B,GAAMgB,CAAI;EAC3C,EAAI,KAAKkB,EAA2B;GAC9B;GACJ,MAAMN,EAAK;GACX,IAAIjC,EAAM,MAAMC,GAAImC,CAAO;GAC3B,OAAO;EACT,CAAC,CAAC;EAIF,IAAMI,IAAIL,KAASd,EAAK,UAAUa,CAAK,GACjCO,IAASC,EACbC,GACA;GAAM;GAAc,MAAMV,EAAK;GAAM,MAAMA,EAAK;EAAK,GACrDnC,EAAYO,GAAML,GAAOC,GAAIuC,CAAC,GAC9B,MACF;EACA,AAAIC,KAAQT,EAAI,KAAKS,CAAM;CAC7B;CACA,AAAIT,EAAI,WAAW,MAEfY,IAAUA,EAASZ,GAAK,MAAM,IAC7BlB,EAAM,WAAWkB,GAAK,QAAQa,EAAqB/B,GAAOF,EAAU,cAAc,CAAC;AAC1F;AAQA,IAAakC,IAA8C;CACzD,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,CACR;EAAE,KAAK;EAAK,OAAO;EAAmB,MAAMC,EAAcC,CAAS;EAAG,QAAQ,EAAE,MAAM,IAAI;CAAE,GAC5F;EAAE,KAAK;EAAK,OAAO;EAAiB,MAAMD,EAAcE,CAAS;EAAG,QAAQ,EAAE,MAAM,IAAI;CAAE,CAC5F;CACA,gBAAgB,CACd;EAAE,MAAM;GAAE,MAAM;GAAO,KAAK,CAAC,KAAK,GAAG;GAAG,MAAM,EAAE,OAAO,GAAK;EAAE;EAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;CAAE,GACjG;EAAE,MAAM;GAAE,MAAM;GAAO,KAAK,CAAC,KAAK,GAAG;GAAG,MAAM,EAAE,OAAO,GAAK;EAAE;EAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;CAAE,CACnG;CACA,UAAU,EAAE,YAAY,uBAAuB;CAC/C,UAAU;EAAC;EAAa;EAAS;EAAY;EAAsB;EAAkB;CAAS;CAC9F,SAAS;EACP,QAAQ;EACR,MAAM,GAAM,MAAW;GACrB,IAAM5C,IAAQyB,GAAQ,QAAiC,KACjDL,IAASK,GAAQ,SAAmC,QACpDlB,IAAYsC,EAAK,WACjBpC,IAAQoC,EAAK,OACbN,IAAWM,EAAK,UAChBP,IAAqBO,EAAK;GAChC,AAAKtC,KAAcE,KACnBJ,EACEE,GAAWE,GAAOT,GAAMoB,GAAOmB,GAAUD,GACzCQ,EAAiBD,EAAK,cAAc,GACpCpB,GAAQoB,EAAK,OACf;EACF;CACF;CACA,SAASE;AACX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { poseLinearOf as e } from "
|
|
1
|
+
import { poseLinearOf as e } from "@weasel-js/geom";
|
|
2
2
|
//#region src/interactions/actions/flip/helpers.ts
|
|
3
3
|
function t(e, t, n, o) {
|
|
4
4
|
let s = n.getBounds(e), c = o.x + o.width / 2, l = o.y + o.height / 2, u = t === "x" ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["flipPoseAboutBounds","src","geometry","pose","cxPivot","pivotBounds","cyPivot","dst","axis","next","rotation","mirrorLinear","negateRotation","normalizeNegativeExtent","flipPoseViaDescriptor","p","mutated","nx","ny","nw","nh","l","poseLinearOf"],"sources":["../../../../src/interactions/actions/flip/helpers.ts"],"sourcesContent":["/**\n * Pose-flip helpers used by `flipAction` (via `defaults/flip.ts`).\n *\n * These were extracted from the legacy `useFlip` hook when it was removed —\n * they remain because the descriptor-style `flipAction` still needs to reflect\n * arbitrary `TPose` values through a `PoseDescriptor`.\n */\nimport type { PoseDescriptor } from '../resize/geometry';\nimport type { SpatialReference } from '../spatialReference';\nimport { poseLinearOf } from '
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["flipPoseAboutBounds","src","geometry","pose","cxPivot","pivotBounds","cyPivot","dst","axis","next","rotation","mirrorLinear","negateRotation","normalizeNegativeExtent","flipPoseViaDescriptor","p","mutated","nx","ny","nw","nh","l","poseLinearOf"],"sources":["../../../../src/interactions/actions/flip/helpers.ts"],"sourcesContent":["/**\n * Pose-flip helpers used by `flipAction` (via `defaults/flip.ts`).\n *\n * These were extracted from the legacy `useFlip` hook when it was removed —\n * they remain because the descriptor-style `flipAction` still needs to reflect\n * arbitrary `TPose` values through a `PoseDescriptor`.\n */\nimport type { PoseDescriptor } from '../resize/geometry';\nimport type { SpatialReference } from '../spatialReference';\nimport { poseLinearOf } from '@weasel-js/geom';\n\n/** Axis for flip. `'x'` mirrors horizontally (left↔right); `'y'` mirrors vertically (top↔bottom). */\nexport type FlipAxis = 'x' | 'y';\n\n/** How a multi-selection flip chooses its pivot.\n *\n * - `'each'` — every pose mirrors about its own AABB; spatial layout of the\n * selection is unchanged, individual items are reflected in place.\n * - `'union'` — every pose mirrors about the selection's union AABB; items\n * swap sides as well as reflect, matching Illustrator/Figma defaults.\n * - a {@link SpatialReference} — every pose mirrors about the center of the\n * bounds it names: the pointer, a world point or rect, or a key node. */\nexport type FlipPivot = 'each' | 'union' | SpatialReference;\n\n/** Reflect `pose` across the centerline of `pivotBounds` along `axis`, using\n * `geometry` to read bounds and remap. The pose's own AABB is read once to\n * compute the reflected destination rect; coords inside the pose are then\n * remapped through the affine that takes its own bounds → reflected dst.\n * A rotation the pose carries is negated: a mirror reverses the sense of the\n * turn, and `remapBounds` carries the original angle through untouched. A\n * `transform` it carries is mirrored the same way, on either axis. */\nexport function flipPoseAboutBounds<TPose>(\n pose: TPose,\n axis: FlipAxis,\n geometry: PoseDescriptor<TPose>,\n pivotBounds: { x: number; y: number; width: number; height: number },\n): TPose {\n const src = geometry.getBounds(pose);\n const cxPivot = pivotBounds.x + pivotBounds.width / 2;\n const cyPivot = pivotBounds.y + pivotBounds.height / 2;\n const dst = axis === 'x'\n ? { x: 2 * cxPivot - src.x, y: src.y, width: -src.width, height: src.height }\n : { x: src.x, y: 2 * cyPivot - src.y, width: src.width, height: -src.height };\n const next = geometry.remapBounds(pose, src, dst);\n const rotation = geometry.getRotation?.(pose) ?? (src as { rotation?: number }).rotation ?? 0;\n return mirrorLinear(negateRotation(normalizeNegativeExtent(next), rotation, geometry));\n}\n\n/** Reflect `pose` across the centerline of its own AABB along `axis`. */\nexport function flipPoseViaDescriptor<TPose>(\n pose: TPose,\n axis: FlipAxis,\n geometry: PoseDescriptor<TPose>,\n): TPose {\n return flipPoseAboutBounds(pose, axis, geometry, geometry.getBounds(pose));\n}\n\nfunction negateRotation<TPose>(pose: TPose, rotation: number, geometry: PoseDescriptor<TPose>): TPose {\n if (rotation === 0) return pose;\n return geometry.withRotation ? geometry.withRotation(pose, -rotation) : pose;\n}\n\nfunction normalizeNegativeExtent<TPose>(pose: TPose): TPose {\n const p = pose as unknown as { x?: number; y?: number; width?: number; height?: number };\n let mutated = false;\n let nx = p.x;\n let ny = p.y;\n let nw = p.width;\n let nh = p.height;\n if (typeof nw === 'number' && nw < 0 && typeof nx === 'number') {\n nx = nx + nw;\n nw = -nw;\n mutated = true;\n }\n if (typeof nh === 'number' && nh < 0 && typeof ny === 'number') {\n ny = ny + nh;\n nh = -nh;\n mutated = true;\n }\n if (!mutated) return pose;\n return { ...(pose as object), x: nx, y: ny, width: nw, height: nh } as TPose;\n}\n\n/** `M · L · M` for a mirror `M` on either axis: the off-diagonal terms change sign. */\nfunction mirrorLinear<TPose>(pose: TPose): TPose {\n const l = poseLinearOf(pose);\n if (!l || (l[1] === 0 && l[2] === 0)) return pose;\n return { ...(pose as object), transform: [l[0], -l[1], -l[2], l[3]] } as TPose;\n}\n"],"mappings":";;AA+BA,SAAgBA,EACd,GACA,GACA,GACA,GACO;CACP,IAAMC,IAAMC,EAAS,UAAUC,CAAI,GAC7BC,IAAUC,EAAY,IAAIA,EAAY,QAAQ,GAC9CC,IAAUD,EAAY,IAAIA,EAAY,SAAS,GAC/CE,IAAMC,MAAS,MACjB;EAAE,GAAG,IAAIJ,IAAUH,EAAI;EAAG,GAAGA,EAAI;EAAG,OAAO,CAACA,EAAI;EAAO,QAAQA,EAAI;CAAO,IAC1E;EAAE,GAAGA,EAAI;EAAG,GAAG,IAAIK,IAAUL,EAAI;EAAG,OAAOA,EAAI;EAAO,QAAQ,CAACA,EAAI;CAAO,GACxEQ,IAAOP,EAAS,YAAYC,GAAMF,GAAKM,CAAG,GAC1CG,IAAWR,EAAS,cAAcC,CAAI,KAAMF,EAA8B,YAAY;CAC5F,OAAOU,EAAaC,EAAeC,EAAwBJ,CAAI,GAAGC,GAAUR,CAAQ,CAAC;AACvF;AAGA,SAAgBY,EACd,GACA,GACA,GACO;CACP,OAAOd,EAAoBG,GAAMK,GAAMN,GAAUA,EAAS,UAAUC,CAAI,CAAC;AAC3E;AAEA,SAASS,EAAsB,GAAa,GAAkB,GAAwC;CAEpG,OADIF,MAAa,IAAUP,IACpBD,EAAS,eAAeA,EAAS,aAAaC,GAAM,CAACO,CAAQ,IAAIP;AAC1E;AAEA,SAASU,EAA+B,GAAoB;CAC1D,IAAME,IAAIZ,GACNa,IAAU,IACVC,IAAKF,EAAE,GACPG,IAAKH,EAAE,GACPI,IAAKJ,EAAE,OACPK,IAAKL,EAAE;CAYX,OAXI,OAAOI,KAAO,YAAYA,IAAK,KAAK,OAAOF,KAAO,aACpD,KAAUE,GACV,IAAK,CAACA,GACN,IAAU,KAER,OAAOC,KAAO,YAAYA,IAAK,KAAK,OAAOF,KAAO,aACpD,KAAUE,GACV,IAAK,CAACA,GACN,IAAU,KAEPJ,IACE;EAAE,GAAIb;EAAiB,GAAGc;EAAI,GAAGC;EAAI,OAAOC;EAAI,QAAQC;CAAG,IAD7CjB;AAEvB;AAGA,SAASQ,EAAoB,GAAoB;CAC/C,IAAMU,IAAIC,EAAanB,CAAI;CAE3B,OADI,CAACkB,KAAMA,EAAE,OAAO,KAAKA,EAAE,OAAO,IAAWlB,IACtC;EAAE,GAAIA;EAAiB,WAAW;GAACkB,EAAE;GAAI,CAACA,EAAE;GAAI,CAACA,EAAE;GAAIA,EAAE;EAAE;CAAE;AACtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { planeOf as e } from "./planeInput.js";
|
|
2
|
+
import { scenePoseFrame as t } from "./poseFrame.js";
|
|
3
|
+
//#region src/interactions/actions/gestureFrames.ts
|
|
4
|
+
function n(n, r, i = t(n)) {
|
|
5
|
+
return {
|
|
6
|
+
world: (e) => i.world(e),
|
|
7
|
+
toWorld: (e, t) => {
|
|
8
|
+
let n = i.parentWorld(e);
|
|
9
|
+
return n === null ? t : i.pc.compose(n, t);
|
|
10
|
+
},
|
|
11
|
+
toLocal: (e, t) => i.local(e, t),
|
|
12
|
+
planeOf: (t) => e(r, t)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as sceneGestureFrames };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=gestureFrames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestureFrames.js","names":["sceneGestureFrames","scenePoseFrame","scene","frame","id","parent","pose","worldPose","planeOf","view","layer"],"sources":["../../../src/interactions/actions/gestureFrames.ts"],"sourcesContent":["import type { NodeId, Scene } from 'core/scene/types';\nimport type { GestureFrames } from '../gestures/types';\nimport { planeOf } from './planeInput';\nimport { scenePoseFrame, type PoseFrame } from './poseFrame';\n\n/** A scene-backed gesture's {@link GestureFrames}. `view` is the `view` dep. */\nexport function sceneGestureFrames(\n scene: Scene<unknown, string, unknown>,\n view: unknown,\n frame: PoseFrame<unknown> = scenePoseFrame(scene),\n): GestureFrames<unknown> {\n return {\n world: (id) => frame.world(id as NodeId),\n toWorld: (id, pose) => {\n const parent = frame.parentWorld(id as NodeId);\n return parent === null ? pose : frame.pc.compose(parent, pose);\n },\n toLocal: (id, worldPose) => frame.local(id as NodeId, worldPose),\n planeOf: (layer) => planeOf(view, layer),\n };\n}\n"],"mappings":";;;AAMA,SAAgBA,EACd,GACA,GACA,IAA4BC,EAAeC,CAAK,GACxB;CACxB,OAAO;EACL,QAAQ,MAAOC,EAAM,MAAMC,CAAY;EACvC,UAAU,GAAI,MAAS;GACrB,IAAMC,IAASF,EAAM,YAAYC,CAAY;GAC7C,OAAOC,MAAW,OAAOC,IAAOH,EAAM,GAAG,QAAQE,GAAQC,CAAI;EAC/D;EACA,UAAU,GAAI,MAAcH,EAAM,MAAMC,GAAcG,CAAS;EAC/D,UAAU,MAAUC,EAAQC,GAAMC,CAAK;CACzC;AACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { SceneArrivalRefused as e } from "../../core/scene/arrivals.js";
|
|
1
2
|
//#region src/interactions/actions/gestureLifecycle.ts
|
|
2
|
-
function
|
|
3
|
+
function t(e) {
|
|
3
4
|
let t = {};
|
|
4
5
|
return e.label !== void 0 && (t.label = e.label), e.transient !== void 0 && (t.transient = e.transient), e.onGestureStart && (t.onGestureStart = e.onGestureStart), e.onGestureEnd && (t.onGestureEnd = e.onGestureEnd), t;
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
+
function n(e, t, n = []) {
|
|
7
8
|
let r = e ?? {}, i = !1, a = !1;
|
|
8
9
|
return {
|
|
9
10
|
label: r.label ?? t,
|
|
@@ -17,28 +18,54 @@ function t(e, t, n = []) {
|
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
function r(t, n, r) {
|
|
22
|
+
if (n.transient) {
|
|
23
|
+
try {
|
|
24
|
+
t.scene.untracked(() => {
|
|
25
|
+
for (let e of r) e.apply(t.adapter);
|
|
26
|
+
});
|
|
27
|
+
} catch (t) {
|
|
28
|
+
if (!(t instanceof e)) throw t;
|
|
29
|
+
return !1;
|
|
30
|
+
}
|
|
31
|
+
return !0;
|
|
26
32
|
}
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
let i = n.labelFor(r);
|
|
34
|
+
return t.applyOps ? (t.applyOps(r, i), !0) : t.scene.applyBatch(r, i, t.adapter);
|
|
35
|
+
}
|
|
36
|
+
function i(e, t, ...[n]) {
|
|
37
|
+
let r, i = !1;
|
|
38
|
+
return a(e, (e) => {
|
|
39
|
+
try {
|
|
40
|
+
let a = e.onEnd?.(t, {
|
|
41
|
+
...n,
|
|
42
|
+
answered: i || r !== void 0
|
|
43
|
+
});
|
|
44
|
+
r === void 0 && a !== void 0 && (r = a);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
throw i = !0, e;
|
|
47
|
+
}
|
|
48
|
+
}), r;
|
|
49
|
+
}
|
|
50
|
+
function a(e, t) {
|
|
51
|
+
let n = [];
|
|
52
|
+
for (let r of e) try {
|
|
53
|
+
t(r);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
n.push(e);
|
|
35
56
|
}
|
|
36
|
-
|
|
57
|
+
if (n.length > 0) throw n[0];
|
|
58
|
+
}
|
|
59
|
+
function o(e, t) {
|
|
60
|
+
a(e, (e) => e.onCancel?.(t));
|
|
61
|
+
}
|
|
62
|
+
function s(e, t, n) {
|
|
63
|
+
a(e, (e) => e.onSettled?.(t, n));
|
|
37
64
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
65
|
+
function c(e, t) {
|
|
66
|
+
e.hold.drop(), e.previews.clear(), a([() => s(e.behaviors, e.ctx, t), () => e.lifecycle.end(t)], (e) => e());
|
|
40
67
|
}
|
|
41
68
|
//#endregion
|
|
42
|
-
export {
|
|
69
|
+
export { c as closeGesture, r as commitGestureOps, t as gestureLifecycleParams, n as readGestureLifecycle, i as reduceBehaviorEnd, o as runBehaviorCancel, s as runBehaviorSettled };
|
|
43
70
|
|
|
44
71
|
//# sourceMappingURL=gestureLifecycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestureLifecycle.js","names":["gestureLifecycleParams","out","o","readGestureLifecycle","source","started","ended","defaultLabel","ops","behaviors","b","ids","committed","commitGestureOps","lifecycle","op","target","label","reduceBehaviorEnd","answer","r","ctx","runBehaviorCancel"],"sources":["../../../src/interactions/actions/gestureLifecycle.ts"],"sourcesContent":["/**\n * The lifecycle the ongoing transform actions (`move`, `resize`, `rotate`)\n * share: what their committed batch is called in history, whether it is\n * recorded at all, and the callbacks fired as the gesture opens and closes.\n *\n * Move and rotate read it from their binding's params; resize reads it from\n * the `resizePolicy` dep, where the rest of its options already live.\n */\nimport type { Op } from 'core/ops/types';\nimport type { Scene } from 'core/scene/types';\nimport type { BehaviorEnd } from 'interactions/gestures/types';\n\n/** The lifecycle options, as a binding's params or the resize policy carry\n * them. */\nexport interface GestureLifecycleOptions {\n /** History label for the committed batch. Unset, the batch takes its first\n * op's label (a layout drop or a behavior names its own), else the\n * action's. */\n label?: string;\n /** Commit through `scene.untracked`: the edit lands, but no undo entry\n * records it and the consumer `applyOps` hook is bypassed. Unset, any\n * behavior's `defaultTransient: true` turns it on. */\n transient?: boolean;\n /** Fired once the gesture starts changing poses, with the ids it moves. */\n onGestureStart?(ids: string[]): void;\n /** Fired once per `onGestureStart`: `true` when the gesture wrote to the\n * document, `false` on cancel, abort, or a release with nothing to write. */\n onGestureEnd?(committed: boolean): void;\n}\n\n/** The params entries for {@link GestureLifecycleOptions}, with the unset\n * keys left out. */\nexport function gestureLifecycleParams(o: GestureLifecycleOptions): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n if (o.label !== undefined) out.label = o.label;\n if (o.transient !== undefined) out.transient = o.transient;\n if (o.onGestureStart) out.onGestureStart = o.onGestureStart;\n if (o.onGestureEnd) out.onGestureEnd = o.onGestureEnd;\n return out;\n}\n\n/** A gesture's resolved lifecycle. `start` and `end` fire their callbacks at\n * most once each, and `end` only after `start`. */\nexport interface GestureLifecycle {\n /** The label ops built by the action itself carry. */\n readonly label: string;\n /** The history label for committing `ops`. */\n labelFor(ops: readonly Op[]): string;\n readonly transient: boolean;\n start(ids: readonly string[]): void;\n end(committed: boolean): void;\n}\n\nexport function readGestureLifecycle(\n source: GestureLifecycleOptions | Record<string, unknown> | undefined,\n defaultLabel: string,\n behaviors: readonly { defaultTransient?: boolean }[] = [],\n): GestureLifecycle {\n const o = (source ?? {}) as GestureLifecycleOptions;\n let started = false;\n let ended = false;\n return {\n label: o.label ?? defaultLabel,\n labelFor: (ops) => o.label ?? ops[0]?.label ?? defaultLabel,\n transient: o.transient ?? behaviors.some((b) => b.defaultTransient === true),\n start(ids) {\n if (started) return;\n started = true;\n o.onGestureStart?.([...ids]);\n },\n end(committed) {\n if (!started || ended) return;\n ended = true;\n o.onGestureEnd?.(committed);\n },\n };\n}\n\n/** Commit a gesture's ops: untracked when transient, else through the\n * consumer `applyOps` hook when one is wired, else into the scene's history. */\nexport function commitGestureOps(\n target: {\n scene: Scene<unknown, string, unknown>;\n applyOps?: (ops: Op[], label: string) => void;\n adapter: unknown;\n },\n lifecycle: GestureLifecycle,\n ops: Op[],\n): void {\n if (lifecycle.transient) {\n target.scene.untracked(() => {\n for (const op of ops) op.apply(target.adapter);\n });\n return;\n }\n const label = lifecycle.labelFor(ops);\n if (target.applyOps) target.applyOps(ops, label);\n else target.scene.applyBatch(ops, label, target.adapter);\n}\n\n/** Runs every behavior's `onEnd` in order; the first that answers decides the\n * commit and later answers are ignored. `null` aborts, `Op[]` claims it (an\n * empty array included), and `undefined` means every behavior deferred to the\n * action's own commit. */\nexport function reduceBehaviorEnd<TCtx>(\n behaviors: readonly { onEnd?(ctx: TCtx, end: BehaviorEnd): Op[] | null | void }[],\n ctx: TCtx,\n): Op[] | null | undefined {\n let answer: Op[] | null | undefined;\n for (const b of behaviors) {\n const r = b.onEnd?.(ctx, { answered: answer !== undefined });\n if (answer === undefined && r !== undefined) answer = r;\n }\n return answer;\n}\n\n/** Runs every behavior's `onCancel`, for a gesture closing without a commit. */\nexport function runBehaviorCancel<TCtx>(\n behaviors: readonly { onCancel?(ctx: TCtx): void }[],\n ctx: TCtx,\n): void {\n for (const b of behaviors) b.onCancel?.(ctx);\n}\n"],"mappings":";AAgCA,SAAgBA,EAAuB,GAAqD;CAC1F,IAAMC,IAA+B,CAAC;CAKtC,OAJIC,EAAE,UAAU,KAAA,MAAW,EAAI,QAAQA,EAAE,QACrCA,EAAE,cAAc,KAAA,MAAW,EAAI,YAAYA,EAAE,YAC7CA,EAAE,mBAAgB,EAAI,iBAAiBA,EAAE,iBACzCA,EAAE,iBAAc,EAAI,eAAeA,EAAE,eAClCD;AACT;AAcA,SAAgBE,EACd,GACA,GACA,IAAuD,CAAC,GACtC;CAClB,IAAMD,IAAKE,KAAU,CAAC,GAClBC,IAAU,IACVC,IAAQ;CACZ,OAAO;EACL,OAAOJ,EAAE,SAASK;EAClB,WAAW,MAAQL,EAAE,SAASM,EAAI,EAAE,EAAE,SAASD;EAC/C,WAAWL,EAAE,aAAaO,EAAU,MAAM,MAAMC,EAAE,qBAAqB,EAAI;EAC3E,MAAM,GAAK;GACT,AAAIL,MACJ,IAAU,IACVH,EAAE,iBAAiB,CAAC,GAAGS,CAAG,CAAC;EAC7B;EACA,IAAI,GAAW;GACb,AAAKN,KAAW,OAChB,IAAQ,IACRH,EAAE,eAAeU,CAAS;EAC5B;CACF;AACF;AAIA,SAAgBC,EACd,GAKA,GACA,GACM;CACN,IAAIC,EAAU,WAAW;EACvB,EAAO,MAAM,gBAAgB;GAC3B,KAAK,IAAMC,KAAMP,GAAK,EAAG,MAAMQ,EAAO,OAAO;EAC/C,CAAC;EACD;CACF;CACA,IAAMC,IAAQH,EAAU,SAASN,CAAG;CACpC,AAAIQ,EAAO,WAAUA,EAAO,SAASR,GAAKS,CAAK,IAC1CD,EAAO,MAAM,WAAWR,GAAKS,GAAOD,EAAO,OAAO;AACzD;AAMA,SAAgBE,EACd,GACA,GACyB;CACzB,IAAIC;CACJ,KAAK,IAAMT,KAAKD,GAAW;EACzB,IAAMW,IAAIV,EAAE,QAAQW,GAAK,EAAE,UAAUF,MAAW,KAAA,EAAU,CAAC;EAC3D,AAAIA,MAAW,KAAA,KAAaC,MAAM,KAAA,MAAW,IAASA;CACxD;CACA,OAAOD;AACT;AAGA,SAAgBG,EACd,GACA,GACM;CACN,KAAK,IAAMZ,KAAKD,GAAW,EAAE,WAAWY,CAAG;AAC7C"}
|
|
1
|
+
{"version":3,"file":"gestureLifecycle.js","names":["gestureLifecycleParams","out","o","readGestureLifecycle","source","started","ended","defaultLabel","ops","behaviors","b","ids","committed","commitGestureOps","lifecycle","op","target","err","SceneArrivalRefused","label","reduceBehaviorEnd","own","answer","threw","runEvery","r","ctx","errors","item","items","runBehaviorCancel","runBehaviorSettled","closeGesture","gesture","step"],"sources":["../../../src/interactions/actions/gestureLifecycle.ts"],"sourcesContent":["/**\n * The lifecycle the ongoing transform actions (`move`, `resize`, `rotate`)\n * share: what their committed batch is called in history, whether it is\n * recorded at all, and the callbacks fired as the gesture opens and closes.\n *\n * Move and rotate read it from their binding's params; resize reads it from\n * the `resizePolicy` dep, where the rest of its options already live.\n */\nimport type { Op } from 'core/ops/types';\nimport { SceneArrivalRefused } from 'core/scene/arrivals';\nimport type { Scene } from 'core/scene/types';\nimport type { BehaviorEnd } from 'interactions/gestures/types';\nimport type { NodeId, PoseHold } from 'core/scene/types';\n\n/** The lifecycle options, as a binding's params or the resize policy carry\n * them. */\nexport interface GestureLifecycleOptions {\n /** History label for the committed batch. Unset, the batch takes its first\n * op's label (a layout drop or a behavior names its own), else the\n * action's. */\n label?: string;\n /** Commit through `scene.untracked`: the edit lands, but no undo entry\n * records it and the consumer `applyOps` hook is bypassed. Unset, any\n * behavior's `defaultTransient: true` turns it on. */\n transient?: boolean;\n /** Fired once the gesture starts changing poses, with the ids it moves. */\n onGestureStart?(ids: string[]): void;\n /** Fired once per `onGestureStart`: `true` when the gesture wrote to the\n * document, `false` on cancel, abort, or a release with nothing to write. */\n onGestureEnd?(committed: boolean): void;\n}\n\n/** The params entries for {@link GestureLifecycleOptions}, with the unset\n * keys left out. */\nexport function gestureLifecycleParams(o: GestureLifecycleOptions): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n if (o.label !== undefined) out.label = o.label;\n if (o.transient !== undefined) out.transient = o.transient;\n if (o.onGestureStart) out.onGestureStart = o.onGestureStart;\n if (o.onGestureEnd) out.onGestureEnd = o.onGestureEnd;\n return out;\n}\n\n/** A gesture's resolved lifecycle. `start` and `end` fire their callbacks at\n * most once each, and `end` only after `start`. */\nexport interface GestureLifecycle {\n /** The label ops built by the action itself carry. */\n readonly label: string;\n /** The history label for committing `ops`. */\n labelFor(ops: readonly Op[]): string;\n readonly transient: boolean;\n start(ids: readonly string[]): void;\n end(committed: boolean): void;\n}\n\nexport function readGestureLifecycle(\n source: GestureLifecycleOptions | Record<string, unknown> | undefined,\n defaultLabel: string,\n behaviors: readonly { defaultTransient?: boolean }[] = [],\n): GestureLifecycle {\n const o = (source ?? {}) as GestureLifecycleOptions;\n let started = false;\n let ended = false;\n return {\n label: o.label ?? defaultLabel,\n labelFor: (ops) => o.label ?? ops[0]?.label ?? defaultLabel,\n transient: o.transient ?? behaviors.some((b) => b.defaultTransient === true),\n start(ids) {\n if (started) return;\n started = true;\n o.onGestureStart?.([...ids]);\n },\n end(committed) {\n if (!started || ended) return;\n ended = true;\n o.onGestureEnd?.(committed);\n },\n };\n}\n\n/** Commit a gesture's ops: untracked when transient, else through the\n * consumer `applyOps` hook when one is wired, else into the scene's history.\n * Returns whether the commit landed: false when a container refused what\n * the ops brought it, which the scene reverts. A consumer's `applyOps` may\n * keep the document elsewhere, so it is taken at its word. */\nexport function commitGestureOps(\n target: {\n scene: Scene<unknown, string, unknown>;\n applyOps?: (ops: Op[], label: string) => void;\n adapter: unknown;\n },\n lifecycle: GestureLifecycle,\n ops: Op[],\n): boolean {\n if (lifecycle.transient) {\n try {\n target.scene.untracked(() => {\n for (const op of ops) op.apply(target.adapter);\n });\n } catch (err) {\n // `untracked` lets a refused arrival out; `applyBatch` swallows it.\n if (!(err instanceof SceneArrivalRefused)) throw err;\n return false;\n }\n return true;\n }\n const label = lifecycle.labelFor(ops);\n if (!target.applyOps) return target.scene.applyBatch(ops, label, target.adapter);\n target.applyOps(ops, label);\n return true;\n}\n\n/** The trailing argument of {@link reduceBehaviorEnd}: what `TEnd` adds to\n * `BehaviorEnd`, required exactly when it adds something. */\ntype OwnEndFields<TEnd extends BehaviorEnd> = keyof Omit<TEnd, keyof BehaviorEnd> extends never\n ? [own?: Omit<TEnd, keyof BehaviorEnd>]\n : [own: Omit<TEnd, keyof BehaviorEnd>];\n\n/** Runs every behavior's `onEnd` in order; the first that answers decides the\n * commit and later answers are ignored. `null` aborts, `Op[]` claims it (an\n * empty array included), and `undefined` means every behavior deferred to the\n * action's own commit. An action whose behaviors take more than a plain\n * `BehaviorEnd` passes the rest as `own`; each `onEnd` gets it beside\n * `answered`. One that throws does not stop the rest, which are told the\n * commit is decided; its error is rethrown after, so nothing commits. */\nexport function reduceBehaviorEnd<TCtx, TEnd extends BehaviorEnd = BehaviorEnd>(\n behaviors: readonly { onEnd?(ctx: TCtx, end: TEnd): Op[] | null | void }[],\n ctx: TCtx,\n ...[own]: OwnEndFields<TEnd>\n): Op[] | null | undefined {\n let answer: Op[] | null | undefined;\n let threw = false;\n runEvery(behaviors, (b) => {\n try {\n const r = b.onEnd?.(ctx, { ...own, answered: threw || answer !== undefined } as TEnd);\n if (answer === undefined && r !== undefined) answer = r;\n } catch (err) {\n threw = true;\n throw err;\n }\n });\n return answer;\n}\n\n/** Runs `step` for every item, a throwing one included, then rethrows the\n * first error. For steps that each release something of their own. */\nfunction runEvery<T>(items: readonly T[], step: (item: T) => void): void {\n const errors: unknown[] = [];\n for (const item of items) {\n try {\n step(item);\n } catch (err) {\n errors.push(err);\n }\n }\n if (errors.length > 0) throw errors[0];\n}\n\n/** Runs every behavior's `onCancel`, for a gesture closing without a commit.\n * One that throws does not stop the rest; its error is rethrown after. */\nexport function runBehaviorCancel<TCtx>(\n behaviors: readonly { onCancel?(ctx: TCtx): void }[],\n ctx: TCtx,\n): void {\n runEvery(behaviors, (b) => b.onCancel?.(ctx));\n}\n\n/** Runs every behavior's `onSettled`, once the gesture's commit has landed or\n * its cancel has run. One that throws does not stop the rest; its error is\n * rethrown after. */\nexport function runBehaviorSettled<TCtx>(\n behaviors: readonly { onSettled?(ctx: TCtx, committed: boolean): void }[],\n ctx: TCtx,\n committed: boolean,\n): void {\n runEvery(behaviors, (b) => b.onSettled?.(ctx, committed));\n}\n\n/** What {@link closeGesture} closes. */\nexport interface ClosingGesture<TCtx> {\n hold: PoseHold<unknown>;\n /** The action's own buffer of this frame's poses, emptied at the close. */\n previews: Map<NodeId, unknown>;\n behaviors: readonly { onSettled?(ctx: TCtx, committed: boolean): void }[];\n ctx: TCtx;\n lifecycle: GestureLifecycle;\n}\n\n/**\n * The close a transform action runs from its `finally`, commit or cancel:\n * drop the preview overrides, tell the behaviors, then fire `onGestureEnd`,\n * which fires even when a behavior's `onSettled` throws; the first error is\n * rethrown.\n */\nexport function closeGesture<TCtx>(gesture: ClosingGesture<TCtx>, committed: boolean): void {\n gesture.hold.drop();\n gesture.previews.clear();\n runEvery([\n () => runBehaviorSettled(gesture.behaviors, gesture.ctx, committed),\n () => gesture.lifecycle.end(committed),\n ], (step) => step());\n}\n"],"mappings":";;AAkCA,SAAgBA,EAAuB,GAAqD;CAC1F,IAAMC,IAA+B,CAAC;CAKtC,OAJIC,EAAE,UAAU,KAAA,MAAW,EAAI,QAAQA,EAAE,QACrCA,EAAE,cAAc,KAAA,MAAW,EAAI,YAAYA,EAAE,YAC7CA,EAAE,mBAAgB,EAAI,iBAAiBA,EAAE,iBACzCA,EAAE,iBAAc,EAAI,eAAeA,EAAE,eAClCD;AACT;AAcA,SAAgBE,EACd,GACA,GACA,IAAuD,CAAC,GACtC;CAClB,IAAMD,IAAKE,KAAU,CAAC,GAClBC,IAAU,IACVC,IAAQ;CACZ,OAAO;EACL,OAAOJ,EAAE,SAASK;EAClB,WAAW,MAAQL,EAAE,SAASM,EAAI,EAAE,EAAE,SAASD;EAC/C,WAAWL,EAAE,aAAaO,EAAU,MAAM,MAAMC,EAAE,qBAAqB,EAAI;EAC3E,MAAM,GAAK;GACT,AAAIL,MACJ,IAAU,IACVH,EAAE,iBAAiB,CAAC,GAAGS,CAAG,CAAC;EAC7B;EACA,IAAI,GAAW;GACb,AAAKN,KAAW,OAChB,IAAQ,IACRH,EAAE,eAAeU,CAAS;EAC5B;CACF;AACF;AAOA,SAAgBC,EACd,GAKA,GACA,GACS;CACT,IAAIC,EAAU,WAAW;EACvB,IAAI;GACF,EAAO,MAAM,gBAAgB;IAC3B,KAAK,IAAMC,KAAMP,GAAK,EAAG,MAAMQ,EAAO,OAAO;GAC/C,CAAC;EACH,SAASC,GAAK;GAEZ,IAAI,EAAEA,aAAeC,IAAsB,MAAMD;GACjD,OAAO;EACT;EACA,OAAO;CACT;CACA,IAAME,IAAQL,EAAU,SAASN,CAAG;CAGpC,OAFKQ,EAAO,YACZA,EAAO,SAASR,GAAKW,CAAK,GACnB,MAFsBH,EAAO,MAAM,WAAWR,GAAKW,GAAOH,EAAO,OAAO;AAGjF;AAeA,SAAgBI,EACd,GACA,GACA,GAAG,CAACC,IACqB;CACzB,IAAIC,GACAC,IAAQ;CAUZ,OATAC,EAASf,IAAY,MAAM;EACzB,IAAI;GACF,IAAMgB,IAAIf,EAAE,QAAQgB,GAAK;IAAE,GAAGL;IAAK,UAAUE,KAASD,MAAW,KAAA;GAAU,CAAS;GACpF,AAAIA,MAAW,KAAA,KAAaG,MAAM,KAAA,MAAW,IAASA;EACxD,SAASR,GAAK;GAEZ,MADA,IAAQ,IACFA;EACR;CACF,CAAC,GACMK;AACT;AAIA,SAASE,EAAY,GAAqB,GAA+B;CACvE,IAAMG,IAAoB,CAAC;CAC3B,KAAK,IAAMC,KAAQC,GACjB,IAAI;EACF,EAAKD,CAAI;CACX,SAASX,GAAK;EACZ,EAAO,KAAKA,CAAG;CACjB;CAEF,IAAIU,EAAO,SAAS,GAAG,MAAMA,EAAO;AACtC;AAIA,SAAgBG,EACd,GACA,GACM;CACN,EAASrB,IAAY,MAAMC,EAAE,WAAWgB,CAAG,CAAC;AAC9C;AAKA,SAAgBK,EACd,GACA,GACA,GACM;CACN,EAAStB,IAAY,MAAMC,EAAE,YAAYgB,GAAKd,CAAS,CAAC;AAC1D;AAkBA,SAAgBoB,EAAmB,GAA+B,GAA0B;CAG1F,AAFAC,EAAQ,KAAK,KAAK,GAClBA,EAAQ,SAAS,MAAM,GACvBT,EAAS,OACDO,EAAmBE,EAAQ,WAAWA,EAAQ,KAAKrB,CAAS,SAC5DqB,EAAQ,UAAU,IAAIrB,CAAS,CACvC,IAAI,MAASsB,EAAK,CAAC;AACrB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { runBehaviorSettled as e } from "../gestureLifecycle.js";
|
|
2
|
+
import { inPlane as t, insertLayer as n } from "../planeInput.js";
|
|
3
|
+
import { shapeKindInfo as r } from "../../../core/shapeKinds.js";
|
|
4
|
+
import { insertKind as i, insertShape as a } from "./shape.js";
|
|
5
|
+
import { cancelInsert as o, commitInsert as s } from "./commit.js";
|
|
6
|
+
import { beginInsert as c } from "./session.js";
|
|
7
|
+
import { nextFrame as l } from "./frame.js";
|
|
8
|
+
import { resolveParams as u } from "@weasel-js/routing";
|
|
9
|
+
//#region src/interactions/actions/insert/action.ts
|
|
10
|
+
var d = t({
|
|
11
|
+
id: "insert",
|
|
12
|
+
label: "Insert",
|
|
13
|
+
group: "insert",
|
|
14
|
+
eligible: { capability: "creates-shapes" },
|
|
15
|
+
requires: [
|
|
16
|
+
"insert",
|
|
17
|
+
"insertLive",
|
|
18
|
+
"selection",
|
|
19
|
+
"snap",
|
|
20
|
+
"textEdit",
|
|
21
|
+
"scene",
|
|
22
|
+
"applyOps",
|
|
23
|
+
"view"
|
|
24
|
+
],
|
|
25
|
+
invoker: {
|
|
26
|
+
timing: "ongoing",
|
|
27
|
+
start(t, n) {
|
|
28
|
+
let d = c(t, n);
|
|
29
|
+
if (!d) return {};
|
|
30
|
+
let { session: f, readers: p } = d, m = d.frame, h = {
|
|
31
|
+
open: !0,
|
|
32
|
+
userRotation: 0
|
|
33
|
+
}, g = t.deps.insertLive;
|
|
34
|
+
return g && (g.gesture = h), {
|
|
35
|
+
kind: "insert",
|
|
36
|
+
onMove(e) {
|
|
37
|
+
m = l(f, p, m, e);
|
|
38
|
+
},
|
|
39
|
+
overlay() {
|
|
40
|
+
if (!h.open) return null;
|
|
41
|
+
let e = u(f.opts?.params);
|
|
42
|
+
if (!r(i(e))?.insertPreview) return null;
|
|
43
|
+
let { bounds: t, extras: n, start: o } = a(e, m, m.points, h.userRotation);
|
|
44
|
+
return {
|
|
45
|
+
kind: "insertPreview",
|
|
46
|
+
shape: n.kind,
|
|
47
|
+
bounds: t,
|
|
48
|
+
extras: n,
|
|
49
|
+
anchorPoint: {
|
|
50
|
+
x: o.x,
|
|
51
|
+
y: o.y
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
onEnd(t, n) {
|
|
56
|
+
h.open = !1, g?.gesture === h && (g.gesture = null);
|
|
57
|
+
let r = !1;
|
|
58
|
+
try {
|
|
59
|
+
n === "cancel" ? o(f) : r = s(f, m, t.drag?.points ?? m.points, h.userRotation);
|
|
60
|
+
} finally {
|
|
61
|
+
e(f.behaviors, f.gestureCtx, r);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
enabled: () => !0
|
|
68
|
+
}, n);
|
|
69
|
+
//#endregion
|
|
70
|
+
export { d as insertAction };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","names":["insertAction","inPlane","begun","beginInsert","ctx","opts","frame","gesture","live","nextFrame","session","readers","moveCtx","resolved","resolveParams","shapeKindInfo","insertKind","insertShape","extras","start","committed","reason","cancelInsert","commitInsert","endCtx","insertLayer"],"sources":["../../../../src/interactions/actions/insert/action.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { InvocationCtx, OngoingHandle, BindingOpts, OngoingOverlay } from '@weasel-js/routing';\nimport { resolveParams } from '@weasel-js/routing';\nimport { shapeKindInfo } from 'core/shapeKinds';\nimport type { KitInsertShape } from 'core/shapeKinds';\nimport { runBehaviorSettled } from '../gestureLifecycle';\nimport { inPlane, insertLayer } from '../planeInput';\nimport { cancelInsert, commitInsert } from './commit';\nimport { nextFrame } from './frame';\nimport type { InsertLiveGesture } from './live';\nimport { beginInsert } from './session';\nimport { insertKind, insertShape } from './shape';\n\n/**\n * @experimental\n * Drag-to-insert. The node `kind` is read from `opts.params.kind`.\n *\n * Grid snapping comes from the optional `snap` dep, applied to the drag's\n * start and current point (never to freehand pencil samples). Behaviors from\n * the binding's `opts.behaviors` (`InsertBehavior[]`) run over the two points\n * after that; on release the first answer wins (`null` aborts, `Op[]` commits\n * in place of the insert).\n *\n * The new node has no scene id until commit, so the live preview is the\n * `overlay()` surface with `kind: 'insertPreview'`. A consumer-defined kind\n * the kit cannot draw skips the preview and still commits on release.\n */\nexport const insertAction: Action & { requires: string[] } = inPlane({\n id: 'insert',\n label: 'Insert',\n group: 'insert',\n eligible: { capability: 'creates-shapes' },\n requires: ['insert', 'insertLive', 'selection', 'snap', 'textEdit', 'scene', 'applyOps', 'view'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const begun = beginInsert(ctx, opts);\n if (!begun) return {};\n const { session, readers } = begun;\n let frame = begun.frame;\n const gesture: InsertLiveGesture = { open: true, userRotation: 0 };\n const live = ctx.deps.insertLive;\n if (live) live.gesture = gesture;\n\n return {\n kind: 'insert',\n onMove(moveCtx: InvocationCtx): void {\n frame = nextFrame(session, readers, frame, moveCtx);\n },\n overlay(): OngoingOverlay | null {\n if (!gesture.open) return null;\n // Resolve params on every overlay() so thunked params (polygon\n // sides ticking via ArrowUp mid-drag) reflect in the live preview.\n const resolved = resolveParams(session.opts?.params);\n if (!shapeKindInfo(insertKind(resolved))?.insertPreview) return null;\n const { bounds, extras, start } = insertShape(resolved, frame, frame.points, gesture.userRotation);\n return {\n kind: 'insertPreview',\n shape: extras.kind as KitInsertShape,\n bounds,\n extras,\n // Anchor dot at the click point: radial shapes have no vertex\n // there, and in center mode it marks the growth axis.\n anchorPoint: { x: start.x, y: start.y },\n };\n },\n onEnd(endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n gesture.open = false;\n if (live?.gesture === gesture) live.gesture = null;\n let committed = false;\n try {\n if (reason === 'cancel') cancelInsert(session);\n else committed = commitInsert(session, frame, endCtx.drag?.points ?? frame.points, gesture.userRotation);\n } finally {\n runBehaviorSettled(session.behaviors, session.gestureCtx, committed);\n }\n },\n };\n },\n },\n /** Insert needs no selection; anything but `true` blocks dispatcher-routed inserts. */\n enabled: () => true as const,\n}, insertLayer);\n"],"mappings":";;;;;;;;;AA2BA,IAAaA,IAAgDC,EAAQ;CACnE,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,iBAAiB;CACzC,UAAU;EAAC;EAAU;EAAc;EAAa;EAAQ;EAAY;EAAS;EAAY;CAAM;CAC/F,SAAS;EACP,QAAQ;EACR,MAAM,GAAoB,GAAmC;GAC3D,IAAMC,IAAQC,EAAYC,GAAKC,CAAI;GACnC,IAAI,CAACH,GAAO,OAAO,CAAC;GACpB,IAAM,EAAE,YAAS,eAAYA,GACzBI,IAAQJ,EAAM,OACZK,IAA6B;IAAE,MAAM;IAAM,cAAc;GAAE,GAC3DC,IAAOJ,EAAI,KAAK;GAGtB,OAFII,MAAM,EAAK,UAAUD,IAElB;IACL,MAAM;IACN,OAAO,GAA8B;KACnC,IAAQE,EAAUC,GAASC,GAASL,GAAOM,CAAO;IACpD;IACA,UAAiC;KAC/B,IAAI,CAACL,EAAQ,MAAM,OAAO;KAG1B,IAAMM,IAAWC,EAAcJ,EAAQ,MAAM,MAAM;KACnD,IAAI,CAACK,EAAcC,EAAWH,CAAQ,CAAC,CAAC,EAAE,eAAe,OAAO;KAChE,IAAM,EAAE,WAAQ,WAAQ,aAAUI,EAAYJ,GAAUP,GAAOA,EAAM,QAAQC,EAAQ,YAAY;KACjG,OAAO;MACL,MAAM;MACN,OAAOW,EAAO;MACd;MACA;MAGA,aAAa;OAAE,GAAGC,EAAM;OAAG,GAAGA,EAAM;MAAE;KACxC;IACF;IACA,MAAM,GAAuB,GAAmC;KAE9D,AADA,EAAQ,OAAO,IACXX,GAAM,YAAYD,MAAS,EAAK,UAAU;KAC9C,IAAIa,IAAY;KAChB,IAAI;MACF,AAAIC,MAAW,WAAUC,EAAaZ,CAAO,IACxC,IAAYa,EAAab,GAASJ,GAAOkB,EAAO,MAAM,UAAUlB,EAAM,QAAQC,EAAQ,YAAY;KACzG,UAAU;MACR,EAAmBG,EAAQ,WAAWA,EAAQ,YAAYU,CAAS;KACrE;IACF;GACF;EACF;CACF;CAEA,eAAe;AACjB,GAAGK,CAAW"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { commitGestureOps as e, readGestureLifecycle as t, reduceBehaviorEnd as n, runBehaviorCancel as r } from "../gestureLifecycle.js";
|
|
2
|
+
import { defaultCommitAdapter as i } from "../defaultCommitAdapter.js";
|
|
3
|
+
import { insertShape as a, isCommittableExtent as o } from "./shape.js";
|
|
4
|
+
import { resolveParams as s } from "@weasel-js/routing";
|
|
5
|
+
//#region src/interactions/actions/insert/commit.ts
|
|
6
|
+
function c(e) {
|
|
7
|
+
r(e.behaviors, e.gestureCtx), e.priorSelection.length > 0 && e.selection?.set([...e.priorSelection]);
|
|
8
|
+
}
|
|
9
|
+
function l(r, c, l, u) {
|
|
10
|
+
let d = s(r.opts?.params);
|
|
11
|
+
if (r.behaviors.length > 0) {
|
|
12
|
+
let a = n(r.behaviors, r.gestureCtx);
|
|
13
|
+
if (a === null) return !1;
|
|
14
|
+
if (a !== void 0) return r.scene ? e({
|
|
15
|
+
scene: r.scene,
|
|
16
|
+
applyOps: r.applyOps,
|
|
17
|
+
adapter: i(r.scene, r.selection?.adapterMethods)
|
|
18
|
+
}, t(d, "Insert", r.behaviors), a) : !1;
|
|
19
|
+
}
|
|
20
|
+
let { bounds: f, extras: p } = a(d, c, l, u);
|
|
21
|
+
if (!o(f, p.kind)) return !1;
|
|
22
|
+
let m = r.dep.commit(f, p);
|
|
23
|
+
return m !== null && p.kind === "text" && r.textEdit?.startEdit(String(m), { caret: 0 }), m !== null;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { c as cancelInsert, l as commitInsert };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.js","names":["cancelInsert","runBehaviorCancel","session","commitInsert","resolved","resolveParams","r","reduceBehaviorEnd","commitGestureOps","defaultCommitAdapter","readGestureLifecycle","insertShape","frame","points","userRotation","isCommittableExtent","bounds","extras","id"],"sources":["../../../../src/interactions/actions/insert/commit.ts"],"sourcesContent":["import type { DragSample } from '@weasel-js/routing';\nimport { resolveParams } from '@weasel-js/routing';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\nimport { commitGestureOps, readGestureLifecycle, reduceBehaviorEnd, runBehaviorCancel } from '../gestureLifecycle';\nimport type { InsertFrame, InsertSession } from './session';\nimport { insertShape, isCommittableExtent } from './shape';\n\n/** Cancel the insert: tell the behaviors, and put the selection the draw\n * cleared back. */\nexport function cancelInsert(\n session: Pick<InsertSession, 'behaviors' | 'gestureCtx' | 'priorSelection' | 'selection'>,\n): void {\n runBehaviorCancel(session.behaviors, session.gestureCtx);\n if (session.priorSelection.length > 0) session.selection?.set([...session.priorSelection]);\n}\n\n/** Commit the insert. Returns whether it committed: a behavior's ops reached\n * the scene, or the `insert` dep minted a node. `points` is the pointer\n * trail as the release left it. */\nexport function commitInsert(\n session: InsertSession,\n frame: Pick<InsertFrame, 'shaped' | 'altHeld'>,\n points: ReadonlyArray<DragSample> | null,\n userRotation: number,\n): boolean {\n // Resolve params at commit time so thunked params (polygon\n // `sides` adjusted mid-drag, etc.) see the latest tool state.\n const resolved = resolveParams(session.opts?.params);\n\n if (session.behaviors.length > 0) {\n const r = reduceBehaviorEnd(session.behaviors, session.gestureCtx);\n if (r === null) return false;\n if (r !== undefined) {\n if (!session.scene) return false;\n return commitGestureOps(\n {\n scene: session.scene,\n applyOps: session.applyOps,\n adapter: defaultCommitAdapter(session.scene, session.selection?.adapterMethods),\n },\n readGestureLifecycle(resolved, 'Insert', session.behaviors),\n r,\n );\n }\n }\n\n const { bounds, extras } = insertShape(resolved, frame, points, userRotation);\n // Sub-threshold drag — no insert.\n if (!isCommittableExtent(bounds, extras.kind)) return false;\n\n const id = session.dep.commit(bounds, extras);\n\n // A freshly dragged text box is empty, so it draws nothing and the\n // tool's own `click on selected body → enterTextEdit` binding has\n // nothing visible to click. Drop straight into the caret instead —\n // which is also what every other editor does with a text tool.\n // `textEdit` is optional: without it the box is still committed,\n // exactly as before.\n if (id !== null && extras.kind === 'text') {\n session.textEdit?.startEdit(String(id), { caret: 0 });\n }\n return id !== null;\n}\n"],"mappings":";;;;;AASA,SAAgBA,EACd,GACM;CAEN,AADAC,EAAkBC,EAAQ,WAAWA,EAAQ,UAAU,GACnDA,EAAQ,eAAe,SAAS,KAAGA,EAAQ,WAAW,IAAI,CAAC,GAAGA,EAAQ,cAAc,CAAC;AAC3F;AAKA,SAAgBC,EACd,GACA,GACA,GACA,GACS;CAGT,IAAMC,IAAWC,EAAcH,EAAQ,MAAM,MAAM;CAEnD,IAAIA,EAAQ,UAAU,SAAS,GAAG;EAChC,IAAMI,IAAIC,EAAkBL,EAAQ,WAAWA,EAAQ,UAAU;EACjE,IAAII,MAAM,MAAM,OAAO;EACvB,IAAIA,MAAM,KAAA,GAER,OADKJ,EAAQ,QACNM,EACL;GACE,OAAON,EAAQ;GACf,UAAUA,EAAQ;GAClB,SAASO,EAAqBP,EAAQ,OAAOA,EAAQ,WAAW,cAAc;EAChF,GACAQ,EAAqBN,GAAU,UAAUF,EAAQ,SAAS,GAC1DI,CACF,IAT2B;CAW/B;CAEA,IAAM,EAAE,WAAQ,cAAWK,EAAYP,GAAUQ,GAAOC,GAAQC,CAAY;CAE5E,IAAI,CAACC,EAAoBC,GAAQC,EAAO,IAAI,GAAG,OAAO;CAEtD,IAAMC,IAAKhB,EAAQ,IAAI,OAAOc,GAAQC,CAAM;CAW5C,OAHIC,MAAO,QAAQD,EAAO,SAAS,UACjCf,EAAQ,UAAU,UAAU,OAAOgB,CAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAE/CA,MAAO;AAChB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/interactions/actions/insert/extras.ts
|
|
2
|
+
function e(e, t, n, r, i, a) {
|
|
3
|
+
let o = e?.kind ?? "rect";
|
|
4
|
+
switch (o) {
|
|
5
|
+
case "rect":
|
|
6
|
+
case "ellipse": return { kind: o };
|
|
7
|
+
case "line": return {
|
|
8
|
+
kind: "line",
|
|
9
|
+
a: {
|
|
10
|
+
x: t,
|
|
11
|
+
y: n
|
|
12
|
+
},
|
|
13
|
+
b: {
|
|
14
|
+
x: r,
|
|
15
|
+
y: i
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
case "polygon": {
|
|
19
|
+
let a = Number(e?.sides ?? 6), o = r === t && i === n ? 0 : Math.atan2(i - n, r - t), s = {
|
|
20
|
+
kind: "polygon",
|
|
21
|
+
sides: a,
|
|
22
|
+
rotation: e?.rotation === void 0 ? o : Number(e.rotation)
|
|
23
|
+
};
|
|
24
|
+
if (e?.originMode === "center") {
|
|
25
|
+
let e = r - t, a = i - n;
|
|
26
|
+
s.center = {
|
|
27
|
+
x: t,
|
|
28
|
+
y: n
|
|
29
|
+
}, s.radius = Math.hypot(e, a);
|
|
30
|
+
} else e?.center !== void 0 && (s.center = e.center), e?.radius !== void 0 && (s.radius = e.radius);
|
|
31
|
+
return s;
|
|
32
|
+
}
|
|
33
|
+
case "star": {
|
|
34
|
+
let a = Number(e?.points ?? 5), o = Number(e?.innerRadiusRatio ?? .5), s = r === t && i === n ? 0 : Math.atan2(i - n, r - t), c = {
|
|
35
|
+
kind: "star",
|
|
36
|
+
points: a,
|
|
37
|
+
innerRadiusRatio: o,
|
|
38
|
+
rotation: e?.rotation === void 0 ? s : Number(e.rotation)
|
|
39
|
+
};
|
|
40
|
+
if (e?.originMode === "center") {
|
|
41
|
+
let e = r - t, a = i - n;
|
|
42
|
+
c.center = {
|
|
43
|
+
x: t,
|
|
44
|
+
y: n
|
|
45
|
+
}, c.outerRadius = Math.hypot(e, a);
|
|
46
|
+
} else e?.center !== void 0 && (c.center = e.center), e?.outerRadius !== void 0 && (c.outerRadius = e.outerRadius);
|
|
47
|
+
return c;
|
|
48
|
+
}
|
|
49
|
+
case "pencil": return {
|
|
50
|
+
kind: "pencil",
|
|
51
|
+
samples: e?.samples ?? a ?? []
|
|
52
|
+
};
|
|
53
|
+
default: return {
|
|
54
|
+
...e ?? {},
|
|
55
|
+
kind: o
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function t(e, t) {
|
|
60
|
+
t !== 0 && (e.kind === "star" || e.kind === "polygon") && (e.rotation += t);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { t as applyUserRotation, e as buildExtras };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=extras.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras.js","names":["buildExtras","kind","params","\"kind\"","startX","startY","currentX","currentY","sides","\"sides\"","dragAngle","extras","\"rotation\"","\"originMode\"","dx","dy","\"center\"","\"radius\"","pts","\"points\"","ir","\"innerRadiusRatio\"","\"outerRadius\"","\"samples\"","points","applyUserRotation","userRotation"],"sources":["../../../../src/interactions/actions/insert/extras.ts"],"sourcesContent":["import type { DragSample } from '@weasel-js/routing';\nimport type { InsertExtras } from '../depSchema';\n\n/** Build a typed `InsertExtras` from the static params + gesture context.\n * Kit-built-in kinds (line / polygon / star / pencil) read kind-specific\n * fields; unknown kinds pass the raw params through as `{ kind, ... }`. */\nexport function buildExtras(\n params: Record<string, unknown> | undefined,\n startX: number,\n startY: number,\n currentX: number,\n currentY: number,\n points: ReadonlyArray<DragSample> | null,\n): InsertExtras {\n const kind = ((params?.['kind'] as string | undefined) ?? 'rect');\n switch (kind) {\n case 'rect':\n case 'ellipse':\n return { kind } as InsertExtras;\n case 'line':\n // Use the live drag endpoints (not AABB) so the line preserves the\n // user's drag direction — drag from bottom-left to top-right makes a\n // line that slopes up, not the bounds diagonal.\n return { kind: 'line', a: { x: startX, y: startY }, b: { x: currentX, y: currentY } };\n case 'polygon': {\n const sides = Number(params?.['sides'] ?? 6);\n // When the tool omits rotation, point the first vertex along the\n // drag vector so dragging in a direction orients the shape that\n // way. Sub-pixel drags (no direction yet) fall back to 0.\n const dragAngle = (currentX === startX && currentY === startY)\n ? 0\n : Math.atan2(currentY - startY, currentX - startX);\n const rotation = params?.['rotation'] !== undefined\n ? Number(params['rotation'])\n : dragAngle;\n const extras: InsertExtras = { kind: 'polygon', sides, rotation };\n // Drag-from-center: tool's Alt binding passes `originMode:'center'`.\n // Compute polygon center + radius from the drag vector so the shape\n // anchors on the click point. Without this, the dep falls back to\n // inscribing in the AABB (drag-from-corner default).\n if (params?.['originMode'] === 'center') {\n const dx = currentX - startX;\n const dy = currentY - startY;\n (extras as { center?: unknown }).center = { x: startX, y: startY };\n (extras as { radius?: unknown }).radius = Math.hypot(dx, dy);\n } else {\n if (params?.['center'] !== undefined) (extras as { center?: unknown }).center = params['center'];\n if (params?.['radius'] !== undefined) (extras as { radius?: unknown }).radius = params['radius'];\n }\n return extras;\n }\n case 'star': {\n const pts = Number(params?.['points'] ?? 5);\n const ir = Number(params?.['innerRadiusRatio'] ?? 0.5);\n const dragAngle = (currentX === startX && currentY === startY)\n ? 0\n : Math.atan2(currentY - startY, currentX - startX);\n const rotation = params?.['rotation'] !== undefined\n ? Number(params['rotation'])\n : dragAngle;\n const extras: InsertExtras = { kind: 'star', points: pts, innerRadiusRatio: ir, rotation };\n if (params?.['originMode'] === 'center') {\n const dx = currentX - startX;\n const dy = currentY - startY;\n (extras as { center?: unknown }).center = { x: startX, y: startY };\n (extras as { outerRadius?: unknown }).outerRadius = Math.hypot(dx, dy);\n } else {\n if (params?.['center'] !== undefined) (extras as { center?: unknown }).center = params['center'];\n if (params?.['outerRadius'] !== undefined) (extras as { outerRadius?: unknown }).outerRadius = params['outerRadius'];\n }\n return extras;\n }\n case 'pencil':\n // Prefer tool-supplied samples (param) when present — pencil tools may\n // capture richer per-sample data (pressure/tilt). Fall back to the\n // dispatcher's accumulated pointer trail.\n return {\n kind: 'pencil',\n samples: (params?.['samples'] as ReadonlyArray<DragSample> | undefined)\n ?? points\n ?? [],\n };\n default:\n // Consumer-defined kind: pass everything through so a custom insert\n // dep can read its own fields.\n return { ...(params ?? {}), kind } as InsertExtras;\n }\n}\n\n/** Add a user-driven rotation offset onto kinds that carry rotation. Rect\n * / ellipse / line / pencil don't expose a rotation field on their\n * extras today, so they ignore the offset. */\nexport function applyUserRotation(extras: InsertExtras, userRotation: number): void {\n if (userRotation === 0) return;\n if (extras.kind === 'star' || extras.kind === 'polygon') {\n (extras as { rotation: number }).rotation += userRotation;\n }\n}\n"],"mappings":";AAMA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GACc;CACd,IAAMC,IAASC,GAASC,QAAkC;CAC1D,QAAQF,GAAR;EACE,KAAK;EACL,KAAK,WACH,OAAO,EAAE,QAAK;EAChB,KAAK,QAIH,OAAO;GAAE,MAAM;GAAQ,GAAG;IAAE,GAAGG;IAAQ,GAAGC;GAAO;GAAG,GAAG;IAAE,GAAGC;IAAU,GAAGC;GAAS;EAAE;EACtF,KAAK,WAAW;GACd,IAAMC,IAAQ,OAAON,GAASO,SAAY,CAAC,GAIrCC,IAAaJ,MAAaF,KAAUG,MAAaF,IACnD,IACA,KAAK,MAAME,IAAWF,GAAQC,IAAWF,CAAM,GAI7CO,IAAuB;IAAE,MAAM;IAAW;IAAO,UAHtCT,GAASU,aAAgB,KAAA,IAEtCF,IADA,OAAOR,EAAOU,QAAW;GAEmC;GAKhE,IAAIV,GAASW,eAAkB,UAAU;IACvC,IAAMC,IAAKR,IAAWF,GAChBW,IAAKR,IAAWF;IAEtB,AADA,EAAiC,SAAS;KAAE,GAAGD;KAAQ,GAAGC;IAAO,GACjE,EAAiC,SAAS,KAAK,MAAMS,GAAIC,CAAE;GAC7D,OAEE,AADIb,GAASc,WAAc,KAAA,MAAW,EAAiC,SAASd,EAAOc,SACnFd,GAASe,WAAc,KAAA,MAAW,EAAiC,SAASf,EAAOe;GAEzF,OAAON;EACT;EACA,KAAK,QAAQ;GACX,IAAMO,IAAM,OAAOhB,GAASiB,UAAa,CAAC,GACpCC,IAAK,OAAOlB,GAASmB,oBAAuB,EAAG,GAC/CX,IAAaJ,MAAaF,KAAUG,MAAaF,IACnD,IACA,KAAK,MAAME,IAAWF,GAAQC,IAAWF,CAAM,GAI7CO,IAAuB;IAAE,MAAM;IAAQ,QAAQO;IAAK,kBAAkBE;IAAI,UAH/DlB,GAASU,aAAgB,KAAA,IAEtCF,IADA,OAAOR,EAAOU,QAAW;GAE4D;GACzF,IAAIV,GAASW,eAAkB,UAAU;IACvC,IAAMC,IAAKR,IAAWF,GAChBW,IAAKR,IAAWF;IAEtB,AADA,EAAiC,SAAS;KAAE,GAAGD;KAAQ,GAAGC;IAAO,GACjE,EAAsC,cAAc,KAAK,MAAMS,GAAIC,CAAE;GACvE,OAEE,AADIb,GAASc,WAAc,KAAA,MAAW,EAAiC,SAASd,EAAOc,SACnFd,GAASoB,gBAAmB,KAAA,MAAW,EAAsC,cAAcpB,EAAOoB;GAExG,OAAOX;EACT;EACA,KAAK,UAIH,OAAO;GACL,MAAM;GACN,SAAUT,GAASqB,WACdC,KACA,CAAC;EACR;EACF,SAGE,OAAO;GAAE,GAAItB,KAAU,CAAC;GAAI;EAAK;CACrC;AACF;AAKA,SAAgBuB,EAAkB,GAAsB,GAA4B;CAClF,AAAIC,MAAiB,MACjBf,EAAO,SAAS,UAAUA,EAAO,SAAS,eAC5C,EAAiC,YAAYe;AAEjD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { pointerStateOf as e } from "../pointerState.js";
|
|
2
|
+
import { computeBounds as t, effectiveOriginMode as n, snapTo15Degrees as r } from "./geometry.js";
|
|
3
|
+
import { GESTURE_KEY as i } from "./session.js";
|
|
4
|
+
import { resolveParams as a } from "@weasel-js/routing";
|
|
5
|
+
//#region src/interactions/actions/insert/frame.ts
|
|
6
|
+
function o(o, s, c, l) {
|
|
7
|
+
let u = a(o.opts?.params), d = u?.kind ?? "rect", f = o.gestureCtx, p = f.origin.get(i), m = {
|
|
8
|
+
x: c.pointer.x,
|
|
9
|
+
y: c.pointer.y
|
|
10
|
+
};
|
|
11
|
+
if (d === "line" && c.shiftHeld && (m = r(p, m)), m = o.snap(m), o.behaviors.length > 0) {
|
|
12
|
+
f.modifiers = { ...l.modifiers }, f.pointer = e(c.pointer, l), f.view = s.view(), f.plane = s.plane(), f.current.set(i, m);
|
|
13
|
+
let r = n(u?.originMode, c.altHeld);
|
|
14
|
+
for (let e of o.behaviors) {
|
|
15
|
+
let n = t(p.x, p.y, m.x, m.y, r), i = e.onMove?.(f, {
|
|
16
|
+
start: p,
|
|
17
|
+
current: m,
|
|
18
|
+
bounds: n,
|
|
19
|
+
pose: n
|
|
20
|
+
});
|
|
21
|
+
i && (i.start && (p = i.start), i.current && (m = i.current));
|
|
22
|
+
}
|
|
23
|
+
f.current.set(i, m);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
start: p,
|
|
27
|
+
current: m
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function s(e, t, n, r) {
|
|
31
|
+
let i = {
|
|
32
|
+
pointer: {
|
|
33
|
+
x: r.world.x,
|
|
34
|
+
y: r.world.y
|
|
35
|
+
},
|
|
36
|
+
altHeld: r.modifiers.alt,
|
|
37
|
+
shiftHeld: r.modifiers.shift
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
...i,
|
|
41
|
+
points: r.drag?.points ? r.drag.points : n.points,
|
|
42
|
+
shaped: o(e, t, i, r)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { s as nextFrame };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.js","names":["shapeEndpoints","resolved","resolveParams","session","kind","\"kind\"","gctx","start","GESTURE_KEY","current","raw","snapTo15Degrees","moveCtx","pointerStateOf","readers","mode","effectiveOriginMode","\"originMode\"","b","bounds","computeBounds","r","nextFrame","prev"],"sources":["../../../../src/interactions/actions/insert/frame.ts"],"sourcesContent":["import type { InvocationCtx } from '@weasel-js/routing';\nimport { pointerStateOf } from '../pointerState';\nimport { resolveParams } from '@weasel-js/routing';\nimport type { GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { InsertPoint } from '../../gestures/types';\nimport { computeBounds, effectiveOriginMode, snapTo15Degrees } from './geometry';\nimport { GESTURE_KEY, type InsertFrame, type InsertSession } from './session';\n\n/**\n * Shape the raw pointer into the drag's endpoints, in order: the line tool's\n * Shift-constrain (on the raw pointer, around the shaped start, so the locked\n * angle survives), the `snap` dep, then each behavior's `onMove`, each seeing\n * the points the one before it returned.\n */\nfunction shapeEndpoints(\n session: Pick<InsertSession, 'opts' | 'snap' | 'behaviors' | 'gestureCtx'>,\n readers: GestureReaders,\n raw: Pick<InsertFrame, 'pointer' | 'altHeld' | 'shiftHeld'>,\n moveCtx: Pick<InvocationCtx, 'modifiers' | 'screen'>,\n): { start: InsertPoint; current: InsertPoint } {\n const resolved = resolveParams(session.opts?.params);\n const kind = (resolved?.['kind'] as string | undefined) ?? 'rect';\n const gctx = session.gestureCtx;\n let start = gctx.origin.get(GESTURE_KEY) as InsertPoint;\n let current = { x: raw.pointer.x, y: raw.pointer.y };\n if (kind === 'line' && raw.shiftHeld) {\n current = snapTo15Degrees(start, current);\n }\n current = session.snap(current);\n\n if (session.behaviors.length > 0) {\n gctx.modifiers = { ...moveCtx.modifiers };\n gctx.pointer = pointerStateOf(raw.pointer, moveCtx);\n gctx.view = readers.view();\n gctx.plane = readers.plane();\n gctx.current.set(GESTURE_KEY, current);\n const mode = effectiveOriginMode(resolved?.['originMode'], raw.altHeld);\n for (const b of session.behaviors) {\n const bounds = computeBounds(start.x, start.y, current.x, current.y, mode);\n const r = b.onMove?.(gctx, { start, current, bounds, pose: bounds });\n if (!r) continue;\n if (r.start) start = r.start;\n if (r.current) current = r.current;\n }\n gctx.current.set(GESTURE_KEY, current);\n }\n return { start, current };\n}\n\n/** One pump event's pointer, modifiers, and trail, and the endpoints they\n * shape to. Each behavior's `onMove` runs once per call. */\nexport function nextFrame(\n session: InsertSession,\n readers: GestureReaders,\n prev: Pick<InsertFrame, 'points'>,\n moveCtx: InvocationCtx,\n): InsertFrame {\n const raw = {\n pointer: { x: moveCtx.world.x, y: moveCtx.world.y },\n // Each pointermove carries fresh modifier state from the dispatcher;\n // releasing / pressing a key mid-drag takes effect on the next move tick\n // (true modifier-only events don't fire without a cursor change).\n altHeld: moveCtx.modifiers.alt,\n shiftHeld: moveCtx.modifiers.shift,\n };\n return {\n ...raw,\n // The dispatcher mutates its own per-gesture trail in place but\n // attaches the array reference to each InvocationCtx.drag — keep\n // the latest reference in case the dispatcher swaps it.\n points: moveCtx.drag?.points ? moveCtx.drag.points : prev.points,\n shaped: shapeEndpoints(session, readers, raw, moveCtx),\n };\n}\n"],"mappings":";;;;;AAcA,SAASA,EACP,GACA,GACA,GACA,GAC8C;CAC9C,IAAMC,IAAWC,EAAcC,EAAQ,MAAM,MAAM,GAC7CC,IAAQH,GAAWI,QAAkC,QACrDC,IAAOH,EAAQ,YACjBI,IAAQD,EAAK,OAAO,IAAIE,CAAW,GACnCC,IAAU;EAAE,GAAGC,EAAI,QAAQ;EAAG,GAAGA,EAAI,QAAQ;CAAE;CAMnD,IALIN,MAAS,UAAUM,EAAI,cACzB,IAAUC,EAAgBJ,GAAOE,CAAO,IAE1C,IAAUN,EAAQ,KAAKM,CAAO,GAE1BN,EAAQ,UAAU,SAAS,GAAG;EAKhC,AAJA,EAAK,YAAY,EAAE,GAAGS,EAAQ,UAAU,GACxC,EAAK,UAAUC,EAAeH,EAAI,SAASE,CAAO,GAClD,EAAK,OAAOE,EAAQ,KAAK,GACzB,EAAK,QAAQA,EAAQ,MAAM,GAC3BR,EAAK,QAAQ,IAAIE,GAAaC,CAAO;EACrC,IAAMM,IAAOC,EAAoBf,GAAWgB,YAAeP,EAAI,OAAO;EACtE,KAAK,IAAMQ,KAAKf,EAAQ,WAAW;GACjC,IAAMgB,IAASC,EAAcb,EAAM,GAAGA,EAAM,GAAGE,EAAQ,GAAGA,EAAQ,GAAGM,CAAI,GACnEM,IAAIH,EAAE,SAASZ,GAAM;IAAE;IAAO;IAAS;IAAQ,MAAMa;GAAO,CAAC;GACnE,AAAKE,MACDA,EAAE,UAAO,IAAQA,EAAE,QACnBA,EAAE,YAAS,IAAUA,EAAE;EAC7B;EACA,EAAK,QAAQ,IAAIb,GAAaC,CAAO;CACvC;CACA,OAAO;EAAE;EAAO;CAAQ;AAC1B;AAIA,SAAgBa,EACd,GACA,GACA,GACA,GACa;CACb,IAAMZ,IAAM;EACV,SAAS;GAAE,GAAGE,EAAQ,MAAM;GAAG,GAAGA,EAAQ,MAAM;EAAE;EAIlD,SAASA,EAAQ,UAAU;EAC3B,WAAWA,EAAQ,UAAU;CAC/B;CACA,OAAO;EACL,GAAGF;EAIH,QAAQE,EAAQ,MAAM,SAASA,EAAQ,KAAK,SAASW,EAAK;EAC1D,QAAQvB,EAAeG,GAASW,GAASJ,GAAKE,CAAO;CACvD;AACF"}
|