@weasel-js/core 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -0
- package/README.md +33 -0
- package/dist/affordances/composeAffordanceLayer.js +21 -21
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +48 -32
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js +50 -28
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotateCursor.js +12 -0
- package/dist/affordances/rotateCursor.js.map +1 -0
- package/dist/affordances/rotationHandle.js +40 -43
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/rig/rigNode.js +9 -3
- package/dist/animation/rig/rigNode.js.map +1 -1
- package/dist/animation/rig/rigSeat.js +46 -13
- package/dist/animation/rig/rigSeat.js.map +1 -1
- package/dist/animation/rig/skinBinding.js +22 -14
- package/dist/animation/rig/skinBinding.js.map +1 -1
- package/dist/barrel/canvas.js +29 -28
- package/dist/barrel/interactions.js +33 -32
- package/dist/barrel/paths.js +11 -10
- package/dist/barrel/routing.js +49 -48
- package/dist/barrel/scene.js +10 -10
- package/dist/barrel/viewport.js +24 -21
- package/dist/canvas/Canvas.js +6 -17
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +34 -37
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +3 -3
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +3 -3
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +24 -23
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +40 -49
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +297 -259
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +3 -24
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +37 -29
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +11 -11
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +45 -109
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +49 -41
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +64 -96
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +3 -4
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +77 -80
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +3 -3
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/SurfaceCanvas.js +40 -0
- package/dist/canvas/SurfaceCanvas.js.map +1 -0
- package/dist/canvas/adapterDerivedPath.js +13 -13
- package/dist/canvas/adapterDerivedPath.js.map +1 -1
- package/dist/canvas/adapterPickSource.js +34 -0
- package/dist/canvas/adapterPickSource.js.map +1 -0
- package/dist/canvas/affordanceAt.js +1 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +56 -34
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/copiesAbove.js +27 -0
- package/dist/canvas/copiesAbove.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +24 -23
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +45 -50
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +30 -15
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +134 -100
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/layout.js +9 -15
- package/dist/canvas/deps/layout.js.map +1 -1
- package/dist/canvas/derivedPath.js +53 -29
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js +33 -31
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/overChildren.js +29 -0
- package/dist/canvas/overChildren.js.map +1 -0
- package/dist/canvas/paintedCursorLayer.js.map +1 -1
- package/dist/canvas/pickReach.js +23 -0
- package/dist/canvas/pickReach.js.map +1 -0
- package/dist/canvas/pickWalk.js +51 -80
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +14 -35
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +11 -10
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +38 -44
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/useCanvasView.js +42 -44
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +22 -0
- package/dist/canvas/useSceneAdapter.js.map +1 -0
- package/dist/canvas/useSurfaceInput.js +13 -16
- package/dist/canvas/useSurfaceInput.js.map +1 -1
- package/dist/canvas/viewRegistry.js +31 -23
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/wrapNodeOutput.js +7 -2
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +1 -1
- package/dist/{clone-2a5hVbBd.d.ts → clone-C0eADtS0.d.ts} +13 -13
- package/dist/clone.d.ts +2 -2
- package/dist/core/geometry/poseDescriptor.js +49 -23
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +2 -2
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js.map +1 -1
- package/dist/core/layers/children.js +1 -3
- package/dist/core/layers/children.js.map +1 -1
- package/dist/core/ops/create.js +2 -2
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/delete.js +19 -23
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +3 -7
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +2 -4
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
- package/dist/core/ops/reparent.js +0 -1
- package/dist/core/ops/reparent.js.map +1 -1
- package/dist/core/ops/slot.js +3 -6
- package/dist/core/ops/slot.js.map +1 -1
- package/dist/core/pages/fitViewToPage.js +15 -0
- package/dist/core/pages/fitViewToPage.js.map +1 -0
- package/dist/core/pages/pages.js +65 -0
- package/dist/core/pages/pages.js.map +1 -0
- package/dist/core/pages/pagesLayer.js +27 -0
- package/dist/core/pages/pagesLayer.js.map +1 -0
- package/dist/core/paint/meshKindLazy.js +2 -2
- package/dist/core/paint/meshKindLazy.js.map +1 -1
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/core/scene/composePose.js +58 -20
- package/dist/core/scene/composePose.js.map +1 -1
- package/dist/core/scene/effectivePose.js +5 -1
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/historyFacade.js +19 -13
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/nodeFnFields.js +7 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/outerOps.js +2 -1
- package/dist/core/scene/outerOps.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +1 -1
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/sceneRecording.js +2 -1
- package/dist/core/scene/sceneRecording.js.map +1 -1
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +28 -30
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -1
- package/dist/core/viewport/useViewAnimation.js +70 -69
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +8 -5
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/zoomAt.js +11 -2
- package/dist/core/viewport/zoomAt.js.map +1 -1
- package/dist/{cornerHandles-BEshc4z3.d.ts → cornerHandles-BSKbyuvQ.d.ts} +1 -1
- package/dist/features/paths/editablePath.js +24 -8
- package/dist/features/paths/editablePath.js.map +1 -1
- package/dist/features/paths/index.js +4 -4
- package/dist/features/paths/shapeGenerator.js +89 -0
- package/dist/features/paths/shapeGenerator.js.map +1 -0
- package/dist/features/paths/usePathEdit.js +13 -13
- package/dist/features/poseRun/usePoseRun.js +25 -25
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +82 -64
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewResolver.js +28 -24
- package/dist/features/viewports/viewResolver.js.map +1 -1
- package/dist/icons/SliceIcon.js +24 -0
- package/dist/icons/SliceIcon.js.map +1 -0
- package/dist/index.d.ts +956 -581
- package/dist/index.js +260 -251
- package/dist/interactions/actions/align/align.js +9 -9
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/booleans.js +18 -18
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +35 -30
- package/dist/interactions/actions/clone/action.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +56 -59
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
- package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
- package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
- package/dist/interactions/actions/defaults/bendSegment.js +46 -0
- package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
- package/dist/interactions/actions/defaults/copySubtree.js +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +32 -17
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
- package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +16 -31
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +28 -23
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
- package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/distribute.js +8 -8
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/action.js +58 -55
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/preview.js +26 -0
- package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
- package/dist/interactions/actions/flip/action.js.map +1 -1
- package/dist/interactions/actions/geometryProjection.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +37 -30
- package/dist/interactions/actions/insert/action.js.map +1 -1
- package/dist/interactions/actions/insert/frame.js +9 -2
- package/dist/interactions/actions/insert/frame.js.map +1 -1
- package/dist/interactions/actions/insert/repositionAction.js +31 -0
- package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +32 -32
- package/dist/interactions/actions/move/action.js +29 -25
- package/dist/interactions/actions/move/action.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +12 -6
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +32 -23
- package/dist/interactions/actions/move/capture.js.map +1 -1
- package/dist/interactions/actions/move/frame.js +2 -14
- package/dist/interactions/actions/move/frame.js.map +1 -1
- package/dist/interactions/actions/move/session.js +1 -1
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/move/translate.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/replaceWithPaths.js +13 -13
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -1
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -1
- package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
- package/dist/interactions/actions/resize/action.js +31 -20
- package/dist/interactions/actions/resize/action.js.map +1 -1
- package/dist/interactions/actions/resize/commit.js.map +1 -1
- package/dist/interactions/actions/resize/frame.js +29 -15
- package/dist/interactions/actions/resize/frame.js.map +1 -1
- package/dist/interactions/actions/resize/replay.js +47 -0
- package/dist/interactions/actions/resize/replay.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -35
- package/dist/interactions/actions/resize/session.js.map +1 -1
- package/dist/interactions/actions/resolveOverlays.js +2 -1
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +40 -25
- package/dist/interactions/actions/rotate/action.js.map +1 -1
- package/dist/interactions/actions/rotate/frame.js +1 -1
- package/dist/interactions/actions/rotate/frame.js.map +1 -1
- package/dist/interactions/actions/rotate/replay.js +22 -0
- package/dist/interactions/actions/rotate/replay.js.map +1 -0
- package/dist/interactions/actions/rotate/session.js +42 -32
- package/dist/interactions/actions/rotate/session.js.map +1 -1
- package/dist/interactions/actions/transform-again/action.js +63 -0
- package/dist/interactions/actions/transform-again/action.js.map +1 -0
- package/dist/interactions/actions/transform-again/memory.js +35 -0
- package/dist/interactions/actions/transform-again/memory.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +101 -83
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/move.d.ts +4 -4
- package/dist/{originProjection-PPT88jZv.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
- package/dist/resize.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +16 -15
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +111 -111
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js +11 -14
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +15 -14
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +22 -18
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +1 -1
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +2 -1
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +42 -40
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +18 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +2 -2
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/{types-CIKDwlsP.d.ts → types-DBbbCy0i.d.ts} +22 -15
- package/dist/version.js +1 -1
- package/package.json +22 -22
- package/dist/canvas/surface.module.js +0 -6
- package/dist/canvas/surface.module.js.map +0 -1
- package/dist/canvas/surfaceBox.js +0 -16
- package/dist/canvas/surfaceBox.js.map +0 -1
- package/dist/layout/arrivals.js +0 -33
- package/dist/layout/arrivals.js.map +0 -1
package/dist/resize.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-
|
|
1
|
+
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-BSKbyuvQ.js';
|
|
2
2
|
export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-Bqk-11Rl.js';
|
|
3
|
-
import { B as BoundsConstraint } from './clone-
|
|
3
|
+
import { B as BoundsConstraint } from './clone-C0eADtS0.js';
|
|
4
4
|
import { Bounds, ModifierState } from '@weasel-js/routing';
|
|
5
5
|
export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-DHg5KqaJ.js';
|
|
6
6
|
import '@weasel-js/animator';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-DBbbCy0i.js';
|
|
8
8
|
import '@weasel-js/history';
|
|
9
9
|
import '@weasel-js/geom';
|
|
10
10
|
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
._numeric_25fd0b{font-family:var(--wzl-font-numeric);font-variant-numeric:tabular-nums}._hud_4467cb{z-index:var(--wzl-z-hud,900);color:#e8e8e8;padding:var(--wzl-space-3,6px) var(--wzl-space-4,8px);pointer-events:none;text-align:right;background:#000000b3;border-radius:4px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;position:fixed}._sized_4467cb{min-width:120px;max-width:260px}._readings_4467cb{column-gap:var(--wzl-space-4,8px);grid-template-columns:auto auto;margin:0;display:grid}._readings_4467cb dt{text-align:left}._readings_4467cb dd{white-space:nowrap;margin:0}._muted_4467cb{color:#888}._absent_4467cb{color:#888;font-style:italic}._header_4467cb{margin-bottom:var(--wzl-space-1,2px)}._list_4467cb{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._item_4467cb{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._itemBest_4467cb{font-weight:700}._row_4467cb{gap:var(--wzl-space-4,8px);white-space:nowrap;justify-content:flex-end;display:flex}._stack_4467cb{flex-direction:column;align-items:flex-end;display:flex}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { INSERT_REPOSITION_BINDING as e } from "../../../interactions/actions/insert/repositionAction.js";
|
|
2
|
+
import { defineTool as t } from "../../overlayBinding.js";
|
|
3
|
+
import n from "../../../icons/EllipseIcon.js";
|
|
4
|
+
import { insertBindingBehaviors as r } from "../shared/insertToolOptions.js";
|
|
5
|
+
import { useMemo as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { cursorFor as o } from "@weasel-js/cursor";
|
|
7
8
|
//#region src/tools/builtin/ellipse/useEllipseTool.tsx
|
|
8
|
-
function
|
|
9
|
-
let { behaviors:
|
|
10
|
-
return
|
|
9
|
+
function s(s = {}) {
|
|
10
|
+
let { behaviors: c } = s;
|
|
11
|
+
return i(() => t({
|
|
11
12
|
id: "ellipse",
|
|
12
13
|
keybinding: { key: "E" },
|
|
13
14
|
capabilities: ["creates-shapes"],
|
|
14
15
|
hookName: "useEllipseTool",
|
|
15
|
-
cursor:
|
|
16
|
+
cursor: o("crosshairEllipse", { fallback: "crosshair" }),
|
|
16
17
|
presentation: {
|
|
17
18
|
label: "Ellipse",
|
|
18
19
|
group: "shape",
|
|
19
|
-
icon: /* @__PURE__ */
|
|
20
|
+
icon: /* @__PURE__ */ a(n, {})
|
|
20
21
|
},
|
|
21
22
|
bindings: [{
|
|
22
23
|
spec: { kind: "drag" },
|
|
23
24
|
actionId: "insert",
|
|
24
25
|
opts: {
|
|
25
26
|
params: { kind: "ellipse" },
|
|
26
|
-
...
|
|
27
|
+
...r(c)
|
|
27
28
|
}
|
|
28
|
-
}]
|
|
29
|
-
}), [
|
|
29
|
+
}, e]
|
|
30
|
+
}), [c]);
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
|
-
export {
|
|
33
|
+
export { s as useEllipseTool };
|
|
33
34
|
|
|
34
35
|
//# sourceMappingURL=useEllipseTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEllipseTool.js","names":["EllipseIcon","useEllipseTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/ellipse/useEllipseTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { EllipseIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/**\n * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding\n * routes to `insertAction`, which owns the live preview and commits\n * through the `insert` dep. Alt toggles from-corner ⇄ from-center\n * mid-drag via the action's live modifier read.\n */\nexport function useEllipseTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'ellipse',\n keybinding: { key: 'E' },\n capabilities: ['creates-shapes'],\n hookName: 'useEllipseTool',\n cursor: cursorFor('crosshairEllipse', { fallback: 'crosshair' }),\n presentation: {\n label: 'Ellipse',\n group: 'shape',\n icon: <EllipseIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'ellipse' } , ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEllipseTool.js","names":["EllipseIcon","useEllipseTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors","INSERT_REPOSITION_BINDING"],"sources":["../../../../src/tools/builtin/ellipse/useEllipseTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { EllipseIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { INSERT_REPOSITION_BINDING } from 'interactions/actions/insert/repositionAction';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/**\n * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding\n * routes to `insertAction`, which owns the live preview and commits\n * through the `insert` dep. Alt toggles from-corner ⇄ from-center\n * mid-drag via the action's live modifier read.\n */\nexport function useEllipseTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'ellipse',\n keybinding: { key: 'E' },\n capabilities: ['creates-shapes'],\n hookName: 'useEllipseTool',\n cursor: cursorFor('crosshairEllipse', { fallback: 'crosshair' }),\n presentation: {\n label: 'Ellipse',\n group: 'shape',\n icon: <EllipseIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'ellipse' } , ...insertBindingBehaviors(behaviors) },\n },\n INSERT_REPOSITION_BINDING,\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;;AAcA,SAAgBC,EAAe,IAA6B,CAAC,GAAS;CACpE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,IAAI;EACvB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,oBAAoB,EAAE,UAAU,YAAY,CAAC;EAC/D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAc,CAAA;EACtB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,UAAU;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC7E,GACAC,CACF;CACF,CAAC,GACH,CAACD,CAAS,CACZ;AACF"}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { INSERT_REPOSITION_BINDING as e } from "../../../interactions/actions/insert/repositionAction.js";
|
|
2
|
+
import { defineTool as t } from "../../overlayBinding.js";
|
|
3
|
+
import n from "../../../icons/LineIcon.js";
|
|
4
|
+
import { insertBindingBehaviors as r } from "../shared/insertToolOptions.js";
|
|
5
|
+
import { useMemo as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { cursorFor as o } from "@weasel-js/cursor";
|
|
7
8
|
//#region src/tools/builtin/line/useLineTool.tsx
|
|
8
|
-
function
|
|
9
|
-
let { behaviors:
|
|
10
|
-
return
|
|
9
|
+
function s(s = {}) {
|
|
10
|
+
let { behaviors: c } = s;
|
|
11
|
+
return i(() => t({
|
|
11
12
|
id: "line",
|
|
12
13
|
keybinding: { key: "\\" },
|
|
13
14
|
capabilities: ["creates-shapes"],
|
|
14
15
|
hookName: "useLineTool",
|
|
15
|
-
cursor:
|
|
16
|
+
cursor: o("crosshairLine", { fallback: "crosshair" }),
|
|
16
17
|
presentation: {
|
|
17
18
|
label: "Line",
|
|
18
19
|
group: "shape",
|
|
19
|
-
icon: /* @__PURE__ */
|
|
20
|
+
icon: /* @__PURE__ */ a(n, {})
|
|
20
21
|
},
|
|
21
22
|
bindings: [{
|
|
22
23
|
spec: { kind: "drag" },
|
|
23
24
|
actionId: "insert",
|
|
24
25
|
opts: {
|
|
25
26
|
params: { kind: "line" },
|
|
26
|
-
...
|
|
27
|
+
...r(c)
|
|
27
28
|
}
|
|
28
|
-
}]
|
|
29
|
-
}), [
|
|
29
|
+
}, e]
|
|
30
|
+
}), [c]);
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
|
-
export {
|
|
33
|
+
export { s as useLineTool };
|
|
33
34
|
|
|
34
35
|
//# sourceMappingURL=useLineTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLineTool.js","names":["LineIcon","useLineTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/line/useLineTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { LineIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** An endpoint of a line, in world coordinates. */\nexport interface LinePoint { x: number; y: number }\n\n/**\n * Drag-to-draw line tool. The `drag` binding routes to `insertAction`, which\n * commits through the `insert` dep with `{ kind: 'line', a, b }` endpoints\n * (not the AABB diagonal), so the drag direction is preserved.\n *\n * Shift constrains to 15° increments; alt mirrors the end around the start\n * (the drag is treated as a half-line).\n */\nexport function useLineTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'line',\n keybinding: { key: '\\\\' },\n capabilities: ['creates-shapes'],\n hookName: 'useLineTool',\n cursor: cursorFor('crosshairLine', { fallback: 'crosshair' }),\n presentation: {\n label: 'Line',\n group: 'shape',\n icon: <LineIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'line' } , ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLineTool.js","names":["LineIcon","useLineTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors","INSERT_REPOSITION_BINDING"],"sources":["../../../../src/tools/builtin/line/useLineTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { LineIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { INSERT_REPOSITION_BINDING } from 'interactions/actions/insert/repositionAction';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** An endpoint of a line, in world coordinates. */\nexport interface LinePoint { x: number; y: number }\n\n/**\n * Drag-to-draw line tool. The `drag` binding routes to `insertAction`, which\n * commits through the `insert` dep with `{ kind: 'line', a, b }` endpoints\n * (not the AABB diagonal), so the drag direction is preserved.\n *\n * Shift constrains to 15° increments; alt mirrors the end around the start\n * (the drag is treated as a half-line).\n */\nexport function useLineTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'line',\n keybinding: { key: '\\\\' },\n capabilities: ['creates-shapes'],\n hookName: 'useLineTool',\n cursor: cursorFor('crosshairLine', { fallback: 'crosshair' }),\n presentation: {\n label: 'Line',\n group: 'shape',\n icon: <LineIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'line' } , ...insertBindingBehaviors(behaviors) },\n },\n INSERT_REPOSITION_BINDING,\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgBC,EAAY,IAA6B,CAAC,GAAS;CACjE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,KAAK;EACxB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,iBAAiB,EAAE,UAAU,YAAY,CAAC;EAC5D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAW,CAAA;EACnB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,OAAO;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC1E,GACAC,CACF;CACF,CAAC,GACH,CAACD,CAAS,CACZ;AACF"}
|
|
@@ -6,13 +6,13 @@ import i from "../../../icons/PenIcon.js";
|
|
|
6
6
|
import { createPenPreviewLayer as a } from "../../../features/paths/penPreviewLayer.js";
|
|
7
7
|
import { constrainTo45 as o } from "../../../util/constrainTo45.js";
|
|
8
8
|
import { createPointerFollower as s } from "../shared/pointerFollower.js";
|
|
9
|
-
import { anchorsToPath as c, boundsOfPath as l,
|
|
10
|
-
import { createElement as
|
|
11
|
-
import { useLatest as
|
|
12
|
-
import { ActionDisabledReason as
|
|
13
|
-
import { cursorFor as
|
|
9
|
+
import { anchorsToPath as c, boundsOfPath as l, editAnchorSetTracked as u, nearestPathAnchor as d, pathToAnchors as f, pxExtent as p, reverseAnchors as m, withinPxRadius as h } from "@weasel-js/geom";
|
|
10
|
+
import { createElement as g, useCallback as _, useMemo as v, useReducer as y, useRef as b, useState as x } from "react";
|
|
11
|
+
import { useLatest as S } from "@weasel-js/react";
|
|
12
|
+
import { ActionDisabledReason as C } from "@weasel-js/routing";
|
|
13
|
+
import { cursorFor as w } from "@weasel-js/cursor";
|
|
14
14
|
//#region src/tools/builtin/pen/usePenTool.ts
|
|
15
|
-
function
|
|
15
|
+
function T() {
|
|
16
16
|
return {
|
|
17
17
|
finishedSubpaths: [],
|
|
18
18
|
current: null,
|
|
@@ -22,96 +22,96 @@ function w() {
|
|
|
22
22
|
continuing: null
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function E(e) {
|
|
26
26
|
e.finishedSubpaths = [], e.current = null, e.cursor = null, e.draggingHandleAt = null, e.closeHintActive = !1, e.continuing = null;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function D(e) {
|
|
29
29
|
return (e.current ? e.current.anchors.length : 0) + e.finishedSubpaths.reduce((e, t) => e + t.anchors.length, 0);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function O(e, t) {
|
|
32
32
|
let n = [...e];
|
|
33
33
|
return t && t.anchors.length > 0 && n.push(t), c(n.map((e) => e.anchors), n.map((e) => e.closed));
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
let { autoSelect:
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
autoSelect:
|
|
40
|
-
autoCommitOnClose:
|
|
41
|
-
closeHitRadius:
|
|
42
|
-
anchorSnapRadius:
|
|
43
|
-
snapPoint:
|
|
44
|
-
}), [,
|
|
35
|
+
function k(o = {}) {
|
|
36
|
+
let { autoSelect: p = !0, autoCommitOnClose: k = !0, closeHitRadius: P = 8, anchorSnapRadius: F = 8, snapPoint: I } = o, L = b(null);
|
|
37
|
+
L.current === null && (L.current = T());
|
|
38
|
+
let R = S({
|
|
39
|
+
autoSelect: p,
|
|
40
|
+
autoCommitOnClose: k,
|
|
41
|
+
closeHitRadius: P,
|
|
42
|
+
anchorSnapRadius: F,
|
|
43
|
+
snapPoint: I
|
|
44
|
+
}), [, z] = y((e) => e + 1, 0), [B] = x(() => a({ state: L.current })), V = _((t, n, r) => {
|
|
45
45
|
let i = r.editAnchors, a = t.continuing, o = [...t.finishedSubpaths, ...n ? [n] : []];
|
|
46
46
|
if (!i || o.length === 0) return;
|
|
47
|
-
let { anchors: s, closed:
|
|
48
|
-
a.reversed && (s[0] =
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
47
|
+
let { anchors: s, closed: c } = f(O(o, null));
|
|
48
|
+
a.reversed && (s[0] = m(s[0]));
|
|
49
|
+
let l = u(a.original, (e) => {
|
|
50
|
+
e.anchors.splice(a.sub, 1, s[0]), e.closed.splice(a.sub, 1, c[0]), e.anchors.push(...s.slice(1)), e.closed.push(...c.slice(1));
|
|
51
|
+
});
|
|
52
|
+
N(l.path, a.original) || (i.applyEdit(a.id, l.path, "Continue path", l.origins), R.current.autoSelect && r.selection?.set([e(a.id)]));
|
|
53
|
+
}, [R]), H = _((e, t) => {
|
|
54
54
|
let n = e.current && e.current.anchors.length > 0 ? e.current : null;
|
|
55
55
|
if (e.continuing) {
|
|
56
|
-
|
|
56
|
+
V(e, n, t), E(e);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
let r = n && n.anchors.length >= 2 ? n : null;
|
|
60
60
|
if (e.finishedSubpaths.length === 0 && !r) {
|
|
61
|
-
|
|
61
|
+
E(e);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
let i = e.finishedSubpaths.every((e) => e.closed) && (r === null || r.closed), a =
|
|
64
|
+
let i = e.finishedSubpaths.every((e) => e.closed) && (r === null || r.closed), a = O(e.finishedSubpaths, r), o = t.insert?.commit(l(a), {
|
|
65
65
|
kind: "path",
|
|
66
66
|
path: a,
|
|
67
67
|
closed: i
|
|
68
68
|
}) ?? null;
|
|
69
|
-
o !== null &&
|
|
70
|
-
}, [
|
|
69
|
+
o !== null && R.current.autoSelect && t.selection?.set([o]), E(e);
|
|
70
|
+
}, [V, R]), U = _((e, t, n) => {
|
|
71
71
|
if (!n || n.end === null || !e.current || e.current.anchors.length === 0) return !1;
|
|
72
72
|
let r = e.continuing;
|
|
73
73
|
if (r && n.id === r.id && n.sub === r.sub) return !1;
|
|
74
74
|
let i = t.scene;
|
|
75
75
|
return !i && !t.applyOps || !(r ? t.editAnchors?.editOps : t.insert?.build) ? !1 : r?.id === n.id || i?.get(n.id) !== void 0;
|
|
76
|
-
}, []),
|
|
77
|
-
let o = i.editAnchors, s = i.scene,
|
|
78
|
-
|
|
79
|
-
let
|
|
76
|
+
}, []), W = _((r, i, a) => {
|
|
77
|
+
let o = i.editAnchors, s = i.scene, d = r.current, { anchors: p, closed: h } = f(O([...r.finishedSubpaths, d], null)), g = o.getEditablePath(a.id), _ = f(g), v = a.end === "last" ? m(_.anchors[a.sub]) : _.anchors[a.sub], y = p[p.length - 1], b = y[y.length - 1], x = d.anchors[d.anchors.length - 1].outHandle ?? v[0].outHandle;
|
|
78
|
+
x && (b.outHandle = { ...x }), y.push(...v.slice(1));
|
|
79
|
+
let S = r.continuing, C = S?.id === a.id, w = C ? {
|
|
80
80
|
anchors: [],
|
|
81
81
|
closed: []
|
|
82
82
|
} : {
|
|
83
|
-
anchors:
|
|
84
|
-
closed:
|
|
85
|
-
},
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
let e =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
anchors: _.anchors.filter((e, t) => t !== a.sub),
|
|
84
|
+
closed: _.closed.filter((e, t) => t !== a.sub)
|
|
85
|
+
}, T = "Join paths", D = [], k;
|
|
86
|
+
if (S) {
|
|
87
|
+
S.reversed && (p[0] = m(p[0]));
|
|
88
|
+
let e = u(S.original, (e) => {
|
|
89
|
+
e.anchors.splice(S.sub, 1, p[0]), e.closed.splice(S.sub, 1, h[0]), e.anchors.push(...p.slice(1), ...w.anchors), e.closed.push(...h.slice(1), ...w.closed), C && (e.anchors.splice(a.sub, 1), e.closed.splice(a.sub, 1));
|
|
90
|
+
});
|
|
91
|
+
D.push(...o.editOps(S.id, e.path, T, e.origins)), k = S.id;
|
|
92
92
|
} else {
|
|
93
|
-
let e = c([...
|
|
93
|
+
let e = c([...p, ...w.anchors], [...h, ...w.closed]), t = i.insert.build(l(e), {
|
|
94
94
|
kind: "path",
|
|
95
95
|
path: e,
|
|
96
96
|
closed: !1
|
|
97
97
|
});
|
|
98
98
|
if (t === null) return;
|
|
99
|
-
|
|
99
|
+
D.push(...t.ops), k = t.id;
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
let r =
|
|
101
|
+
C || D.push(n({ node: s.get(a.id) }));
|
|
102
|
+
let A = i.applyOps;
|
|
103
|
+
A ? A(D, T) : s.applyBatch(D, T, t(s)), R.current.autoSelect && i.selection?.set([e(k)]), E(r);
|
|
104
|
+
}, [R]), G = _((e, t, n) => {
|
|
105
|
+
let r = L.current;
|
|
106
106
|
if (r.current || r.finishedSubpaths.length > 0) return !1;
|
|
107
|
-
let i =
|
|
107
|
+
let i = R.current.closeHitRadius, a = j(e), o = d(M(e, t, n, i), {
|
|
108
108
|
x: t,
|
|
109
109
|
y: n
|
|
110
110
|
}, i, a, (e) => e.end !== null);
|
|
111
111
|
if (!o) return !1;
|
|
112
|
-
let s = e.editAnchors.getEditablePath(o.id), c =
|
|
112
|
+
let s = e.editAnchors.getEditablePath(o.id), c = f(s).anchors[o.sub], l = o.end === "first" && c.length > 1;
|
|
113
113
|
return r.current = {
|
|
114
|
-
anchors: l ?
|
|
114
|
+
anchors: l ? m(c) : c,
|
|
115
115
|
closed: !1
|
|
116
116
|
}, r.continuing = {
|
|
117
117
|
id: o.id,
|
|
@@ -119,8 +119,8 @@ function O(o = {}) {
|
|
|
119
119
|
reversed: l,
|
|
120
120
|
original: s
|
|
121
121
|
}, !0;
|
|
122
|
-
}, [
|
|
123
|
-
let n =
|
|
122
|
+
}, [R]), K = _((e, t) => {
|
|
123
|
+
let n = R.current.snapPoint;
|
|
124
124
|
return n ? n({
|
|
125
125
|
x: e,
|
|
126
126
|
y: t
|
|
@@ -128,13 +128,13 @@ function O(o = {}) {
|
|
|
128
128
|
x: e,
|
|
129
129
|
y: t
|
|
130
130
|
};
|
|
131
|
-
}, [
|
|
132
|
-
let r =
|
|
131
|
+
}, [R]), q = _((e, t, n) => {
|
|
132
|
+
let r = R.current.anchorSnapRadius;
|
|
133
133
|
if (r > 0) {
|
|
134
|
-
let i =
|
|
134
|
+
let i = d(M(e, t, n, r), {
|
|
135
135
|
x: t,
|
|
136
136
|
y: n
|
|
137
|
-
}, r,
|
|
137
|
+
}, r, j(e));
|
|
138
138
|
if (i) return {
|
|
139
139
|
x: i.x,
|
|
140
140
|
y: i.y,
|
|
@@ -142,20 +142,20 @@ function O(o = {}) {
|
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
return {
|
|
145
|
-
...
|
|
145
|
+
...K(t, n),
|
|
146
146
|
hit: null
|
|
147
147
|
};
|
|
148
|
-
}, [
|
|
148
|
+
}, [K, R]), J = _((e, t, n, r, i) => h(t - r, n - i, R.current.closeHitRadius, j(e)), [R]), Y = v(() => {
|
|
149
149
|
let e, t = s(() => n()), n = () => {
|
|
150
|
-
let n =
|
|
150
|
+
let n = L.current;
|
|
151
151
|
!n.current && n.finishedSubpaths.length === 0 && t.unfollow();
|
|
152
152
|
let r = n.current ? t.pointer()?.get() ?? null : null;
|
|
153
|
-
n.cursor = r ?
|
|
153
|
+
n.cursor = r ? K(r.worldX, r.worldY) : null;
|
|
154
154
|
let i = n.current && n.current.anchors.length >= 3 ? n.current.anchors[0] : null;
|
|
155
|
-
n.closeHintActive = i !== null && n.cursor !== null &&
|
|
155
|
+
n.closeHintActive = i !== null && n.cursor !== null && h(i.x - n.cursor.x, i.y - n.cursor.y, R.current.closeHitRadius, e?.get().scale ?? {
|
|
156
156
|
x: 1,
|
|
157
157
|
y: 1
|
|
158
|
-
}),
|
|
158
|
+
}), z();
|
|
159
159
|
};
|
|
160
160
|
return {
|
|
161
161
|
refresh: n,
|
|
@@ -163,11 +163,11 @@ function O(o = {}) {
|
|
|
163
163
|
e = r.view, t.follow(r.pointer), n();
|
|
164
164
|
},
|
|
165
165
|
stop() {
|
|
166
|
-
t.unfollow(),
|
|
166
|
+
t.unfollow(), z();
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
}, [
|
|
170
|
-
let e = () =>
|
|
169
|
+
}, [K, R]), X = v(() => {
|
|
170
|
+
let e = () => L.current;
|
|
171
171
|
return [
|
|
172
172
|
{
|
|
173
173
|
id: "pen.placeAnchor",
|
|
@@ -188,26 +188,26 @@ function O(o = {}) {
|
|
|
188
188
|
run: (t, n) => {
|
|
189
189
|
let r = n;
|
|
190
190
|
if (r?.pressX === void 0 || r.pressY === void 0) return;
|
|
191
|
-
if (
|
|
192
|
-
|
|
191
|
+
if (G(t, r.pressX, r.pressY)) {
|
|
192
|
+
Y.update(t);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
let { x: i, y: a, hit: o } =
|
|
195
|
+
let { x: i, y: a, hit: o } = q(t, r.pressX, r.pressY), s = e();
|
|
196
196
|
if (s.current && s.current.anchors.length >= 3) {
|
|
197
197
|
let e = s.current.anchors[0];
|
|
198
|
-
if (
|
|
199
|
-
s.current.closed = !0, s.finishedSubpaths.push(s.current), s.current = null, s.closeHintActive = !1,
|
|
198
|
+
if (J(t, e.x, e.y, i, a)) {
|
|
199
|
+
s.current.closed = !0, s.finishedSubpaths.push(s.current), s.current = null, s.closeHintActive = !1, R.current.autoCommitOnClose && H(s, t), Y.update(t);
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
let c =
|
|
203
|
+
let c = U(s, t, o);
|
|
204
204
|
s.current ||= {
|
|
205
205
|
anchors: [],
|
|
206
206
|
closed: !1
|
|
207
207
|
}, s.current.anchors.push({
|
|
208
208
|
x: i,
|
|
209
209
|
y: a
|
|
210
|
-
}), c &&
|
|
210
|
+
}), c && W(s, t, o), Y.update(t);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
},
|
|
@@ -220,12 +220,12 @@ function O(o = {}) {
|
|
|
220
220
|
"insert",
|
|
221
221
|
"selection"
|
|
222
222
|
],
|
|
223
|
-
enabled: () =>
|
|
223
|
+
enabled: () => D(e()) >= 2 || C.NotApplicable,
|
|
224
224
|
invoker: {
|
|
225
225
|
timing: "immediate",
|
|
226
226
|
run: (t, n) => {
|
|
227
227
|
let r = e();
|
|
228
|
-
n?.viaDoubleClick && r.current && (r.current.anchors.pop(), r.current.anchors.length === 0 && (r.current = null)),
|
|
228
|
+
n?.viaDoubleClick && r.current && (r.current.anchors.pop(), r.current.anchors.length === 0 && (r.current = null)), H(r, t), Y.refresh();
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
},
|
|
@@ -246,10 +246,10 @@ function O(o = {}) {
|
|
|
246
246
|
invoker: {
|
|
247
247
|
timing: "ongoing",
|
|
248
248
|
start: (t) => {
|
|
249
|
-
let n = e(), r = t.drag?.start ?? t.world, i =
|
|
249
|
+
let n = e(), r = t.drag?.start ?? t.world, i = G(t.deps, r.x, r.y), a = null;
|
|
250
250
|
if (!i) {
|
|
251
|
-
let { x: e, y: i, hit: o } =
|
|
252
|
-
|
|
251
|
+
let { x: e, y: i, hit: o } = q(t.deps, r.x, r.y);
|
|
252
|
+
U(n, t.deps, o) && (a = o), n.current ||= {
|
|
253
253
|
anchors: [],
|
|
254
254
|
closed: !1
|
|
255
255
|
}, n.current.anchors.push({
|
|
@@ -259,18 +259,18 @@ function O(o = {}) {
|
|
|
259
259
|
}
|
|
260
260
|
n.draggingHandleAt = n.current.anchors.length - 1, t.modifiers.alt && (n.current.anchors[n.draggingHandleAt].altBroken = !0);
|
|
261
261
|
let o = !i;
|
|
262
|
-
return
|
|
262
|
+
return A(n, t.world, t.modifiers.shift, o, R.current.snapPoint), Y.update(t.deps), {
|
|
263
263
|
onMove: (t) => {
|
|
264
264
|
let n = e();
|
|
265
|
-
n.draggingHandleAt !== null && (t.modifiers.alt && n.current && (n.current.anchors[n.draggingHandleAt].altBroken = !0),
|
|
265
|
+
n.draggingHandleAt !== null && (t.modifiers.alt && n.current && (n.current.anchors[n.draggingHandleAt].altBroken = !0), A(n, t.world, t.modifiers.shift, o, R.current.snapPoint), z());
|
|
266
266
|
},
|
|
267
267
|
onEnd: (n, r) => {
|
|
268
268
|
let s = e();
|
|
269
269
|
if (r === "cancel") {
|
|
270
|
-
i ?
|
|
270
|
+
i ? E(s) : s.current && s.draggingHandleAt === s.current.anchors.length - 1 && (s.current.anchors.pop(), s.current.anchors.length === 0 && (s.current = null)), s.draggingHandleAt = null, Y.refresh();
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
|
-
s.draggingHandleAt !== null && (n.modifiers.alt && s.current && (s.current.anchors[s.draggingHandleAt].altBroken = !0),
|
|
273
|
+
s.draggingHandleAt !== null && (n.modifiers.alt && s.current && (s.current.anchors[s.draggingHandleAt].altBroken = !0), A(s, n.world, n.modifiers.shift, o, R.current.snapPoint), s.draggingHandleAt = null), a && s.current && W(s, t.deps, a), Y.refresh();
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
}
|
|
@@ -285,11 +285,11 @@ function O(o = {}) {
|
|
|
285
285
|
"insert",
|
|
286
286
|
"selection"
|
|
287
287
|
],
|
|
288
|
-
enabled: () =>
|
|
288
|
+
enabled: () => D(e()) > 0 || C.NotApplicable,
|
|
289
289
|
invoker: {
|
|
290
290
|
timing: "immediate",
|
|
291
291
|
run: (t) => {
|
|
292
|
-
|
|
292
|
+
H(e(), t), Y.refresh();
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
},
|
|
@@ -299,43 +299,43 @@ function O(o = {}) {
|
|
|
299
299
|
eligible: { capability: "creates-paths" },
|
|
300
300
|
enabled: () => {
|
|
301
301
|
let t = e();
|
|
302
|
-
return t.current !== null || t.finishedSubpaths.length > 0 ||
|
|
302
|
+
return t.current !== null || t.finishedSubpaths.length > 0 || C.NotApplicable;
|
|
303
303
|
},
|
|
304
304
|
invoker: {
|
|
305
305
|
timing: "immediate",
|
|
306
306
|
run: () => {
|
|
307
|
-
|
|
307
|
+
E(e()), Y.refresh();
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
];
|
|
312
312
|
}, [
|
|
313
|
-
V,
|
|
314
|
-
K,
|
|
315
|
-
q,
|
|
316
|
-
W,
|
|
317
313
|
H,
|
|
318
|
-
|
|
319
|
-
L,
|
|
314
|
+
q,
|
|
320
315
|
J,
|
|
321
|
-
|
|
316
|
+
G,
|
|
317
|
+
U,
|
|
318
|
+
W,
|
|
319
|
+
R,
|
|
320
|
+
Y,
|
|
321
|
+
z
|
|
322
322
|
]);
|
|
323
|
-
return
|
|
323
|
+
return v(() => r({
|
|
324
324
|
id: "pen",
|
|
325
325
|
keybinding: { key: "P" },
|
|
326
326
|
capabilities: ["creates-paths"],
|
|
327
327
|
hookName: "usePenTool",
|
|
328
|
-
cursor: () =>
|
|
328
|
+
cursor: () => L.current?.closeHintActive ? "pointer" : w("pen", { fallback: "crosshair" }),
|
|
329
329
|
presentation: {
|
|
330
330
|
label: "Pen",
|
|
331
|
-
icon:
|
|
331
|
+
icon: g(i),
|
|
332
332
|
group: "draw"
|
|
333
333
|
},
|
|
334
|
-
actions:
|
|
335
|
-
overlay:
|
|
334
|
+
actions: X,
|
|
335
|
+
overlay: B,
|
|
336
336
|
overlayPosition: "before-selection",
|
|
337
337
|
onDeactivate: () => {
|
|
338
|
-
|
|
338
|
+
E(L.current), Y.stop();
|
|
339
339
|
},
|
|
340
340
|
bindings: [
|
|
341
341
|
{
|
|
@@ -396,12 +396,12 @@ function O(o = {}) {
|
|
|
396
396
|
}
|
|
397
397
|
]
|
|
398
398
|
}), [
|
|
399
|
+
X,
|
|
399
400
|
Y,
|
|
400
|
-
|
|
401
|
-
z
|
|
401
|
+
B
|
|
402
402
|
]);
|
|
403
403
|
}
|
|
404
|
-
|
|
404
|
+
k.prefs = {
|
|
405
405
|
name: "Pen",
|
|
406
406
|
description: "Pen-tool behavior.",
|
|
407
407
|
children: { autoCommitOnClose: {
|
|
@@ -411,7 +411,7 @@ O.prefs = {
|
|
|
411
411
|
default: !0
|
|
412
412
|
} }
|
|
413
413
|
};
|
|
414
|
-
function
|
|
414
|
+
function A(e, t, n, r, i) {
|
|
415
415
|
if (e.current === null || e.draggingHandleAt === null) return;
|
|
416
416
|
let a = e.current.anchors[e.draggingHandleAt], s = i ? i(t) : t, c = s.x - a.x, l = s.y - a.y;
|
|
417
417
|
if (n) {
|
|
@@ -426,16 +426,16 @@ function k(e, t, n, r, i) {
|
|
|
426
426
|
y: a.y - l
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function j(e) {
|
|
430
430
|
return e.view?.get().scale ?? {
|
|
431
431
|
x: 1,
|
|
432
432
|
y: 1
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function M(e, t, n, r) {
|
|
436
436
|
let i = e.areaSelect, a = e.editAnchors;
|
|
437
437
|
if (!i || !a) return [];
|
|
438
|
-
let o = e.view, s =
|
|
438
|
+
let o = e.view, s = p(r, j(e)), c = i.hitTestArea({
|
|
439
439
|
x: t - s.x,
|
|
440
440
|
y: n - s.y,
|
|
441
441
|
width: 2 * s.x,
|
|
@@ -450,13 +450,13 @@ function j(e, t, n, r) {
|
|
|
450
450
|
}
|
|
451
451
|
return l;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function N(e, t) {
|
|
454
454
|
if (e.commands.length !== t.commands.length || e.coords.length !== t.coords.length) return !1;
|
|
455
455
|
for (let n = 0; n < e.commands.length; n++) if (e.commands[n] !== t.commands[n]) return !1;
|
|
456
456
|
for (let n = 0; n < e.coords.length; n++) if (e.coords[n] !== t.coords[n]) return !1;
|
|
457
457
|
return !0;
|
|
458
458
|
}
|
|
459
459
|
//#endregion
|
|
460
|
-
export {
|
|
460
|
+
export { k as usePenTool };
|
|
461
461
|
|
|
462
462
|
//# sourceMappingURL=usePenTool.js.map
|