@weasel-js/core 1.8.0 → 1.9.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 +84 -0
- package/README.md +9 -5
- package/dist/animation/useAnimator.js +20 -13
- package/dist/animation/useAnimator.js.map +1 -1
- package/dist/{builtins-BW32dOXy.d.ts → builtins-CQcvcLXh.d.ts} +105 -31
- package/dist/canvas/DrawCanvas.js +33 -33
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/MinimapCanvas.js +29 -29
- package/dist/canvas/MinimapCanvas.js.map +1 -1
- package/dist/canvas/NodeShape.js +63 -54
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +26 -5
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +3 -2
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +526 -529
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +35 -35
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +6 -1
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/useHitObserver.js +23 -0
- package/dist/canvas/useHitObserver.js.map +1 -0
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/scene.js +9 -0
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/useSelection.js +27 -33
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/stableStringify.js +8 -0
- package/dist/core/stableStringify.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +3 -3
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +8 -2
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/features/minimap/actions.js.map +1 -1
- package/dist/features/paths/markerCommands.js +95 -63
- package/dist/features/paths/markerCommands.js.map +1 -1
- package/dist/features/paths/tessellate/dash.js +52 -0
- package/dist/features/paths/tessellate/dash.js.map +1 -0
- package/dist/features/paths/tessellate/insets.js +32 -0
- package/dist/features/paths/tessellate/insets.js.map +1 -0
- package/dist/features/paths/tessellate/metric.js +72 -0
- package/dist/features/paths/tessellate/metric.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +74 -134
- package/dist/features/paths/tessellate/stroke.js.map +1 -1
- package/dist/features/paths/tessellate/vertexWidths.js +32 -0
- package/dist/features/paths/tessellate/vertexWidths.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +2 -2
- package/dist/features/pointer/PointerContext.js.map +1 -1
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/text/useTextEdit.js +86 -84
- package/dist/features/text/useTextEdit.js.map +1 -1
- package/dist/index.d.ts +84 -45
- package/dist/index.js +269 -268
- package/dist/interactions/actions/defaults/align.js.map +1 -1
- 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/booleans.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/clipboard.js.map +1 -1
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/createOutlines.js +1 -1
- package/dist/interactions/actions/defaults/createOutlines.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/distribute.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/escape.js +1 -1
- package/dist/interactions/actions/defaults/escape.js.map +1 -1
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/flip.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insert.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- 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/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -1
- package/dist/interactions/actions/defaults/slice.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/undoRedo.js +1 -1
- package/dist/interactions/actions/defaults/undoRedo.js.map +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/planeInput.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/{registerProgram-ateHDGjw.d.ts → registerProgram-BMZRDgrh.d.ts} +4 -0
- package/dist/renderer/cache/markerCommandCache.js +46 -42
- package/dist/renderer/cache/markerCommandCache.js.map +1 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +30 -25
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -1
- package/dist/renderer/cache/strokeMeshCache.js +42 -31
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -1
- package/dist/renderer/cullDrawCommands.js +32 -31
- package/dist/renderer/cullDrawCommands.js.map +1 -1
- package/dist/renderer/draw.js +315 -362
- package/dist/renderer/draw.js.map +1 -1
- package/dist/renderer/drawBatch.js.map +1 -1
- package/dist/renderer/glyphOutlineMesh.js +67 -0
- package/dist/renderer/glyphOutlineMesh.js.map +1 -0
- package/dist/renderer/math/mat3.js +8 -3
- package/dist/renderer/math/mat3.js.map +1 -1
- package/dist/renderer/shaders/batchFill.js +3 -2
- package/dist/renderer/shaders/batchFill.js.map +1 -1
- package/dist/renderer/strokeLengths.js +50 -0
- package/dist/renderer/strokeLengths.js.map +1 -0
- package/dist/renderer.d.ts +2 -2
- package/dist/{test-seams-fYf6m5pu.d.ts → test-seams-CuIxe0xY.d.ts} +1 -1
- package/dist/test-seams.d.ts +2 -2
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +1 -1
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +43 -23
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +17 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSliceTool.js","names":["VERTEX_RADIUS_PX","useSliceTool","scratchRef","useRef","optsRef","useLatest","options","live","useMemo","listeners","pointer","offPointer","notify","fn","next","actions","points","pending","ActionDisabledReason","reset","commit","cut","deps","place","pts","first","scale","withinPxRadius","x","y","eligible","sliceAction","\"slice\"","p","params","reason","at","endCtx","overlay","t","viewToTransform","view","toScreen","worldToScreen","run","stroke","OVERLAY_ROLE_STROKES","\"cut\"","out","polylineFromPoints","ellipsePath","defineTool","keybinding"],"sources":["../../../../src/tools/builtin/slice/useSliceTool.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '../../../renderer';\nimport type { Action, ActionDeps, InvocationCtx, ToolKeybinding } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { SliceDep, ViewApi } from 'interactions/actions/depSchema';\nimport type { PointerContextValue } from 'features/pointer/PointerContext';\nimport { sliceAction } from 'interactions/actions/defaults/slice';\nimport { withinPxRadius } from 'core/viewport/pxExtent';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { viewToTransform } from 'core/viewport/view';\nimport { ellipsePath, polylineFromPoints } from '@weasel-js/geom';\nimport { OVERLAY_ROLE_STROKES } from 'canvas/overlayRoleStrokes';\n\n/** Options for `useSliceTool`. */\nexport interface UseSliceToolOptions {\n /** Override the default keybinding (`{ key: 'K' }`). Pass `null` to omit. */\n keybinding?: ToolKeybinding | null;\n /** Screen-px radius around the first point within which a click closes the\n * cut into a loop and commits it. Default `8`. */\n closeHitRadius?: number;\n}\n\n/** The click-by-click cut in progress, in world coords. */\nexport interface SliceScratch {\n points: { x: number; y: number }[];\n}\n\nconst VERTEX_RADIUS_PX = 3;\n\n/**\n * Knife tool. A drag cuts along a straight line, and an Alt-drag along its\n * freehand trail, through `sliceAction`. Clicks place a cut one point at a\n * time: Enter or a double-click commits it, Escape discards it, Backspace\n * takes back the last point, and a click on the first point closes it into a\n * loop and commits. While points are placed, a drag places one more where it\n * is released instead of cutting on its own.\n *\n * Every cut goes to the `slice` dep, which decides what it does to the scene.\n * `<SceneCanvas>` publishes one that cuts every path the cut crosses. The pending cut paints through\n * `Tool.overlay`, trailing to the pointer when the host publishes one.\n */\nexport function useSliceTool(options: UseSliceToolOptions = {}): Tool<null> {\n const scratchRef = useRef<SliceScratch>({ points: [] });\n const optsRef = useLatest({ closeHitRadius: options.closeHitRadius ?? 8 });\n\n // What the overlay layer's `subscribe` hears: a change to the points, and,\n // while any are placed, every move of the pointer the rubber band follows.\n const live = useMemo(() => {\n const listeners = new Set<() => void>();\n let pointer: PointerContextValue | null = null;\n let offPointer: (() => void) | null = null;\n const notify = (): void => { for (const fn of [...listeners]) fn(); };\n return {\n notify,\n listen(fn: () => void): () => void {\n listeners.add(fn);\n return () => { listeners.delete(fn); };\n },\n pointer: () => pointer,\n follow(next: PointerContextValue | undefined): void {\n if (!next || next === pointer) return;\n offPointer?.();\n pointer = next;\n offPointer = next.subscribe(notify);\n },\n unfollow(): void {\n offPointer?.();\n offPointer = null;\n pointer = null;\n },\n };\n }, []);\n\n const actions = useMemo<Action[]>(() => {\n const points = () => scratchRef.current.points;\n const pending = () => (points().length > 0 ? true : ActionDisabledReason.NotApplicable);\n\n const reset = (): void => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n };\n const commit = (deps: ActionDeps): void => {\n const cut = points().slice();\n reset();\n if (cut.length >= 2) (deps.slice as SliceDep | undefined)?.commit(cut);\n };\n const place = (deps: ActionDeps, x: number, y: number): void => {\n const pts = points();\n const first = pts[0];\n const scale = (deps.view as ViewApi | undefined)?.get().scale ?? { x: 1, y: 1 };\n if (pts.length >= 3 && withinPxRadius(x - first.x, y - first.y, optsRef.current.closeHitRadius, scale)) {\n pts.push({ x: first.x, y: first.y });\n commit(deps);\n return;\n }\n pts.push({ x, y });\n live.follow(deps.pointer as PointerContextValue | undefined);\n live.notify();\n };\n\n const eligible = { capability: 'edits-page' } as const;\n return [\n sliceAction,\n {\n id: 'slice.addPoint',\n label: 'Slice — place point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: (deps) => (deps?.['slice'] ? true : ActionDisabledReason.NotApplicable),\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const p = params as { pressX?: number; pressY?: number } | undefined;\n if (p?.pressX === undefined || p.pressY === undefined) return;\n place(deps, p.pressX, p.pressY);\n },\n },\n },\n {\n id: 'slice.dragPoint',\n label: 'Slice — drag out a point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: pending,\n invoker: {\n timing: 'ongoing',\n start: () => ({\n onMove: () => {},\n onEnd: (endCtx: InvocationCtx, reason: 'commit' | 'cancel') => {\n if (reason === 'cancel' || points().length === 0) return;\n const at = endCtx.drag?.current ?? endCtx.world;\n place(endCtx.deps, at.x, at.y);\n },\n }),\n },\n },\n {\n id: 'slice.finish',\n label: 'Slice — cut along the points',\n eligible,\n requires: ['slice'],\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n // A double click arrives after both of its clicks, so the second\n // has already placed a point on top of the first.\n if ((params as { viaDoubleClick?: boolean } | undefined)?.viaDoubleClick) points().pop();\n commit(deps);\n },\n },\n },\n {\n id: 'slice.dropPoint',\n label: 'Slice — take back the last point',\n eligible,\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: () => {\n points().pop();\n if (points().length === 0) reset();\n else live.notify();\n },\n },\n },\n {\n id: 'slice.cancel',\n label: 'Slice — discard the points',\n eligible,\n // Declining with nothing placed leaves Escape to the ambient `escape`.\n enabled: pending,\n invoker: { timing: 'immediate', run: () => reset() },\n },\n ];\n }, [live, optsRef]);\n\n const overlay = useMemo<RenderLayer<unknown>>(() => ({\n id: 'slice-pending-cut',\n label: 'Slice — pending cut',\n space: 'screen',\n subscribe: live.listen,\n draw: (_data, view) => {\n const pts = scratchRef.current.points;\n if (pts.length === 0) return [];\n const t = viewToTransform(view);\n const toScreen = (p: { x: number; y: number }) => {\n const [x, y] = worldToScreen(p.x, p.y, t);\n return { x, y };\n };\n const run = pts.map(toScreen);\n const at = live.pointer()?.get();\n if (at) run.push(toScreen({ x: at.worldX, y: at.worldY }));\n const stroke = OVERLAY_ROLE_STROKES['cut'];\n const out: DrawCommand[] = [];\n if (run.length >= 2) out.push({ kind: 'path', path: polylineFromPoints(run), stroke });\n for (const p of pts.map(toScreen)) {\n out.push({\n kind: 'path',\n path: ellipsePath({\n x: p.x - VERTEX_RADIUS_PX,\n y: p.y - VERTEX_RADIUS_PX,\n width: VERTEX_RADIUS_PX * 2,\n height: VERTEX_RADIUS_PX * 2,\n }),\n fill: stroke.paint,\n });\n }\n return out;\n },\n }), [live]);\n\n const { keybinding } = options;\n return useMemo(() => defineTool<null>({\n id: 'slice',\n capabilities: ['edits-page'],\n hookName: 'useSliceTool',\n cursor: 'crosshair',\n presentation: { label: 'Slice', group: 'shape' },\n ...(keybinding === null ? {} : { keybinding: keybinding ?? { key: 'K' } }),\n actions,\n overlay,\n onDeactivate: () => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n },\n bindings: [\n { spec: { kind: 'click', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.addPoint' },\n {\n spec: { kind: 'doubleClick', mods: { shift: 'optional', alt: 'optional' } },\n actionId: 'slice.finish',\n opts: { params: { viaDoubleClick: true } },\n },\n // Ahead of the cutting drags: it declines unless points are placed.\n { spec: { kind: 'drag', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.dragPoint' },\n { spec: { kind: 'drag' }, actionId: 'slice' },\n { spec: { kind: 'drag', mods: { alt: true } }, actionId: 'slice', opts: { params: { cut: 'freehand' } } },\n { spec: { kind: 'key', key: 'Enter' }, actionId: 'slice.finish' },\n { spec: { kind: 'key', key: 'Escape' }, actionId: 'slice.cancel' },\n { spec: { kind: 'key', key: 'Backspace' }, actionId: 'slice.dropPoint' },\n ],\n }), [actions, overlay, keybinding, live]);\n}\n"],"mappings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ceTool","scratchRef","useRef","optsRef","useLatest","options","live","useMemo","listeners","pointer","offPointer","notify","fn","next","actions","points","pending","ActionDisabledReason","reset","commit","cut","deps","place","pts","first","scale","withinPxRadius","x","y","eligible","sliceAction","\"slice\"","p","params","reason","at","endCtx","overlay","t","viewToTransform","view","toScreen","worldToScreen","run","stroke","OVERLAY_ROLE_STROKES","\"cut\"","out","polylineFromPoints","ellipsePath","defineTool","keybinding"],"sources":["../../../../src/tools/builtin/slice/useSliceTool.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '../../../renderer';\nimport type { Action, ActionDeps, InvocationCtx, ToolKeybinding } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { PointerContextValue } from 'features/pointer/PointerContext';\nimport { sliceAction } from 'interactions/actions/defaults/slice';\nimport { withinPxRadius } from 'core/viewport/pxExtent';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { viewToTransform } from 'core/viewport/view';\nimport { ellipsePath, polylineFromPoints } from '@weasel-js/geom';\nimport { OVERLAY_ROLE_STROKES } from 'canvas/overlayRoleStrokes';\n\n/** Options for `useSliceTool`. */\nexport interface UseSliceToolOptions {\n /** Override the default keybinding (`{ key: 'K' }`). Pass `null` to omit. */\n keybinding?: ToolKeybinding | null;\n /** Screen-px radius around the first point within which a click closes the\n * cut into a loop and commits it. Default `8`. */\n closeHitRadius?: number;\n}\n\n/** The click-by-click cut in progress, in world coords. */\nexport interface SliceScratch {\n points: { x: number; y: number }[];\n}\n\nconst VERTEX_RADIUS_PX = 3;\n\n/**\n * Knife tool. A drag cuts along a straight line, and an Alt-drag along its\n * freehand trail, through `sliceAction`. Clicks place a cut one point at a\n * time: Enter or a double-click commits it, Escape discards it, Backspace\n * takes back the last point, and a click on the first point closes it into a\n * loop and commits. While points are placed, a drag places one more where it\n * is released instead of cutting on its own.\n *\n * Every cut goes to the `slice` dep, which decides what it does to the scene.\n * `<SceneCanvas>` publishes one that cuts every path the cut crosses. The pending cut paints through\n * `Tool.overlay`, trailing to the pointer when the host publishes one.\n */\nexport function useSliceTool(options: UseSliceToolOptions = {}): Tool<null> {\n const scratchRef = useRef<SliceScratch>({ points: [] });\n const optsRef = useLatest({ closeHitRadius: options.closeHitRadius ?? 8 });\n\n // What the overlay layer's `subscribe` hears: a change to the points, and,\n // while any are placed, every move of the pointer the rubber band follows.\n const live = useMemo(() => {\n const listeners = new Set<() => void>();\n let pointer: PointerContextValue | null = null;\n let offPointer: (() => void) | null = null;\n const notify = (): void => { for (const fn of [...listeners]) fn(); };\n return {\n notify,\n listen(fn: () => void): () => void {\n listeners.add(fn);\n return () => { listeners.delete(fn); };\n },\n pointer: () => pointer,\n follow(next: PointerContextValue | undefined): void {\n if (!next || next === pointer) return;\n offPointer?.();\n pointer = next;\n offPointer = next.subscribe(notify);\n },\n unfollow(): void {\n offPointer?.();\n offPointer = null;\n pointer = null;\n },\n };\n }, []);\n\n const actions = useMemo<Action[]>(() => {\n const points = () => scratchRef.current.points;\n const pending = () => (points().length > 0 ? true : ActionDisabledReason.NotApplicable);\n\n const reset = (): void => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n };\n const commit = (deps: ActionDeps): void => {\n const cut = points().slice();\n reset();\n if (cut.length >= 2) deps.slice?.commit(cut);\n };\n const place = (deps: ActionDeps, x: number, y: number): void => {\n const pts = points();\n const first = pts[0];\n const scale = deps.view?.get().scale ?? { x: 1, y: 1 };\n if (pts.length >= 3 && withinPxRadius(x - first.x, y - first.y, optsRef.current.closeHitRadius, scale)) {\n pts.push({ x: first.x, y: first.y });\n commit(deps);\n return;\n }\n pts.push({ x, y });\n live.follow(deps.pointer);\n live.notify();\n };\n\n const eligible = { capability: 'edits-page' } as const;\n return [\n sliceAction,\n {\n id: 'slice.addPoint',\n label: 'Slice — place point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: (deps) => (deps?.['slice'] ? true : ActionDisabledReason.NotApplicable),\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const p = params as { pressX?: number; pressY?: number } | undefined;\n if (p?.pressX === undefined || p.pressY === undefined) return;\n place(deps, p.pressX, p.pressY);\n },\n },\n },\n {\n id: 'slice.dragPoint',\n label: 'Slice — drag out a point',\n eligible,\n requires: ['slice', 'view', 'pointer'],\n enabled: pending,\n invoker: {\n timing: 'ongoing',\n start: () => ({\n onMove: () => {},\n onEnd: (endCtx: InvocationCtx, reason: 'commit' | 'cancel') => {\n if (reason === 'cancel' || points().length === 0) return;\n const at = endCtx.drag?.current ?? endCtx.world;\n place(endCtx.deps, at.x, at.y);\n },\n }),\n },\n },\n {\n id: 'slice.finish',\n label: 'Slice — cut along the points',\n eligible,\n requires: ['slice'],\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n // A double click arrives after both of its clicks, so the second\n // has already placed a point on top of the first.\n if ((params as { viaDoubleClick?: boolean } | undefined)?.viaDoubleClick) points().pop();\n commit(deps);\n },\n },\n },\n {\n id: 'slice.dropPoint',\n label: 'Slice — take back the last point',\n eligible,\n enabled: pending,\n invoker: {\n timing: 'immediate',\n run: () => {\n points().pop();\n if (points().length === 0) reset();\n else live.notify();\n },\n },\n },\n {\n id: 'slice.cancel',\n label: 'Slice — discard the points',\n eligible,\n // Declining with nothing placed leaves Escape to the ambient `escape`.\n enabled: pending,\n invoker: { timing: 'immediate', run: () => reset() },\n },\n ];\n }, [live, optsRef]);\n\n const overlay = useMemo<RenderLayer<unknown>>(() => ({\n id: 'slice-pending-cut',\n label: 'Slice — pending cut',\n space: 'screen',\n subscribe: live.listen,\n draw: (_data, view) => {\n const pts = scratchRef.current.points;\n if (pts.length === 0) return [];\n const t = viewToTransform(view);\n const toScreen = (p: { x: number; y: number }) => {\n const [x, y] = worldToScreen(p.x, p.y, t);\n return { x, y };\n };\n const run = pts.map(toScreen);\n const at = live.pointer()?.get();\n if (at) run.push(toScreen({ x: at.worldX, y: at.worldY }));\n const stroke = OVERLAY_ROLE_STROKES['cut'];\n const out: DrawCommand[] = [];\n if (run.length >= 2) out.push({ kind: 'path', path: polylineFromPoints(run), stroke });\n for (const p of pts.map(toScreen)) {\n out.push({\n kind: 'path',\n path: ellipsePath({\n x: p.x - VERTEX_RADIUS_PX,\n y: p.y - VERTEX_RADIUS_PX,\n width: VERTEX_RADIUS_PX * 2,\n height: VERTEX_RADIUS_PX * 2,\n }),\n fill: stroke.paint,\n });\n }\n return out;\n },\n }), [live]);\n\n const { keybinding } = options;\n return useMemo(() => defineTool<null>({\n id: 'slice',\n capabilities: ['edits-page'],\n hookName: 'useSliceTool',\n cursor: 'crosshair',\n presentation: { label: 'Slice', group: 'shape' },\n ...(keybinding === null ? {} : { keybinding: keybinding ?? { key: 'K' } }),\n actions,\n overlay,\n onDeactivate: () => {\n scratchRef.current.points = [];\n live.unfollow();\n live.notify();\n },\n bindings: [\n { spec: { kind: 'click', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.addPoint' },\n {\n spec: { kind: 'doubleClick', mods: { shift: 'optional', alt: 'optional' } },\n actionId: 'slice.finish',\n opts: { params: { viaDoubleClick: true } },\n },\n // Ahead of the cutting drags: it declines unless points are placed.\n { spec: { kind: 'drag', mods: { shift: 'optional', alt: 'optional' } }, actionId: 'slice.dragPoint' },\n { spec: { kind: 'drag' }, actionId: 'slice' },\n { spec: { kind: 'drag', mods: { alt: true } }, actionId: 'slice', opts: { params: { cut: 'freehand' } } },\n { spec: { kind: 'key', key: 'Enter' }, actionId: 'slice.finish' },\n { spec: { kind: 'key', key: 'Escape' }, actionId: 'slice.cancel' },\n { spec: { kind: 'key', key: 'Backspace' }, actionId: 'slice.dropPoint' },\n ],\n }), [actions, overlay, keybinding, live]);\n}\n"],"mappings":";;;;;;;;;;;AA8BA,IAAMA,IAAmB;AAczB,SAAgBC,EAAa,IAA+B,CAAC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+
"version": "1.9.0",
|
|
4
4
|
"description": "Domain-agnostic 2D scene graph primitives for React: viewport math, drag/resize/insert/clone interactions, layered canvas rendering.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "orochi235",
|
|
@@ -85,22 +85,23 @@
|
|
|
85
85
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@weasel-js/font": "1.
|
|
88
|
+
"@weasel-js/font": "1.9.0",
|
|
89
89
|
"react": ">=18"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@msb235/blits": "0.
|
|
93
|
-
"@weasel-js/cursor": "1.
|
|
94
|
-
"@weasel-js/geom": "1.
|
|
95
|
-
"@weasel-js/gestures": "1.
|
|
96
|
-
"@weasel-js/history": "1.
|
|
97
|
-
"@weasel-js/modes": "1.
|
|
98
|
-
"@weasel-js/quantity": "1.
|
|
99
|
-
"@weasel-js/paint": "1.
|
|
100
|
-
"@weasel-js/react": "1.
|
|
101
|
-
"@weasel-js/registry": "1.
|
|
102
|
-
"@weasel-js/routing": "1.
|
|
103
|
-
"@weasel-js/
|
|
92
|
+
"@msb235/blits": "0.6.0",
|
|
93
|
+
"@weasel-js/cursor": "1.9.0",
|
|
94
|
+
"@weasel-js/geom": "1.9.0",
|
|
95
|
+
"@weasel-js/gestures": "1.9.0",
|
|
96
|
+
"@weasel-js/history": "1.9.0",
|
|
97
|
+
"@weasel-js/modes": "1.9.0",
|
|
98
|
+
"@weasel-js/quantity": "1.9.0",
|
|
99
|
+
"@weasel-js/paint": "1.9.0",
|
|
100
|
+
"@weasel-js/react": "1.9.0",
|
|
101
|
+
"@weasel-js/registry": "1.9.0",
|
|
102
|
+
"@weasel-js/routing": "1.9.0",
|
|
103
|
+
"@weasel-js/select": "1.9.0",
|
|
104
|
+
"@weasel-js/text": "1.9.0",
|
|
104
105
|
"earcut": "3.2.3",
|
|
105
106
|
"polygon-clipping": "^0.15.7"
|
|
106
107
|
},
|
|
@@ -118,7 +119,7 @@
|
|
|
118
119
|
"2d"
|
|
119
120
|
],
|
|
120
121
|
"devDependencies": {
|
|
121
|
-
"@weasel-js/modes": "1.
|
|
122
|
-
"@weasel-js/theme": "1.
|
|
122
|
+
"@weasel-js/modes": "1.9.0",
|
|
123
|
+
"@weasel-js/theme": "1.9.0"
|
|
123
124
|
}
|
|
124
125
|
}
|