@weasel-js/core 1.12.0 → 1.13.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 +199 -0
- package/dist/animation/poseTarget.js +46 -15
- package/dist/animation/poseTarget.js.map +1 -1
- package/dist/animation/poseTransition.js +3 -3
- package/dist/animation/poseTransition.js.map +1 -1
- package/dist/animation/reflow.js +3 -6
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rig/bindRig.js +2 -2
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/skinBinding.js +2 -2
- package/dist/animation/rig/skinBinding.js.map +1 -1
- package/dist/barrel/canvas.js +5 -3
- package/dist/barrel/chrome.js +3 -1
- package/dist/barrel/paths.js +3 -2
- package/dist/barrel/routing.js +2 -2
- package/dist/barrel/scene.js +6 -1
- package/dist/barrel/text.js +2 -2
- package/dist/canvas/NodeShape.js +1 -0
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js +2 -0
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js.map +1 -1
- package/dist/canvas/SceneCanvas/canvasPassThrough.js +1 -1
- package/dist/canvas/SceneCanvas/canvasPassThrough.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +2 -2
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +20 -2
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasTools.js +3 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useContributionRoles.js +2 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +25 -19
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +7 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useScenePicking.js +31 -6
- package/dist/canvas/SceneCanvas/useScenePicking.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +4 -5
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js +5 -3
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +19 -2
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/accentColor.js +26 -3
- package/dist/canvas/accentColor.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +1 -1
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +14 -20
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +6 -2
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/copiesAbove.js +1 -1
- package/dist/canvas/copiesAbove.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +10 -7
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +5 -2
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/booleans.js +1 -1
- package/dist/canvas/deps/booleans.js.map +1 -1
- package/dist/canvas/deps/enteredGroup.js +81 -0
- package/dist/canvas/deps/enteredGroup.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +27 -15
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +4 -36
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/insertSite.js +39 -0
- package/dist/canvas/deps/insertSite.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +6 -3
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/pathLeaf.js +1 -1
- package/dist/canvas/deps/pathLeaf.js.map +1 -1
- package/dist/canvas/deps/slice.js +2 -1
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/derivedPath.js +14 -6
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/doubleClickTarget.js +9 -11
- package/dist/canvas/doubleClickTarget.js.map +1 -1
- package/dist/canvas/drawnBounds.js +16 -7
- package/dist/canvas/drawnBounds.js.map +1 -1
- package/dist/canvas/inheritedPaints.js +22 -11
- package/dist/canvas/inheritedPaints.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +1 -7
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +2 -3
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +2 -3
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/ownClip.js +24 -0
- package/dist/canvas/ownClip.js.map +1 -0
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/pickIndex/nodeBroadBox.js +86 -0
- package/dist/canvas/pickIndex/nodeBroadBox.js.map +1 -0
- package/dist/canvas/pickIndex/scenePickIndex.js +208 -0
- package/dist/canvas/pickIndex/scenePickIndex.js.map +1 -0
- package/dist/canvas/pickWalk.js +14 -90
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/poseCascade.js +1 -1
- package/dist/canvas/poseCascade.js.map +1 -1
- package/dist/canvas/publishPreviews.js +97 -0
- package/dist/canvas/publishPreviews.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +7 -5
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +17 -10
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/scenePickReads.js +37 -0
- package/dist/canvas/scenePickReads.js.map +1 -0
- package/dist/canvas/scenePickSource.js +74 -0
- package/dist/canvas/scenePickSource.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +9 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +13 -8
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/shownNodes.js +15 -0
- package/dist/canvas/shownNodes.js.map +1 -0
- package/dist/canvas/useCanvasPaint.js +3 -1
- package/dist/canvas/useCanvasPaint.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +5 -3
- package/dist/canvas/useSceneAdapter.js.map +1 -1
- package/dist/clipboard.d.ts +2 -2
- package/dist/{clone-C3e0OTuF.d.ts → clone-qb2e1F5p.d.ts} +2 -2
- package/dist/clone.d.ts +3 -3
- package/dist/core/isPlainObject.js +2 -2
- package/dist/core/layers/layerGroup.js.map +1 -1
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +1 -1
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/clipNothing.js +2 -5
- package/dist/core/scene/clipNothing.js.map +1 -1
- package/dist/core/scene/declaredFieldSetters.js +44 -0
- package/dist/core/scene/declaredFieldSetters.js.map +1 -0
- package/dist/core/scene/depMemo.js +3 -0
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/dependents.js +3 -1
- package/dist/core/scene/dependents.js.map +1 -1
- package/dist/core/scene/documentOf.js +43 -0
- package/dist/core/scene/documentOf.js.map +1 -0
- package/dist/core/scene/effectivePose.js +37 -13
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +17 -14
- package/dist/core/scene/fieldEdits.js.map +1 -1
- package/dist/core/scene/historyForm.js +4 -4
- package/dist/core/scene/historyForm.js.map +1 -1
- package/dist/core/scene/inheritedPaint.js +27 -5
- package/dist/core/scene/inheritedPaint.js.map +1 -1
- package/dist/core/scene/kitOps.js +3 -23
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/layoutPass.js +1 -2
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/nodeAsShown.js +72 -0
- package/dist/core/scene/nodeAsShown.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +2 -10
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +6 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +2 -4
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/pathEffects/derive.js +3 -2
- package/dist/core/scene/pathEffects/derive.js.map +1 -1
- package/dist/core/scene/pathEffects/foundHidden.js +35 -0
- package/dist/core/scene/pathEffects/foundHidden.js.map +1 -0
- package/dist/core/scene/plyStacks.js +89 -0
- package/dist/core/scene/plyStacks.js.map +1 -0
- package/dist/core/scene/poseHold.js +42 -24
- package/dist/core/scene/poseHold.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +35 -38
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/posePlies.js +59 -0
- package/dist/core/scene/posePlies.js.map +1 -0
- package/dist/core/scene/reconcileSpecs.js +6 -15
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/renderOrder.js +10 -4
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/sameValue.js +17 -0
- package/dist/core/scene/sameValue.js.map +1 -0
- package/dist/core/scene/scene.js +3 -3
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +8 -0
- package/dist/core/scene/sceneEdits.js.map +1 -1
- package/dist/core/scene/sceneState.js +1 -2
- package/dist/core/scene/sceneState.js.map +1 -1
- package/dist/core/scene/serialization.js +45 -9
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +5 -2
- package/dist/core/scene/staleReplay.js.map +1 -1
- package/dist/core/scene/statedFields.js +4 -2
- package/dist/core/scene/statedFields.js.map +1 -1
- package/dist/core/scene/treeEdits.js +2 -4
- package/dist/core/scene/treeEdits.js.map +1 -1
- package/dist/core/scene/treeOrder.js +3 -1
- package/dist/core/scene/treeOrder.js.map +1 -1
- package/dist/core/scene/treeReads.js +1 -2
- package/dist/core/scene/treeReads.js.map +1 -1
- package/dist/core/scene/treeShape.js +13 -0
- package/dist/core/scene/treeShape.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/scene/useScene.js +1 -1
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/{cornerHandles-p8fDIAKt.d.ts → cornerHandles-CNCb7aTY.d.ts} +1 -1
- package/dist/{depSchema-mG19aEdD.d.ts → depSchema-CpIQzKWQ.d.ts} +38 -59
- package/dist/devtools/handlers.js +1 -1
- package/dist/devtools/handlers.js.map +1 -1
- package/dist/devtools/protocol.js.map +1 -1
- package/dist/devtools-protocol.d.ts +4 -3
- package/dist/devtools.d.ts +3 -2
- package/dist/features/measure/measureHit.js +5 -3
- package/dist/features/measure/measureHit.js.map +1 -1
- package/dist/features/measure/measurement.js +1 -1
- package/dist/features/measure/measurement.js.map +1 -1
- package/dist/features/modes/modeLayers.js +14 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/modes/modeTriggers.js +3 -3
- package/dist/features/modes/modeTriggers.js.map +1 -1
- package/dist/features/pathEffects/effectSources.js +25 -16
- package/dist/features/pathEffects/effectSources.js.map +1 -1
- package/dist/features/pathEffects/readSource.js +1 -1
- package/dist/features/pathEffects/readSource.js.map +1 -1
- package/dist/features/pathEffects/useEffectSourcesLayer.js +15 -19
- package/dist/features/pathEffects/useEffectSourcesLayer.js.map +1 -1
- package/dist/features/paths/editablePath.js +1 -1
- package/dist/features/paths/editablePath.js.map +1 -1
- package/dist/features/paths/pathSnap/sceneIndex.js +1 -1
- package/dist/features/paths/pathSnap/sceneIndex.js.map +1 -1
- package/dist/features/selection/enteredGroupFrame.js +65 -0
- package/dist/features/selection/enteredGroupFrame.js.map +1 -0
- package/dist/features/selection/enteredGroupScope.js +44 -0
- package/dist/features/selection/enteredGroupScope.js.map +1 -0
- package/dist/features/text/sceneTextDrafts.js +26 -27
- package/dist/features/text/sceneTextDrafts.js.map +1 -1
- package/dist/features/text/textHitAt.js +4 -2
- package/dist/features/text/textHitAt.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +3 -3
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +2 -1
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +230 -77
- package/dist/index.js +16 -6
- package/dist/interactions/actions/admitsChild.js +11 -0
- package/dist/interactions/actions/admitsChild.js.map +1 -0
- package/dist/interactions/actions/defaults/contextMenu.js +16 -3
- package/dist/interactions/actions/defaults/contextMenu.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js +4 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/enterGroup.js +88 -0
- package/dist/interactions/actions/defaults/enterGroup.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +7 -7
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/selectAll.js +7 -3
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -1
- package/dist/interactions/actions/defaults/selectDeep.js +35 -0
- package/dist/interactions/actions/defaults/selectDeep.js.map +1 -0
- package/dist/interactions/actions/drawnBoxes.js +2 -1
- package/dist/interactions/actions/drawnBoxes.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +1 -0
- package/dist/interactions/actions/insert/action.js.map +1 -1
- package/dist/interactions/actions/insert/parent.js +7 -5
- package/dist/interactions/actions/insert/parent.js.map +1 -1
- package/dist/interactions/actions/insert/placeAction.js +3 -2
- package/dist/interactions/actions/insert/placeAction.js.map +1 -1
- package/dist/interactions/actions/insert/session.js +2 -2
- package/dist/interactions/actions/insert/session.js.map +1 -1
- package/dist/interactions/actions/move/commit/reparent.js +1 -1
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +6 -7
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/layout/exits.js +1 -1
- package/dist/interactions/actions/move/layout/exits.js.map +1 -1
- package/dist/interactions/actions/move/session.js +4 -4
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/pathCommands/pathNodes.js +14 -5
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +14 -2
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/{math-B56zxVs5.d.ts → math-C_elShP_.d.ts} +2 -5
- package/dist/math.d.ts +1 -1
- package/dist/move.d.ts +4 -4
- package/dist/{options-DBxEryYq.d.ts → options-ClEm3SEl.d.ts} +1 -1
- package/dist/resize.d.ts +4 -4
- package/dist/test-seams.d.ts +6 -6
- package/dist/tools/builtin/pressTarget.js +22 -0
- package/dist/tools/builtin/pressTarget.js.map +1 -0
- package/dist/tools/builtin/select/adapterPointQuery.js +3 -3
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
- package/dist/tools/builtin/select/collapseDeferred.js +40 -0
- package/dist/tools/builtin/select/collapseDeferred.js.map +1 -0
- package/dist/tools/builtin/select/groupEntry.js +82 -0
- package/dist/tools/builtin/select/groupEntry.js.map +1 -0
- package/dist/tools/builtin/select/pressDecision.js +1 -1
- package/dist/tools/builtin/select/pressDecision.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +61 -45
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/{types-7puAuVD2.d.ts → types-49uYJN3j.d.ts} +1 -1
- package/dist/{types-CniVctmk.d.ts → types-BEdRIhNc.d.ts} +272 -109
- package/dist/{types-oFeQ5VjV.d.ts → types-p2alu-R1.d.ts} +1 -1
- package/dist/version.js +1 -1
- package/package.json +25 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../../../src/interactions/actions/defaults/group.ts"],"sourcesContent":["import type { Node, NodeId } from 'core/scene/types';\nimport type { Op } from 'core/ops/types';\nimport { createInsertOp } from 'core/ops/create';\nimport { createReparentOp } from 'core/ops/reparent';\nimport { unionBounds } from 'core/geometry/unionBounds';\nimport { unionOfChildren, UNION_OF_CHILDREN } from 'core/scene/kitRegistry';\nimport { poseDescriptorOf } from '../poseDescriptorDep';\nimport { visualBoundsViaDescriptor } from '../resize/geometry';\nimport { createTransformOp } from 'core/ops/transform';\nimport { ActionDisabledReason, type Action } from '@weasel-js/routing';\nimport { requiresSelection } from './requiresSelection';\nimport { scenePoseFrame } from '../poseFrame';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\nimport { icon } from '../../../icons.gen';\n\n/**\n * Creates a structural `ContainerNode` and reparents the current selection\n * under it as a single undoable batch.\n *\n * Grouping never moves a member on screen. The container takes the world\n * envelope of its members' ink; each member is then re-expressed in that\n * container's frame, which is a no-op only when the scene composes poses by\n * identity.\n *\n * Under identity the container's pose is also *derived* from its members, so\n * it tracks one that moves later. Under any other composition that derivation\n * is circular — the members' poses are expressed in the container's own\n * frame — so the container keeps the authored envelope instead.\n */\nexport const groupAction: Action & { requires: string[] } = {\n id: 'group',\n label: 'Group',\n icon: icon('group'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true } }, opts: { id: 'group.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'selection', 'applyOps', 'poseDescriptor'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const selection = deps.selection;\n const scene = deps.scene;\n const applyOps = deps.applyOps;\n if (!selection || !scene) return;\n\n const ids = selection.get();\n if (ids.length === 0) return;\n\n const nodes = ids\n .map((id) => scene.get(id as NodeId))\n .filter((n): n is NonNullable<typeof n> => n !== undefined);\n if (nodes.length === 0) return;\n\n // Members must share a layer — containers live on a single layer.\n const layers = new Set(nodes.map((n) => n.layer));\n if (layers.size > 1) return;\n const layer = nodes[0]!.layer;\n\n // Nest under the shared parent if the members agree, else at the root.\n const parents = new Set(nodes.map((n) => n.parent));\n const parent = parents.size === 1 ? nodes[0]!.parent : null;\n\n // Under identity the authored pose is only the fallback (an emptied\n // group, a lost registry key); the derived union is what the scene shows.\n const d = poseDescriptorOf(deps.poseDescriptor);\n const frame = scenePoseFrame(scene);\n const worlds = new Map<NodeId, unknown>();\n for (const node of nodes) worlds.set(node.id, frame.world(node.id));\n // Visual, not stored, bounds: a turned member's ink reaches outside its\n // own box, and the container has to cover what is drawn.\n const union = unionBounds([...worlds.values()].map((p) => visualBoundsViaDescriptor(p, d)));\n const containerWorldPose = union === null\n ? nodes[0]!.pose\n : d.fromBounds(union, nodes[0]!.pose);\n const pose = frame.localUnder(parent, containerWorldPose);\n const absolutePoses = frame.pc.closure === 'identity';\n const derive = scene.registry.derivePose?.[UNION_OF_CHILDREN] ?? unionOfChildren;\n\n // The container must exist before any child reparents into it, so the\n // insert op is emitted first.\n const containerId = scene.mintId();\n const ops: Op[] = [\n createInsertOp<Node<unknown, string, unknown>>({\n node: {\n id: containerId,\n kind: 'container',\n layer,\n pose: pose as unknown,\n data: {} as unknown,\n parent: parent ?? null,\n ...(absolutePoses ? { dependsOn: 'children', derivePose: derive } : {}),\n } as Node<unknown, string, unknown>,\n label: 'Group',\n }),\n ];\n for (const node of nodes) {\n ops.push(createReparentOp({\n id: node.id as string,\n fromParentId: (node.parent ?? null) as string | null,\n toParentId: containerId as string,\n label: 'Group',\n }));\n if (absolutePoses) continue;\n ops.push(createTransformOp<unknown>({\n id: node.id as string,\n from: node.pose,\n to: frame.pc.decompose(containerWorldPose, worlds.get(node.id)!),\n label: 'Group',\n }));\n }\n\n if (applyOps) applyOps(ops, 'Group');\n else scene.applyBatch(ops, 'Group', defaultCommitAdapter(scene, selection.adapterMethods));\n\n selection.set([containerId]);\n },\n },\n enabled: requiresSelection,\n};\n\n/**\n * Dissolves each selected container by reparenting its children up to the\n * container's own parent (preserving z-order) and removing the now-empty\n * container, as a single undoable batch. Selected non-container nodes are\n * ignored. The freed children become the new selection, and nothing moves on\n * screen.\n */\nexport const ungroupAction: Action & { requires: string[] } = {\n id: 'ungroup',\n label: 'Ungroup',\n icon: icon('ungroup'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true, shift: true } }, opts: { id: 'ungroup.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'selection'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const selection = deps.selection;\n const scene = deps.scene;\n if (!selection || !scene) return;\n\n const ids = selection.get();\n if (ids.length === 0) return;\n\n const containers = ids.filter((id) => scene.get(id as NodeId)?.kind === 'container');\n if (containers.length === 0) return;\n\n const frame = scenePoseFrame(scene);\n const absolutePoses = frame.pc.closure === 'identity';\n\n scene.batch('Ungroup', () => {\n const freed: NodeId[] = [];\n for (const containerId of containers) {\n const container = scene.get(containerId as NodeId);\n if (!container || container.kind !== 'container') continue;\n\n const parent = container.parent ?? null;\n const baseIndex =\n parent === null\n ? scene.roots.indexOf(containerId as NodeId)\n : scene.childrenOf(parent).indexOf(containerId as NodeId);\n\n const children = [...scene.childrenOf(containerId as NodeId)];\n // Read every world pose before the first move: the frame resolves\n // through the live scene, and the container is about to leave it.\n const worlds = new Map<NodeId, unknown>();\n if (!absolutePoses) {\n for (const childId of children) worlds.set(childId, frame.world(childId));\n }\n children.forEach((childId, i) => {\n scene.move(childId, parent, baseIndex < 0 ? undefined : baseIndex + i);\n if (!absolutePoses) {\n scene.setPose(childId, frame.localUnder(parent, worlds.get(childId)!) as never);\n }\n freed.push(childId);\n });\n\n scene.remove(containerId as NodeId);\n }\n selection.set(freed);\n });\n },\n },\n enabled: (deps) => {\n const selection = deps?.selection;\n const scene = deps?.scene;\n const any = selection?.get().some((id) => scene?.get(id as NodeId)?.kind === 'container');\n return any ? true : ActionDisabledReason.NotApplicable;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+C;AAC1D,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAC;AAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA;AAAK,CAAA,CAAA,CAAA,CA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CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;AAEpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CADY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAI,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAI,CAAA,CAAY,CAAC,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAC3E,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAC3C,CAAA;AACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../../../src/interactions/actions/defaults/group.ts"],"sourcesContent":["import type { Node, NodeId } from 'core/scene/types';\nimport type { Op } from 'core/ops/types';\nimport { createInsertOp } from 'core/ops/create';\nimport { createReparentOp } from 'core/ops/reparent';\nimport { unionBounds } from 'core/geometry/unionBounds';\nimport { unionOfChildren, UNION_OF_CHILDREN } from 'core/scene/kitRegistry';\nimport { poseDescriptorOf } from '../poseDescriptorDep';\nimport { visualBoundsViaDescriptor } from '../resize/geometry';\nimport { createTransformOp } from 'core/ops/transform';\nimport { ActionDisabledReason, type Action } from '@weasel-js/routing';\nimport { requiresSelection } from './requiresSelection';\nimport { scenePoseFrame } from '../poseFrame';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\nimport { icon } from '../../../icons.gen';\n\n/**\n * Creates a structural `GroupNode` and reparents the current selection\n * under it as a single undoable batch.\n *\n * Grouping never moves a member on screen. The container takes the world\n * envelope of its members' ink; each member is then re-expressed in that\n * container's frame, which is a no-op only when the scene composes poses by\n * identity.\n *\n * Under identity the container's pose is also *derived* from its members, so\n * it tracks one that moves later. Under any other composition that derivation\n * is circular — the members' poses are expressed in the container's own\n * frame — so the container keeps the authored envelope instead.\n */\nexport const groupAction: Action & { requires: string[] } = {\n id: 'group',\n label: 'Group',\n icon: icon('group'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true } }, opts: { id: 'group.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'selection', 'applyOps', 'poseDescriptor'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const selection = deps.selection;\n const scene = deps.scene;\n const applyOps = deps.applyOps;\n if (!selection || !scene) return;\n\n const ids = selection.get();\n if (ids.length === 0) return;\n\n const nodes = ids\n .map((id) => scene.get(id as NodeId))\n .filter((n): n is NonNullable<typeof n> => n !== undefined);\n if (nodes.length === 0) return;\n\n // Members must share a layer — containers live on a single layer.\n const layers = new Set(nodes.map((n) => n.layer));\n if (layers.size > 1) return;\n const layer = nodes[0]!.layer;\n\n // Nest under the shared parent if the members agree, else at the root.\n const parents = new Set(nodes.map((n) => n.parent));\n const parent = parents.size === 1 ? nodes[0]!.parent : null;\n\n // Under identity the authored pose is only the fallback (an emptied\n // group, a lost registry key); the derived union is what the scene shows.\n const d = poseDescriptorOf(deps.poseDescriptor);\n const frame = scenePoseFrame(scene);\n const worlds = new Map<NodeId, unknown>();\n for (const node of nodes) worlds.set(node.id, frame.world(node.id));\n // Visual, not stored, bounds: a turned member's ink reaches outside its\n // own box, and the container has to cover what is drawn.\n const union = unionBounds([...worlds.values()].map((p) => visualBoundsViaDescriptor(p, d)));\n const containerWorldPose = union === null\n ? nodes[0]!.pose\n : d.fromBounds(union, nodes[0]!.pose);\n const pose = frame.localUnder(parent, containerWorldPose);\n const absolutePoses = frame.pc.closure === 'identity';\n const derive = scene.registry.derivePose?.[UNION_OF_CHILDREN] ?? unionOfChildren;\n\n // The container must exist before any child reparents into it, so the\n // insert op is emitted first.\n const containerId = scene.mintId();\n const ops: Op[] = [\n createInsertOp<Node<unknown, string, unknown>>({\n node: {\n id: containerId,\n kind: 'group',\n layer,\n pose: pose as unknown,\n data: {} as unknown,\n parent: parent ?? null,\n ...(absolutePoses ? { dependsOn: 'children', derivePose: derive } : {}),\n } as Node<unknown, string, unknown>,\n label: 'Group',\n }),\n ];\n for (const node of nodes) {\n ops.push(createReparentOp({\n id: node.id as string,\n fromParentId: (node.parent ?? null) as string | null,\n toParentId: containerId as string,\n label: 'Group',\n }));\n if (absolutePoses) continue;\n ops.push(createTransformOp<unknown>({\n id: node.id as string,\n from: node.pose,\n to: frame.pc.decompose(containerWorldPose, worlds.get(node.id)!),\n label: 'Group',\n }));\n }\n\n if (applyOps) applyOps(ops, 'Group');\n else scene.applyBatch(ops, 'Group', defaultCommitAdapter(scene, selection.adapterMethods));\n\n selection.set([containerId]);\n },\n },\n enabled: requiresSelection,\n};\n\n/**\n * Dissolves each selected group by reparenting its children up to the\n * container's own parent (preserving z-order) and removing the now-empty\n * container, as a single undoable batch. Selected marks, children or not, are\n * ignored. The freed children become the new selection, and nothing moves on\n * screen.\n */\nexport const ungroupAction: Action & { requires: string[] } = {\n id: 'ungroup',\n label: 'Ungroup',\n icon: icon('ungroup'),\n group: 'structure',\n defaultBinding: [{ spec: { kind: 'key', key: 'g', mods: { mod: true, shift: true } }, opts: { id: 'ungroup.key' } }],\n eligible: { capability: 'edits-page' },\n requires: ['scene', 'selection'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const selection = deps.selection;\n const scene = deps.scene;\n if (!selection || !scene) return;\n\n const ids = selection.get();\n if (ids.length === 0) return;\n\n const containers = ids.filter((id) => scene.get(id as NodeId)?.kind === 'group');\n if (containers.length === 0) return;\n\n const frame = scenePoseFrame(scene);\n const absolutePoses = frame.pc.closure === 'identity';\n\n scene.batch('Ungroup', () => {\n const freed: NodeId[] = [];\n for (const containerId of containers) {\n const container = scene.get(containerId as NodeId);\n if (!container || container.kind !== 'group') continue;\n\n const parent = container.parent ?? null;\n const baseIndex =\n parent === null\n ? scene.roots.indexOf(containerId as NodeId)\n : scene.childrenOf(parent).indexOf(containerId as NodeId);\n\n const children = [...scene.childrenOf(containerId as NodeId)];\n // Read every world pose before the first move: the frame resolves\n // through the live scene, and the container is about to leave it.\n const worlds = new Map<NodeId, unknown>();\n if (!absolutePoses) {\n for (const childId of children) worlds.set(childId, frame.world(childId));\n }\n children.forEach((childId, i) => {\n scene.move(childId, parent, baseIndex < 0 ? undefined : baseIndex + i);\n if (!absolutePoses) {\n scene.setPose(childId, frame.localUnder(parent, worlds.get(childId)!) as never);\n }\n freed.push(childId);\n });\n\n scene.remove(containerId as NodeId);\n }\n selection.set(freed);\n });\n },\n },\n enabled: (deps) => {\n const selection = deps?.selection;\n const scene = deps?.scene;\n const any = selection?.get().some((id) => scene?.get(id as NodeId)?.kind === 'group');\n return any ? true : ActionDisabledReason.NotApplicable;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+C;AAC1D,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAM,CAAA,CAAA,CAAA,CAAA,CAA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C3C,CAAA;AACF,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { isAnnotationLayer } from "../../../core/scene/annotation.js";
|
|
2
2
|
import { nodeGates } from "../../../core/scene/nodeGates.js";
|
|
3
|
+
import { reachableInGroup } from "../../../canvas/deps/enteredGroup.js";
|
|
3
4
|
|
|
4
5
|
//#region src/interactions/actions/defaults/selectAll.ts
|
|
5
6
|
/**
|
|
6
7
|
* Static descriptor for the `selectAll` Action. Selects every scene node the
|
|
7
8
|
* user can see and reach — hidden and locked nodes (`nodeGates`), and nodes on
|
|
8
9
|
* a layer the asking view does not paint, are left out, so Cmd+A then Delete cannot
|
|
9
|
-
* take content that is off screen or locked.
|
|
10
|
+
* take content that is off screen or locked. Inside an entered group it selects only what the
|
|
11
|
+
* group holds.
|
|
10
12
|
*/
|
|
11
13
|
var selectAllAction = {
|
|
12
14
|
id: "selectAll",
|
|
@@ -23,7 +25,8 @@ var selectAllAction = {
|
|
|
23
25
|
requires: [
|
|
24
26
|
"scene",
|
|
25
27
|
"selection",
|
|
26
|
-
"view"
|
|
28
|
+
"view",
|
|
29
|
+
"enteredGroup"
|
|
27
30
|
],
|
|
28
31
|
invoker: {
|
|
29
32
|
timing: "immediate",
|
|
@@ -32,7 +35,8 @@ var selectAllAction = {
|
|
|
32
35
|
const view = deps.view;
|
|
33
36
|
if (!scene) return;
|
|
34
37
|
const gates = nodeGates(scene);
|
|
35
|
-
const
|
|
38
|
+
const group = deps.enteredGroup?.get() ?? null;
|
|
39
|
+
const all = scene.renderOrderNodes().filter((n) => reachableInGroup(scene, group, n.id) && !isAnnotationLayer(scene.layers.find((l) => l.id === n.layer)) && view?.layerIsPainted?.(n.layer) !== false && !gates.hidden(n.id) && !gates.locked(n.id)).map((n) => n.id);
|
|
36
40
|
if (all.length === 0) return;
|
|
37
41
|
deps.selection?.set(all);
|
|
38
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectAll.js","names":[],"sources":["../../../../src/interactions/actions/defaults/selectAll.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport type { Action } from '@weasel-js/routing';\nimport { isAnnotationLayer } from 'core/scene/annotation';\nimport { nodeGates } from 'core/scene/nodeGates';\n\n/**\n * Static descriptor for the `selectAll` Action. Selects every scene node the\n * user can see and reach — hidden and locked nodes (`nodeGates`), and nodes on\n * a layer the asking view does not paint, are left out, so Cmd+A then Delete cannot\n * take content that is off screen or locked.\n */\nexport const selectAllAction: Action & { requires: string[] } = {\n id: 'selectAll',\n label: 'Select All',\n defaultBinding: [{ spec: { kind: 'key', key: 'a', mods: { mod: true } }, opts: { id: 'selectAll.key' } }],\n eligible: { capability: 'creates-selection' },\n requires: ['scene', 'selection', 'view'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const scene = deps.scene;\n const view = deps.view;\n if (!scene) return;\n // The node walk carries the layer each id sits on, which `view` gates.\n const gates = nodeGates(scene);\n const all: NodeId[] = scene.renderOrderNodes()\n .filter((n) => !isAnnotationLayer(scene.layers.find((l) => l.id === n.layer))\n && view?.layerIsPainted?.(n.layer) !== false\n && !gates.hidden(n.id)\n && !gates.locked(n.id))\n .map((n) => n.id);\n if (all.length === 0) return;\n deps.selection?.set(all);\n },\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectAll.js","names":[],"sources":["../../../../src/interactions/actions/defaults/selectAll.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport type { Action } from '@weasel-js/routing';\nimport { isAnnotationLayer } from 'core/scene/annotation';\nimport { nodeGates } from 'core/scene/nodeGates';\nimport { reachableInGroup } from 'canvas/deps/enteredGroup';\n\n/**\n * Static descriptor for the `selectAll` Action. Selects every scene node the\n * user can see and reach — hidden and locked nodes (`nodeGates`), and nodes on\n * a layer the asking view does not paint, are left out, so Cmd+A then Delete cannot\n * take content that is off screen or locked. Inside an entered group it selects only what the\n * group holds.\n */\nexport const selectAllAction: Action & { requires: string[] } = {\n id: 'selectAll',\n label: 'Select All',\n defaultBinding: [{ spec: { kind: 'key', key: 'a', mods: { mod: true } }, opts: { id: 'selectAll.key' } }],\n eligible: { capability: 'creates-selection' },\n requires: ['scene', 'selection', 'view', 'enteredGroup'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const scene = deps.scene;\n const view = deps.view;\n if (!scene) return;\n // The node walk carries the layer each id sits on, which `view` gates.\n const gates = nodeGates(scene);\n const group = deps.enteredGroup?.get() ?? null;\n const all: NodeId[] = scene.renderOrderNodes()\n .filter((n) => reachableInGroup(scene, group, n.id)\n && !isAnnotationLayer(scene.layers.find((l) => l.id === n.layer))\n && view?.layerIsPainted?.(n.layer) !== false\n && !gates.hidden(n.id)\n && !gates.locked(n.id))\n .map((n) => n.id);\n if (all.length === 0) return;\n deps.selection?.set(all);\n },\n },\n};\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,kBAAmD;CAC9D,IAAI;CACJ,OAAO;CACP,gBAAgB,CAAC;EAAE,MAAM;GAAE,MAAM;GAAO,KAAK;GAAK,MAAM,EAAE,KAAK,KAAK;EAAE;EAAG,MAAM,EAAE,IAAI,gBAAgB;CAAE,CAAC;CACxG,UAAU,EAAE,YAAY,oBAAoB;CAC5C,UAAU;EAAC;EAAS;EAAa;EAAQ;CAAc;CACvD,SAAS;EACP,QAAQ;EACR,MAAM,SAAS;GACb,MAAM,QAAQ,KAAK;GACnB,MAAM,OAAO,KAAK;GAClB,IAAI,CAAC,OAAO;GAEZ,MAAM,QAAQ,UAAU,KAAK;GAC7B,MAAM,QAAQ,KAAK,cAAc,IAAI,KAAK;GAC1C,MAAM,MAAgB,MAAM,iBAAiB,CAAC,CAC3C,QAAQ,MAAM,iBAAiB,OAAO,OAAO,EAAE,EAAE,KAC7C,CAAC,kBAAkB,MAAM,OAAO,MAAM,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,KAC7D,MAAM,iBAAiB,EAAE,KAAK,MAAM,SACpC,CAAC,MAAM,OAAO,EAAE,EAAE,KAClB,CAAC,MAAM,OAAO,EAAE,EAAE,CAAC,CAAC,CACxB,KAAK,MAAM,EAAE,EAAE;GAClB,IAAI,IAAI,WAAW,GAAG;GACtB,KAAK,WAAW,IAAI,GAAG;EACzB;CACF;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/interactions/actions/defaults/selectDeep.ts
|
|
2
|
+
/**
|
|
3
|
+
* `select.deep` — selects the node under the point itself, not the outermost
|
|
4
|
+
* group above it; with Shift it adds that node. Bound to Cmd-press by
|
|
5
|
+
* `useSelectTool`, ahead of `select.pick`.
|
|
6
|
+
*/
|
|
7
|
+
function createSelectDeepAction(opts) {
|
|
8
|
+
return {
|
|
9
|
+
id: "select.deep",
|
|
10
|
+
label: "Select — pick past groups",
|
|
11
|
+
eligible: { capability: "creates-selection" },
|
|
12
|
+
requires: ["selection"],
|
|
13
|
+
invoker: {
|
|
14
|
+
timing: "immediate",
|
|
15
|
+
run: (deps, params) => {
|
|
16
|
+
const p = params;
|
|
17
|
+
const selection = deps.selection;
|
|
18
|
+
if (!selection || p?.worldX === void 0 || p.worldY === void 0) return;
|
|
19
|
+
const shift = p.mods?.shift === true;
|
|
20
|
+
const hit = opts.pickHit(p.worldX, p.worldY, p.mods?.alt === true, selection.get());
|
|
21
|
+
opts.settled();
|
|
22
|
+
if (hit === null || shift && opts.extendLocked()) return;
|
|
23
|
+
selection.applyClick(hit, {
|
|
24
|
+
ctrl: false,
|
|
25
|
+
meta: false,
|
|
26
|
+
shift
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createSelectDeepAction };
|
|
35
|
+
//# sourceMappingURL=selectDeep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectDeep.js","names":[],"sources":["../../../../src/interactions/actions/defaults/selectDeep.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { NodeId } from 'core/scene/types';\n\ntype Mods = { alt: boolean; ctrl: boolean; meta: boolean; shift: boolean };\n\nexport interface SelectDeepOptions {\n /** The node under the point, past every group. Locked nodes are the\n * picker's to skip, as they are for `select.pick`. */\n pickHit: (worldX: number, worldY: number, alt: boolean, selection: readonly string[]) => string | null;\n /** True when an extend press must leave the selection alone. */\n extendLocked: () => boolean;\n /** Called once the press is handled, so a deferral left by an earlier press cannot fire on release. */\n settled: () => void;\n}\n\n/**\n * `select.deep` — selects the node under the point itself, not the outermost\n * group above it; with Shift it adds that node. Bound to Cmd-press by\n * `useSelectTool`, ahead of `select.pick`.\n */\nexport function createSelectDeepAction(opts: SelectDeepOptions): Action {\n return {\n id: 'select.deep',\n label: 'Select — pick past groups',\n eligible: { capability: 'creates-selection' },\n requires: ['selection'],\n invoker: {\n timing: 'immediate' as const,\n run: (deps, params) => {\n const p = params as { worldX?: number; worldY?: number; mods?: Mods } | undefined;\n const selection = deps.selection;\n if (!selection || p?.worldX === undefined || p.worldY === undefined) return;\n const shift = p.mods?.shift === true;\n const hit = opts.pickHit(p.worldX, p.worldY, p.mods?.alt === true, selection.get());\n opts.settled();\n if (hit === null || (shift && opts.extendLocked())) return;\n selection.applyClick(hit as NodeId, { ctrl: false, meta: false, shift });\n },\n },\n };\n}\n"],"mappings":";;;;;;AAoBA,SAAgB,uBAAuB,MAAiC;CACtE,OAAO;EACL,IAAI;EACJ,OAAO;EACP,UAAU,EAAE,YAAY,oBAAoB;EAC5C,UAAU,CAAC,WAAW;EACtB,SAAS;GACP,QAAQ;GACR,MAAM,MAAM,WAAW;IACrB,MAAM,IAAI;IACV,MAAM,YAAY,KAAK;IACvB,IAAI,CAAC,aAAa,GAAG,WAAW,UAAa,EAAE,WAAW,QAAW;IACrE,MAAM,QAAQ,EAAE,MAAM,UAAU;IAChC,MAAM,MAAM,KAAK,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,MAAM,UAAU,IAAI,CAAC;IAClF,KAAK,QAAQ;IACb,IAAI,QAAQ,QAAS,SAAS,KAAK,aAAa,GAAI;IACpD,UAAU,WAAW,KAAe;KAAE,MAAM;KAAO,MAAM;KAAO;IAAM,CAAC;GACzE;EACF;CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { documentOf } from "../../core/scene/documentOf.js";
|
|
1
2
|
import { axisAlignedBounds } from "../../core/geometry/unionBounds.js";
|
|
2
3
|
import { drawnBoundsOf, inkExtentsOf } from "../../canvas/drawnBounds.js";
|
|
3
4
|
import { drawnBoundsScene } from "../../canvas/derivedPath.js";
|
|
@@ -9,7 +10,7 @@ var NO_SCENE = { get: () => void 0 };
|
|
|
9
10
|
/** The {@link DrawnBoxes} over `deps.scene`. Pass the action's own `frame`
|
|
10
11
|
* when it has one, so container members are read the way it reads them. */
|
|
11
12
|
function drawnBoxes(deps, frame) {
|
|
12
|
-
const scene = deps.scene ? drawnBoundsScene(deps.scene) : NO_SCENE;
|
|
13
|
+
const scene = deps.scene ? drawnBoundsScene(documentOf(deps.scene)) : NO_SCENE;
|
|
13
14
|
const descriptor = poseDescriptorOf(deps.poseDescriptor);
|
|
14
15
|
const view = deps.view?.get();
|
|
15
16
|
let worlds = frame;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawnBoxes.js","names":[],"sources":["../../../src/interactions/actions/drawnBoxes.ts"],"sourcesContent":["import type { ActionDeps } from '@weasel-js/routing';\nimport { drawnBoundsOf, inkExtentsOf, type DrawnBoundsOptions, type DrawnBoundsScene } from 'canvas/drawnBounds';\nimport { drawnBoundsScene } from 'canvas/derivedPath';\nimport type { InkExtents } from 'core/geometry/inkExtents';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\nimport type { NodeId } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { poseDescriptorOf } from './poseDescriptorDep';\nimport { scenePoseFrame, type PoseFrame } from './poseFrame';\n\nconst NO_SCENE: DrawnBoundsScene = { get: () => undefined };\n\n/** `drawnBoundsOf` bound to an action's deps: the box each id is shown with\n * at a world pose, stroke included unless the canvas opted out. */\nexport interface DrawnBoxes {\n /** In the frame the pose is drawn in. */\n framed(id: NodeId | string, pose: unknown): Bounds;\n /** The axis-aligned box a turned node covers. */\n aabb(id: NodeId | string, pose: unknown): Bounds;\n /** How far the ink reaches past the pose box, in the box's own frame. */\n extents(id: NodeId | string, pose: unknown): InkExtents;\n}\n\n/** The {@link DrawnBoxes} over `deps.scene`. Pass the action's own `frame`\n * when it has one, so container members are read the way it reads them. */\nexport function drawnBoxes(\n deps: Pick<ActionDeps, 'scene' | 'poseDescriptor' | 'view' | 'boundsIncludeStroke'>,\n frame?: PoseFrame<unknown>,\n): DrawnBoxes {\n const scene: DrawnBoundsScene = deps.scene ? drawnBoundsScene(deps.scene) : NO_SCENE;\n const descriptor = poseDescriptorOf(deps.poseDescriptor);\n const view = deps.view?.get();\n let worlds = frame;\n const opts: DrawnBoundsOptions = {\n descriptor,\n worldPoseOf: (id) => (worlds ??= scenePoseFrame(deps.scene!)).world(id),\n includeStroke: deps.boundsIncludeStroke ?? true,\n ...(view ? { scale: view.scale } : {}),\n };\n const framed = (id: NodeId | string, pose: unknown): Bounds =>\n drawnBoundsOf(scene, id as NodeId, pose, opts);\n return {\n framed,\n aabb: (id, pose) => axisAlignedBounds(framed(id, pose)),\n extents: (id, pose) => inkExtentsOf(scene, id as NodeId, pose, opts),\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawnBoxes.js","names":[],"sources":["../../../src/interactions/actions/drawnBoxes.ts"],"sourcesContent":["import type { ActionDeps } from '@weasel-js/routing';\nimport { drawnBoundsOf, inkExtentsOf, type DrawnBoundsOptions, type DrawnBoundsScene } from 'canvas/drawnBounds';\nimport { drawnBoundsScene } from 'canvas/derivedPath';\nimport type { InkExtents } from 'core/geometry/inkExtents';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\nimport { documentOf } from 'core/scene/documentOf';\nimport type { NodeId } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { poseDescriptorOf } from './poseDescriptorDep';\nimport { scenePoseFrame, type PoseFrame } from './poseFrame';\n\nconst NO_SCENE: DrawnBoundsScene = { get: () => undefined };\n\n/** `drawnBoundsOf` bound to an action's deps: the box each id is shown with\n * at a world pose, stroke included unless the canvas opted out. */\nexport interface DrawnBoxes {\n /** In the frame the pose is drawn in. */\n framed(id: NodeId | string, pose: unknown): Bounds;\n /** The axis-aligned box a turned node covers. */\n aabb(id: NodeId | string, pose: unknown): Bounds;\n /** How far the ink reaches past the pose box, in the box's own frame. */\n extents(id: NodeId | string, pose: unknown): InkExtents;\n}\n\n/** The {@link DrawnBoxes} over `deps.scene`. Pass the action's own `frame`\n * when it has one, so container members are read the way it reads them. */\nexport function drawnBoxes(\n deps: Pick<ActionDeps, 'scene' | 'poseDescriptor' | 'view' | 'boundsIncludeStroke'>,\n frame?: PoseFrame<unknown>,\n): DrawnBoxes {\n // A command measures what the document holds, not what an open gesture or edit is showing.\n const scene: DrawnBoundsScene = deps.scene ? drawnBoundsScene(documentOf(deps.scene)) : NO_SCENE;\n const descriptor = poseDescriptorOf(deps.poseDescriptor);\n const view = deps.view?.get();\n let worlds = frame;\n const opts: DrawnBoundsOptions = {\n descriptor,\n worldPoseOf: (id) => (worlds ??= scenePoseFrame(deps.scene!)).world(id),\n includeStroke: deps.boundsIncludeStroke ?? true,\n ...(view ? { scale: view.scale } : {}),\n };\n const framed = (id: NodeId | string, pose: unknown): Bounds =>\n drawnBoundsOf(scene, id as NodeId, pose, opts);\n return {\n framed,\n aabb: (id, pose) => axisAlignedBounds(framed(id, pose)),\n extents: (id, pose) => inkExtentsOf(scene, id as NodeId, pose, opts),\n };\n}\n"],"mappings":";;;;;;;;AAWA,IAAM,WAA6B,EAAE,WAAW,OAAU;;;AAe1D,SAAgB,WACd,MACA,OACY;CAEZ,MAAM,QAA0B,KAAK,QAAQ,iBAAiB,WAAW,KAAK,KAAK,CAAC,IAAI;CACxF,MAAM,aAAa,iBAAiB,KAAK,cAAc;CACvD,MAAM,OAAO,KAAK,MAAM,IAAI;CAC5B,IAAI,SAAS;CACb,MAAM,OAA2B;EAC/B;EACA,cAAc,QAAQ,WAAW,eAAe,KAAK,KAAM,EAAA,CAAG,MAAM,EAAE;EACtE,eAAe,KAAK,uBAAuB;EAC3C,GAAI,OAAO,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;CACtC;CACA,MAAM,UAAU,IAAqB,SACnC,cAAc,OAAO,IAAc,MAAM,IAAI;CAC/C,OAAO;EACL;EACA,OAAO,IAAI,SAAS,kBAAkB,OAAO,IAAI,IAAI,CAAC;EACtD,UAAU,IAAI,SAAS,aAAa,OAAO,IAAc,MAAM,IAAI;CACrE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","names":[],"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 { SNAP_ROLES } from 'features/snap/roles';\nimport { runBehaviorSettled } from '../gestureLifecycle';\nimport { inPlane, insertLayer } from '../planeInput';\nimport { copiesWithin } from 'canvas/copiesAbove';\nimport { scenePaintedPoseOf } from 'canvas/derivedPath';\nimport { cancelInsert, commitInsert } from './commit';\nimport { carryStart, nextFrame } from './frame';\nimport type { InsertLiveGesture } from './live';\nimport { beginInsert } from './session';\nimport { insertKind, insertShape } from './shape';\n\n/**\n * Drag-to-insert. The node `kind` is read from `opts.params.kind`.\n *\n * The drag's start and current point snap through the `snap` dep's `point`\n * sessions (never freehand pencil samples). While `snap.constrain` (Shift) is\n * held, a line's end stays on the 15° line through the snapped start nearest\n * the pointer, and lands where that line meets a target. Behaviors from the\n * 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 modifierRoles: SNAP_ROLES,\n requires: ['insert', 'insertLive', 'insertInto', 'selection', 'snap', 'textEdit', 'scene', 'applyOps', 'view', 'kitSettings'],\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, repositioning: false };\n const live = ctx.deps.insertLive;\n if (live) live.gesture = gesture;\n // Where the shape will land decides the copies it will be drawn in.\n const scene = ctx.deps.scene;\n const copies = scene ? copiesWithin(scene, session.parent, scenePaintedPoseOf(scene)) : [];\n\n return {\n kind: 'insert',\n onMove(moveCtx: InvocationCtx): void {\n if (gesture.repositioning) carryStart(session, frame.pointer, moveCtx.world, moveCtx);\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 ...(copies.length > 0 ? { copies } : {}),\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 session.snap.close();\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,eAAgD,QAAQ;CACnE,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,iBAAiB;CACzC,eAAe;CACf,UAAU;EAAC;EAAU;EAAc;EAAc;EAAa;EAAQ;EAAY;EAAS;EAAY;EAAQ;CAAa;
|
|
1
|
+
{"version":3,"file":"action.js","names":[],"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 { SNAP_ROLES } from 'features/snap/roles';\nimport { runBehaviorSettled } from '../gestureLifecycle';\nimport { inPlane, insertLayer } from '../planeInput';\nimport { copiesWithin } from 'canvas/copiesAbove';\nimport { scenePaintedPoseOf } from 'canvas/derivedPath';\nimport { cancelInsert, commitInsert } from './commit';\nimport { carryStart, nextFrame } from './frame';\nimport type { InsertLiveGesture } from './live';\nimport { beginInsert } from './session';\nimport { insertKind, insertShape } from './shape';\n\n/**\n * Drag-to-insert. The node `kind` is read from `opts.params.kind`.\n *\n * The drag's start and current point snap through the `snap` dep's `point`\n * sessions (never freehand pencil samples). While `snap.constrain` (Shift) is\n * held, a line's end stays on the 15° line through the snapped start nearest\n * the pointer, and lands where that line meets a target. Behaviors from the\n * 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 modifierRoles: SNAP_ROLES,\n requires: ['insert', 'insertLive', 'insertInto', 'canDropInto', 'selection', 'snap', 'textEdit', 'scene', 'applyOps', 'view', 'kitSettings'],\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, repositioning: false };\n const live = ctx.deps.insertLive;\n if (live) live.gesture = gesture;\n // Where the shape will land decides the copies it will be drawn in.\n const scene = ctx.deps.scene;\n const copies = scene ? copiesWithin(scene, session.parent, scenePaintedPoseOf(scene)) : [];\n\n return {\n kind: 'insert',\n onMove(moveCtx: InvocationCtx): void {\n if (gesture.repositioning) carryStart(session, frame.pointer, moveCtx.world, moveCtx);\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 ...(copies.length > 0 ? { copies } : {}),\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 session.snap.close();\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,eAAgD,QAAQ;CACnE,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,iBAAiB;CACzC,eAAe;CACf,UAAU;EAAC;EAAU;EAAc;EAAc;EAAe;EAAa;EAAQ;EAAY;EAAS;EAAY;EAAQ;CAAa;CAC3I,SAAS;EACP,QAAQ;EACR,MAAM,KAAoB,MAAmC;GAC3D,MAAM,QAAQ,YAAY,KAAK,IAAI;GACnC,IAAI,CAAC,OAAO,OAAO,CAAC;GACpB,MAAM,EAAE,SAAS,YAAY;GAC7B,IAAI,QAAQ,MAAM;GAClB,MAAM,UAA6B;IAAE,MAAM;IAAM,cAAc;IAAG,eAAe;GAAM;GACvF,MAAM,OAAO,IAAI,KAAK;GACtB,IAAI,MAAM,KAAK,UAAU;GAEzB,MAAM,QAAQ,IAAI,KAAK;GACvB,MAAM,SAAS,QAAQ,aAAa,OAAO,QAAQ,QAAQ,mBAAmB,KAAK,CAAC,IAAI,CAAC;GAEzF,OAAO;IACL,MAAM;IACN,OAAO,SAA8B;KACnC,IAAI,QAAQ,eAAe,WAAW,SAAS,MAAM,SAAS,QAAQ,OAAO,OAAO;KACpF,QAAQ,UAAU,SAAS,SAAS,OAAO,OAAO;IACpD;IACA,UAAiC;KAC/B,IAAI,CAAC,QAAQ,MAAM,OAAO;KAG1B,MAAM,WAAW,cAAc,QAAQ,MAAM,MAAM;KACnD,IAAI,CAAC,cAAc,WAAW,QAAQ,CAAC,CAAC,EAAE,eAAe,OAAO;KAChE,MAAM,EAAE,QAAQ,QAAQ,UAAU,YAAY,UAAU,OAAO,MAAM,QAAQ,QAAQ,YAAY;KACjG,OAAO;MACL,MAAM;MACN,OAAO,OAAO;MACd;MACA;MAGA,aAAa;OAAE,GAAG,MAAM;OAAG,GAAG,MAAM;MAAE;MACtC,GAAI,OAAO,SAAS,IAAI,EAAE,OAAO,IAAI,CAAC;KACxC;IACF;IACA,MAAM,QAAuB,QAAmC;KAC9D,QAAQ,OAAO;KACf,IAAI,MAAM,YAAY,SAAS,KAAK,UAAU;KAC9C,IAAI,YAAY;KAChB,IAAI;MACF,IAAI,WAAW,UAAU,aAAa,OAAO;WACxC,YAAY,aAAa,SAAS,OAAO,OAAO,MAAM,UAAU,MAAM,QAAQ,QAAQ,YAAY;KACzG,UAAU;MACR,QAAQ,KAAK,MAAM;MACnB,mBAAmB,QAAQ,WAAW,QAAQ,YAAY,SAAS;KACrE;IACF;GACF;EACF;CACF;;CAEA,eAAe;AACjB,GAAG,WAAW"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { admitsChild } from "../admitsChild.js";
|
|
2
|
+
|
|
1
3
|
//#region src/interactions/actions/insert/parent.ts
|
|
2
|
-
/** The
|
|
3
|
-
*
|
|
4
|
-
function insertParent(scene, into) {
|
|
5
|
-
if (into == null || !scene) return null;
|
|
6
|
-
return scene
|
|
4
|
+
/** The node an insert lands in: the one the `insertInto` dep's `into` names when
|
|
5
|
+
* it exists and admits the insert, or null, the top of the tree. */
|
|
6
|
+
function insertParent(scene, into, canDropInto) {
|
|
7
|
+
if (into == null || !scene || scene.get(into) === void 0) return null;
|
|
8
|
+
return admitsChild(scene, into, [], canDropInto) ? into : null;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent.js","names":[],"sources":["../../../../src/interactions/actions/insert/parent.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\n\n/** What finding an insert's
|
|
1
|
+
{"version":3,"file":"parent.js","names":[],"sources":["../../../../src/interactions/actions/insert/parent.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport { admitsChild } from '../admitsChild';\nimport type { CanDropIntoDep } from '../layoutDeps';\n\n/** What finding an insert's parent reads of a scene. A `Scene` satisfies it. */\ninterface ParentReader {\n get(id: NodeId): { kind: string } | undefined;\n}\n\n/** The node an insert lands in: the one the `insertInto` dep's `into` names when\n * it exists and admits the insert, or null, the top of the tree. */\nexport function insertParent(\n scene: ParentReader | undefined,\n into: string | null | undefined,\n canDropInto?: CanDropIntoDep,\n): NodeId | null {\n if (into == null || !scene || scene.get(into as NodeId) === undefined) return null;\n return admitsChild(scene, into as NodeId, [], canDropInto) ? (into as NodeId) : null;\n}\n"],"mappings":";;;;;AAWA,SAAgB,aACd,OACA,MACA,aACe;CACf,IAAI,QAAQ,QAAQ,CAAC,SAAS,MAAM,IAAI,IAAc,MAAM,QAAW,OAAO;CAC9E,OAAO,YAAY,OAAO,MAAgB,CAAC,GAAG,WAAW,IAAK,OAAkB;AAClF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { insertParent } from "./parent.js";
|
|
1
2
|
import { inPlane, insertLayer } from "../planeInput.js";
|
|
2
3
|
import { SNAP_ROLES, snapMods } from "../../../features/snap/roles.js";
|
|
3
4
|
import { minSizeOf } from "../../../core/scene/minSize.js";
|
|
4
5
|
import { insertKind } from "./shape.js";
|
|
5
6
|
import { enterInsertedText } from "./commit.js";
|
|
6
|
-
import { insertParent } from "./parent.js";
|
|
7
7
|
|
|
8
8
|
//#region src/interactions/actions/insert/placeAction.ts
|
|
9
9
|
/** What the dispatcher lays under an immediate action's params for a click. */
|
|
@@ -43,6 +43,7 @@ var placeAction = inPlane({
|
|
|
43
43
|
requires: [
|
|
44
44
|
"insert",
|
|
45
45
|
"insertInto",
|
|
46
|
+
"canDropInto",
|
|
46
47
|
"selection",
|
|
47
48
|
"snap",
|
|
48
49
|
"textEdit",
|
|
@@ -63,7 +64,7 @@ var placeAction = inPlane({
|
|
|
63
64
|
if (!dep || !size || typeof x !== "number" || typeof y !== "number") return;
|
|
64
65
|
if (!(size.width > 0 && size.height > 0)) return;
|
|
65
66
|
deps.selection?.clear();
|
|
66
|
-
const parent = insertParent(deps.scene, deps.insertInto?.get());
|
|
67
|
+
const parent = insertParent(deps.scene, deps.insertInto?.get(), deps.canDropInto);
|
|
67
68
|
const snap = deps.snap?.begin({
|
|
68
69
|
gesture: "point",
|
|
69
70
|
press: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placeAction.js","names":[],"sources":["../../../../src/interactions/actions/insert/placeAction.ts"],"sourcesContent":["import type { Action, ActionDeps, ModifierState } from '@weasel-js/routing';\nimport { SNAP_ROLES, snapMods } from 'features/snap/roles';\nimport type { InsertExtras } from '../depSchema';\nimport { inPlane, insertLayer } from '../planeInput';\nimport { enterInsertedText } from './commit';\nimport { insertParent } from './parent';\nimport { insertKind } from './shape';\nimport { minSizeOf } from 'core/scene/minSize';\n\n/** What the dispatcher lays under an immediate action's params for a click. */\nconst CLICK_FIELDS = ['worldX', 'worldY', 'pressX', 'pressY', 'affordance', 'mods'] as const;\n\nconst NO_KEYS: ModifierState = { alt: false, ctrl: false, meta: false, shift: false };\n\n/**\n * Click-to-insert: the companion to `insertAction` for a click, which draws\n * no box. It commits a node of `params.kind` at `params.size`, centered on the\n * click, snapped through a `point` session of the `snap` dep unless the\n * click held `snap.suspend` (Ctrl), and commits\n * through the same `insert` dep a drag commits through. The rest of the\n * binding's params are the insert's extras, as a drag's are.\n *\n * A `minSize` in the params floors the size, and goes on to the node.\n *\n * A binding with no `size` places nothing: the kind's extent is the tool's to\n * name, and a click has none of its own.\n */\nexport const placeAction: Action & { requires: string[] } = inPlane({\n id: 'place',\n label: 'Place',\n group: 'insert',\n eligible: { capability: 'creates-shapes' },\n modifierRoles: SNAP_ROLES,\n requires: ['insert', 'insertInto', 'selection', 'snap', 'textEdit', 'scene'],\n invoker: {\n timing: 'immediate',\n run(deps: ActionDeps, params?: Record<string, unknown>): void {\n const dep = deps.insert;\n const asked = params?.['size'] as { width: number; height: number } | undefined;\n const min = minSizeOf(params);\n const size = asked && min\n ? { width: Math.max(asked.width, min.width), height: Math.max(asked.height, min.height) }\n : asked;\n const x = params?.['worldX'];\n const y = params?.['worldY'];\n if (!dep || !size || typeof x !== 'number' || typeof y !== 'number') return;\n if (!(size.width > 0 && size.height > 0)) return;\n\n deps.selection?.clear();\n const parent = insertParent(deps.scene, deps.insertInto?.get());\n const snap = deps.snap?.begin({ gesture: 'point', press: { x, y }, ...(parent === null ? {} : { parent }) });\n const mods = snapMods({ modifiers: (params?.['mods'] as ModifierState | undefined) ?? NO_KEYS });\n const at = snap ? snap.at({ x, y }, mods).point : { x, y };\n snap?.end();\n const extras: Record<string, unknown> = { ...params, kind: insertKind(params) };\n for (const k of [...CLICK_FIELDS, 'size']) delete extras[k];\n const bounds = { x: at.x - size.width / 2, y: at.y - size.height / 2, width: size.width, height: size.height };\n const ends = { start: at, end: { x: at.x + size.width / 2, y: at.y + size.height / 2 }, fromCenter: true };\n const id = dep.commit(bounds, extras as InsertExtras, ends);\n enterInsertedText(deps.textEdit, id === null ? null : String(id), extras.kind as string);\n },\n },\n /** Like `insert`, needs no selection. */\n enabled: () => true as const,\n}, insertLayer);\n"],"mappings":";;;;;;;;;AAUA,IAAM,eAAe;CAAC;CAAU;CAAU;CAAU;CAAU;CAAc;AAAM;AAElF,IAAM,UAAyB;CAAE,KAAK;CAAO,MAAM;CAAO,MAAM;CAAO,OAAO;AAAM;;;;;;;;;;;;;;AAepF,IAAa,cAA+C,QAAQ;CAClE,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,iBAAiB;CACzC,eAAe;CACf,UAAU;EAAC;EAAU;EAAc;EAAa;EAAQ;EAAY;CAAO;
|
|
1
|
+
{"version":3,"file":"placeAction.js","names":[],"sources":["../../../../src/interactions/actions/insert/placeAction.ts"],"sourcesContent":["import type { Action, ActionDeps, ModifierState } from '@weasel-js/routing';\nimport { SNAP_ROLES, snapMods } from 'features/snap/roles';\nimport type { InsertExtras } from '../depSchema';\nimport { inPlane, insertLayer } from '../planeInput';\nimport { enterInsertedText } from './commit';\nimport { insertParent } from './parent';\nimport { insertKind } from './shape';\nimport { minSizeOf } from 'core/scene/minSize';\n\n/** What the dispatcher lays under an immediate action's params for a click. */\nconst CLICK_FIELDS = ['worldX', 'worldY', 'pressX', 'pressY', 'affordance', 'mods'] as const;\n\nconst NO_KEYS: ModifierState = { alt: false, ctrl: false, meta: false, shift: false };\n\n/**\n * Click-to-insert: the companion to `insertAction` for a click, which draws\n * no box. It commits a node of `params.kind` at `params.size`, centered on the\n * click, snapped through a `point` session of the `snap` dep unless the\n * click held `snap.suspend` (Ctrl), and commits\n * through the same `insert` dep a drag commits through. The rest of the\n * binding's params are the insert's extras, as a drag's are.\n *\n * A `minSize` in the params floors the size, and goes on to the node.\n *\n * A binding with no `size` places nothing: the kind's extent is the tool's to\n * name, and a click has none of its own.\n */\nexport const placeAction: Action & { requires: string[] } = inPlane({\n id: 'place',\n label: 'Place',\n group: 'insert',\n eligible: { capability: 'creates-shapes' },\n modifierRoles: SNAP_ROLES,\n requires: ['insert', 'insertInto', 'canDropInto', 'selection', 'snap', 'textEdit', 'scene'],\n invoker: {\n timing: 'immediate',\n run(deps: ActionDeps, params?: Record<string, unknown>): void {\n const dep = deps.insert;\n const asked = params?.['size'] as { width: number; height: number } | undefined;\n const min = minSizeOf(params);\n const size = asked && min\n ? { width: Math.max(asked.width, min.width), height: Math.max(asked.height, min.height) }\n : asked;\n const x = params?.['worldX'];\n const y = params?.['worldY'];\n if (!dep || !size || typeof x !== 'number' || typeof y !== 'number') return;\n if (!(size.width > 0 && size.height > 0)) return;\n\n deps.selection?.clear();\n const parent = insertParent(deps.scene, deps.insertInto?.get(), deps.canDropInto);\n const snap = deps.snap?.begin({ gesture: 'point', press: { x, y }, ...(parent === null ? {} : { parent }) });\n const mods = snapMods({ modifiers: (params?.['mods'] as ModifierState | undefined) ?? NO_KEYS });\n const at = snap ? snap.at({ x, y }, mods).point : { x, y };\n snap?.end();\n const extras: Record<string, unknown> = { ...params, kind: insertKind(params) };\n for (const k of [...CLICK_FIELDS, 'size']) delete extras[k];\n const bounds = { x: at.x - size.width / 2, y: at.y - size.height / 2, width: size.width, height: size.height };\n const ends = { start: at, end: { x: at.x + size.width / 2, y: at.y + size.height / 2 }, fromCenter: true };\n const id = dep.commit(bounds, extras as InsertExtras, ends);\n enterInsertedText(deps.textEdit, id === null ? null : String(id), extras.kind as string);\n },\n },\n /** Like `insert`, needs no selection. */\n enabled: () => true as const,\n}, insertLayer);\n"],"mappings":";;;;;;;;;AAUA,IAAM,eAAe;CAAC;CAAU;CAAU;CAAU;CAAU;CAAc;AAAM;AAElF,IAAM,UAAyB;CAAE,KAAK;CAAO,MAAM;CAAO,MAAM;CAAO,OAAO;AAAM;;;;;;;;;;;;;;AAepF,IAAa,cAA+C,QAAQ;CAClE,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,iBAAiB;CACzC,eAAe;CACf,UAAU;EAAC;EAAU;EAAc;EAAe;EAAa;EAAQ;EAAY;CAAO;CAC1F,SAAS;EACP,QAAQ;EACR,IAAI,MAAkB,QAAwC;GAC5D,MAAM,MAAM,KAAK;GACjB,MAAM,QAAQ,SAAS;GACvB,MAAM,MAAM,UAAU,MAAM;GAC5B,MAAM,OAAO,SAAS,MAClB;IAAE,OAAO,KAAK,IAAI,MAAM,OAAO,IAAI,KAAK;IAAG,QAAQ,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM;GAAE,IACtF;GACJ,MAAM,IAAI,SAAS;GACnB,MAAM,IAAI,SAAS;GACnB,IAAI,CAAC,OAAO,CAAC,QAAQ,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;GACrE,IAAI,EAAE,KAAK,QAAQ,KAAK,KAAK,SAAS,IAAI;GAE1C,KAAK,WAAW,MAAM;GACtB,MAAM,SAAS,aAAa,KAAK,OAAO,KAAK,YAAY,IAAI,GAAG,KAAK,WAAW;GAChF,MAAM,OAAO,KAAK,MAAM,MAAM;IAAE,SAAS;IAAS,OAAO;KAAE;KAAG;IAAE;IAAG,GAAI,WAAW,OAAO,CAAC,IAAI,EAAE,OAAO;GAAG,CAAC;GAC3G,MAAM,OAAO,SAAS,EAAE,WAAY,SAAS,WAAyC,QAAQ,CAAC;GAC/F,MAAM,KAAK,OAAO,KAAK,GAAG;IAAE;IAAG;GAAE,GAAG,IAAI,CAAC,CAAC,QAAQ;IAAE;IAAG;GAAE;GACzD,MAAM,IAAI;GACV,MAAM,SAAkC;IAAE,GAAG;IAAQ,MAAM,WAAW,MAAM;GAAE;GAC9E,KAAK,MAAM,KAAK,CAAC,GAAG,cAAc,MAAM,GAAG,OAAO,OAAO;GACzD,MAAM,SAAS;IAAE,GAAG,GAAG,IAAI,KAAK,QAAQ;IAAG,GAAG,GAAG,IAAI,KAAK,SAAS;IAAG,OAAO,KAAK;IAAO,QAAQ,KAAK;GAAO;GAC7G,MAAM,OAAO;IAAE,OAAO;IAAI,KAAK;KAAE,GAAG,GAAG,IAAI,KAAK,QAAQ;KAAG,GAAG,GAAG,IAAI,KAAK,SAAS;IAAE;IAAG,YAAY;GAAK;GACzG,MAAM,KAAK,IAAI,OAAO,QAAQ,QAAwB,IAAI;GAC1D,kBAAkB,KAAK,UAAU,OAAO,OAAO,OAAO,OAAO,EAAE,GAAG,OAAO,IAAc;EACzF;CACF;;CAEA,eAAe;AACjB,GAAG,WAAW"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { insertParent } from "./parent.js";
|
|
1
2
|
import { gestureReaders } from "../../gestures/shared/screenTolerance.js";
|
|
2
3
|
import { pointerStateOf } from "../pointerState.js";
|
|
3
4
|
import { SNAP_ANGLE_STEP, snapMods } from "../../../features/snap/roles.js";
|
|
4
5
|
import { insertKind } from "./shape.js";
|
|
5
6
|
import { spanSnap } from "../../../features/snap/spanSnap.js";
|
|
6
|
-
import { insertParent } from "./parent.js";
|
|
7
7
|
import { resolveParams } from "@weasel-js/routing";
|
|
8
8
|
|
|
9
9
|
//#region src/interactions/actions/insert/session.ts
|
|
@@ -18,7 +18,7 @@ function beginInsert(ctx, opts) {
|
|
|
18
18
|
const selection = ctx.deps.selection;
|
|
19
19
|
const priorSelection = selection ? [...selection.get()] : [];
|
|
20
20
|
if (selection && priorSelection.length > 0) selection.clear();
|
|
21
|
-
const parent = insertParent(ctx.deps.scene, ctx.deps.insertInto?.get());
|
|
21
|
+
const parent = insertParent(ctx.deps.scene, ctx.deps.insertInto?.get(), ctx.deps.canDropInto);
|
|
22
22
|
const constrain = () => insertKind(resolveParams(opts?.params)) === "line" ? { step: SNAP_ANGLE_STEP } : void 0;
|
|
23
23
|
const snap = spanSnap(ctx.deps.snap, constrain, parent === null ? {} : { parent });
|
|
24
24
|
const behaviors = opts?.behaviors ?? [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","names":[],"sources":["../../../../src/interactions/actions/insert/session.ts"],"sourcesContent":["import type { BindingOpts, DragSample, InvocationCtx } from '@weasel-js/routing';\nimport { resolveParams } from '@weasel-js/routing';\nimport { SNAP_ANGLE_STEP, snapMods } from 'features/snap/roles';\nimport { spanSnap, type SpanSnap } from 'features/snap/spanSnap';\nimport { pointerStateOf } from '../pointerState';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport { gestureReaders, type GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { GestureContext, InsertBehavior, InsertPoint } from '../../gestures/types';\nimport type { InsertDep, TextEditDep } from '../depSchema';\nimport { insertParent } from './parent';\nimport { insertKind } from './shape';\n\n/** The key an insert's single gesture point rides under in the behaviors'\n * `draggedIds` / `origin` / `current` — insert has no node id yet. */\nexport const GESTURE_KEY = 'gesture';\n\n/** What an insert captured at press. Nothing here changes during the drag.\n * The deps are captured because the dispatcher builds the deps bag once, on\n * `start`: every later pump event carries `deps: {}`. */\nexport interface InsertSession {\n readonly dep: InsertDep;\n /** For the text kind's drop-into-the-caret step. */\n readonly textEdit: TextEditDep | undefined;\n /** Snaps the drag's start and current point, so the live preview and the\n * committed geometry agree. Freehand pencil samples are deliberately NOT\n * snapped — a grid-quantized freehand trail is a staircase, not a stroke. */\n readonly snap: SpanSnap;\n /** The active binding's opts — re-resolved on every read so thunked\n * params see the latest tool state (e.g. polygon `sides` after ArrowUp). */\n readonly opts: BindingOpts | undefined;\n /** What was selected before the draw cleared it, to put back on cancel. */\n readonly priorSelection: readonly NodeId[];\n /** Behaviors from `opts.behaviors`; empty when none were bound. */\n readonly behaviors: readonly InsertBehavior<unknown>[];\n /** Reused gesture context handed to behaviors. Its `origin` holds the\n * start point under {@link GESTURE_KEY}, after `onStart` shaped it. */\n readonly gestureCtx: GestureContext<unknown>;\n /** For committing a behavior's `Op[]`. */\n readonly scene: Scene<unknown, string, unknown> | undefined;\n /** The container the node lands in; null for the top of the tree. */\n readonly parent: NodeId | null;\n readonly applyOps: ((ops: Op[], label: string) => void) | undefined;\n readonly selection: SelectionApi | undefined;\n}\n\n/** What the latest pump event left. Replaced, not mutated, by the next. */\nexport interface InsertFrame {\n /** The raw (unsnapped) pointer in world space. */\n readonly pointer: InsertPoint;\n /** Pointer trail accumulated by the dispatcher in world space; pencil-kind\n * commits read it. */\n readonly points: ReadonlyArray<DragSample> | null;\n /** Alt inverts the binding's nominal `originMode` (corner ⇄ center), so\n * pressing or releasing it mid-drag flips the preview and the commit\n * without the dispatcher re-routing to another binding. */\n readonly altHeld: boolean;\n /** The endpoints after the snap session and the behaviors. */\n readonly shaped: { start: InsertPoint; current: InsertPoint };\n}\n\n/** Capture an insert at press. Null with no `insert` dep. Clears the\n * selection and runs each behavior's `onStart`. */\nexport function beginInsert(\n ctx: InvocationCtx,\n opts: BindingOpts | undefined,\n): { session: InsertSession; readers: GestureReaders; frame: InsertFrame } | null {\n const dep = ctx.deps.insert;\n if (!dep) return null;\n\n // Starting a draw retires any prior selection — the lingering halo\n // around an unrelated node while the user is drawing a new shape is\n // just visual noise, and it primes the UX bug where a drag that\n // continues over the selected node would otherwise drive the move\n // action via fall-through. The clear is unconditional: the user has\n // committed to \"I'm making a new thing\" by engaging a creation tool.\n const selection = ctx.deps.selection;\n const priorSelection = selection ? [...selection.get()] : [];\n if (selection && priorSelection.length > 0) {\n selection.clear();\n }\n\n const parent = insertParent(ctx.deps.scene, ctx.deps.insertInto?.get());\n const constrain = () => (insertKind(resolveParams(opts?.params)) === 'line' ? { step: SNAP_ANGLE_STEP } : undefined);\n const snap = spanSnap(ctx.deps.snap, constrain, parent === null ? {} : { parent });\n const behaviors = (opts?.behaviors ?? []) as InsertBehavior<unknown>[];\n const readers = gestureReaders(ctx.deps);\n const origin = snap.start({ x: ctx.world.x, y: ctx.world.y }, snapMods(ctx)).point;\n const gestureCtx: GestureContext<unknown> = {\n draggedIds: [GESTURE_KEY],\n origin: new Map<string, unknown>([[GESTURE_KEY, origin]]),\n current: new Map<string, unknown>([[GESTURE_KEY, origin]]),\n snap: null,\n modifiers: { ...ctx.modifiers },\n pointer: pointerStateOf(ctx.world, ctx),\n view: readers.view(),\n plane: readers.plane(),\n kitSettings: readers.kitSettings,\n // No node exists to adapt until commit; insert behaviors read points.\n adapter: undefined as unknown as GestureContext<unknown>['adapter'],\n scratch: {},\n };\n for (const b of behaviors) b.onStart?.(gestureCtx);\n // A snap target in range outranks a behavior's own snapping.\n if (snap.startHeld()) gestureCtx.origin.set(GESTURE_KEY, origin);\n const startPoint = gestureCtx.origin.get(GESTURE_KEY) as InsertPoint;\n snap.anchor(startPoint);\n\n const session: InsertSession = {\n dep,\n textEdit: ctx.deps.textEdit,\n snap,\n opts,\n priorSelection,\n behaviors,\n gestureCtx,\n scene: ctx.deps.scene,\n parent,\n applyOps: ctx.deps.applyOps,\n selection,\n };\n const frame: InsertFrame = {\n pointer: { x: ctx.world.x, y: ctx.world.y },\n points: ctx.drag?.points ?? null,\n altHeld: ctx.modifiers.alt,\n shaped: { start: startPoint, current: startPoint },\n };\n return { session, readers, frame };\n}\n"],"mappings":";;;;;;;;;;;AAgBA,IAAa,cAAc;;;AAgD3B,SAAgB,YACd,KACA,MACgF;CAChF,MAAM,MAAM,IAAI,KAAK;CACrB,IAAI,CAAC,KAAK,OAAO;CAQjB,MAAM,YAAY,IAAI,KAAK;CAC3B,MAAM,iBAAiB,YAAY,CAAC,GAAG,UAAU,IAAI,CAAC,IAAI,CAAC;CAC3D,IAAI,aAAa,eAAe,SAAS,GACvC,UAAU,MAAM;CAGlB,MAAM,SAAS,aAAa,IAAI,KAAK,OAAO,IAAI,KAAK,YAAY,IAAI,
|
|
1
|
+
{"version":3,"file":"session.js","names":[],"sources":["../../../../src/interactions/actions/insert/session.ts"],"sourcesContent":["import type { BindingOpts, DragSample, InvocationCtx } from '@weasel-js/routing';\nimport { resolveParams } from '@weasel-js/routing';\nimport { SNAP_ANGLE_STEP, snapMods } from 'features/snap/roles';\nimport { spanSnap, type SpanSnap } from 'features/snap/spanSnap';\nimport { pointerStateOf } from '../pointerState';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport { gestureReaders, type GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { GestureContext, InsertBehavior, InsertPoint } from '../../gestures/types';\nimport type { InsertDep, TextEditDep } from '../depSchema';\nimport { insertParent } from './parent';\nimport { insertKind } from './shape';\n\n/** The key an insert's single gesture point rides under in the behaviors'\n * `draggedIds` / `origin` / `current` — insert has no node id yet. */\nexport const GESTURE_KEY = 'gesture';\n\n/** What an insert captured at press. Nothing here changes during the drag.\n * The deps are captured because the dispatcher builds the deps bag once, on\n * `start`: every later pump event carries `deps: {}`. */\nexport interface InsertSession {\n readonly dep: InsertDep;\n /** For the text kind's drop-into-the-caret step. */\n readonly textEdit: TextEditDep | undefined;\n /** Snaps the drag's start and current point, so the live preview and the\n * committed geometry agree. Freehand pencil samples are deliberately NOT\n * snapped — a grid-quantized freehand trail is a staircase, not a stroke. */\n readonly snap: SpanSnap;\n /** The active binding's opts — re-resolved on every read so thunked\n * params see the latest tool state (e.g. polygon `sides` after ArrowUp). */\n readonly opts: BindingOpts | undefined;\n /** What was selected before the draw cleared it, to put back on cancel. */\n readonly priorSelection: readonly NodeId[];\n /** Behaviors from `opts.behaviors`; empty when none were bound. */\n readonly behaviors: readonly InsertBehavior<unknown>[];\n /** Reused gesture context handed to behaviors. Its `origin` holds the\n * start point under {@link GESTURE_KEY}, after `onStart` shaped it. */\n readonly gestureCtx: GestureContext<unknown>;\n /** For committing a behavior's `Op[]`. */\n readonly scene: Scene<unknown, string, unknown> | undefined;\n /** The container the node lands in; null for the top of the tree. */\n readonly parent: NodeId | null;\n readonly applyOps: ((ops: Op[], label: string) => void) | undefined;\n readonly selection: SelectionApi | undefined;\n}\n\n/** What the latest pump event left. Replaced, not mutated, by the next. */\nexport interface InsertFrame {\n /** The raw (unsnapped) pointer in world space. */\n readonly pointer: InsertPoint;\n /** Pointer trail accumulated by the dispatcher in world space; pencil-kind\n * commits read it. */\n readonly points: ReadonlyArray<DragSample> | null;\n /** Alt inverts the binding's nominal `originMode` (corner ⇄ center), so\n * pressing or releasing it mid-drag flips the preview and the commit\n * without the dispatcher re-routing to another binding. */\n readonly altHeld: boolean;\n /** The endpoints after the snap session and the behaviors. */\n readonly shaped: { start: InsertPoint; current: InsertPoint };\n}\n\n/** Capture an insert at press. Null with no `insert` dep. Clears the\n * selection and runs each behavior's `onStart`. */\nexport function beginInsert(\n ctx: InvocationCtx,\n opts: BindingOpts | undefined,\n): { session: InsertSession; readers: GestureReaders; frame: InsertFrame } | null {\n const dep = ctx.deps.insert;\n if (!dep) return null;\n\n // Starting a draw retires any prior selection — the lingering halo\n // around an unrelated node while the user is drawing a new shape is\n // just visual noise, and it primes the UX bug where a drag that\n // continues over the selected node would otherwise drive the move\n // action via fall-through. The clear is unconditional: the user has\n // committed to \"I'm making a new thing\" by engaging a creation tool.\n const selection = ctx.deps.selection;\n const priorSelection = selection ? [...selection.get()] : [];\n if (selection && priorSelection.length > 0) {\n selection.clear();\n }\n\n const parent = insertParent(ctx.deps.scene, ctx.deps.insertInto?.get(), ctx.deps.canDropInto);\n const constrain = () => (insertKind(resolveParams(opts?.params)) === 'line' ? { step: SNAP_ANGLE_STEP } : undefined);\n const snap = spanSnap(ctx.deps.snap, constrain, parent === null ? {} : { parent });\n const behaviors = (opts?.behaviors ?? []) as InsertBehavior<unknown>[];\n const readers = gestureReaders(ctx.deps);\n const origin = snap.start({ x: ctx.world.x, y: ctx.world.y }, snapMods(ctx)).point;\n const gestureCtx: GestureContext<unknown> = {\n draggedIds: [GESTURE_KEY],\n origin: new Map<string, unknown>([[GESTURE_KEY, origin]]),\n current: new Map<string, unknown>([[GESTURE_KEY, origin]]),\n snap: null,\n modifiers: { ...ctx.modifiers },\n pointer: pointerStateOf(ctx.world, ctx),\n view: readers.view(),\n plane: readers.plane(),\n kitSettings: readers.kitSettings,\n // No node exists to adapt until commit; insert behaviors read points.\n adapter: undefined as unknown as GestureContext<unknown>['adapter'],\n scratch: {},\n };\n for (const b of behaviors) b.onStart?.(gestureCtx);\n // A snap target in range outranks a behavior's own snapping.\n if (snap.startHeld()) gestureCtx.origin.set(GESTURE_KEY, origin);\n const startPoint = gestureCtx.origin.get(GESTURE_KEY) as InsertPoint;\n snap.anchor(startPoint);\n\n const session: InsertSession = {\n dep,\n textEdit: ctx.deps.textEdit,\n snap,\n opts,\n priorSelection,\n behaviors,\n gestureCtx,\n scene: ctx.deps.scene,\n parent,\n applyOps: ctx.deps.applyOps,\n selection,\n };\n const frame: InsertFrame = {\n pointer: { x: ctx.world.x, y: ctx.world.y },\n points: ctx.drag?.points ??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;CAEjD,IAAI,KAAK,UAAU,GAAG,WAAW,OAAO,IAAI,aAAa,MAAM;CAC/D,MAAM,aAAa,WAAW,OAAO,IAAI,WAAW;CACpD,KAAK,OAAO,UAAU;CAqBtB,OAAO;EAAE;GAlBP;GACA,UAAU,IAAI,KAAK;GACnB;GACA;GACA;GACA;GACA;GACA,OAAO,IAAI,KAAK;GAChB;GACA,UAAU,IAAI,KAAK;GACnB;EAQO;EAAS;EAAS;GALzB,SAAS;IAAE,GAAG,IAAI,MAAM;IAAG,GAAG,IAAI,MAAM;GAAE;GAC1C,QAAQ,IAAI,MAAM,UAAU;GAC5B,SAAS,IAAI,UAAU;GACvB,QAAQ;IAAE,OAAO;IAAY,SAAS;GAAW;EAExB;CAAM;AACnC"}
|
|
@@ -19,7 +19,7 @@ function resolveDropTarget(session, at) {
|
|
|
19
19
|
if (!hit) return null;
|
|
20
20
|
const hitNode = session.scene.get(hit);
|
|
21
21
|
if (!hitNode) return null;
|
|
22
|
-
if (
|
|
22
|
+
if (session.admits(hit)) return {
|
|
23
23
|
newParent: hit,
|
|
24
24
|
newLayer: hitNode.layer,
|
|
25
25
|
hitSibling: null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reparent.js","names":[],"sources":["../../../../../src/interactions/actions/move/commit/reparent.ts"],"sourcesContent":["import { createReparentOp } from 'core/ops/reparent';\nimport { createSetLayerOp } from 'core/ops/setLayer';\nimport { createTransformOp } from 'core/ops/transform';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId } from 'core/scene/types';\nimport { planeToPlane } from 'core/viewport/parallax';\nimport { rebaseLocalPose } from 'core/scene/composePose';\nimport { scenePoseAdapter } from 'core/scene/scenePoseAdapter';\nimport { carryPose, planeOf } from '../../planeInput';\nimport { draggedWorldPose, grabbedPoseAdapter } from '../delta';\nimport type { MoveSession, ReparentOnDrop } from '../session';\nimport { translateOps } from '../translate';\n\n/** Resolved drop target — the new parent + layer + (for `'above'` mode)\n * the hit sibling whose z-order position the moved node should land\n * immediately above. `newParent === null` means \"land at the layer\n * root\" (top-level node of `newLayer`). */\nexport interface DropTarget {\n newParent: NodeId | null;\n newLayer: string;\n hitSibling: NodeId | null;\n}\n\n/** Walk the hit chain to find the appropriate drop target. Returns\n * `null` when no reparent should happen (drop on empty canvas, or the\n * only hits are the moved subtree itself). */\nexport function resolveDropTarget(\n session: MoveSession,\n at: { x: number; y: number },\n): DropTarget | null {\n const dep = session.nodeAtPoint;\n if (!dep) return null;\n\n // Exclude moved roots + their descendants. Otherwise we'd happily\n // reparent a node into itself (or under one of its own children).\n const exclude = new Set<NodeId>([...session.ids, ...session.cascadeIds]);\n const hit = dep(at, exclude);\n if (!hit) return null;\n\n const hitNode = session.scene.get(hit);\n if (!hitNode) return null;\n\n //
|
|
1
|
+
{"version":3,"file":"reparent.js","names":[],"sources":["../../../../../src/interactions/actions/move/commit/reparent.ts"],"sourcesContent":["import { createReparentOp } from 'core/ops/reparent';\nimport { createSetLayerOp } from 'core/ops/setLayer';\nimport { createTransformOp } from 'core/ops/transform';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId } from 'core/scene/types';\nimport { planeToPlane } from 'core/viewport/parallax';\nimport { rebaseLocalPose } from 'core/scene/composePose';\nimport { scenePoseAdapter } from 'core/scene/scenePoseAdapter';\nimport { carryPose, planeOf } from '../../planeInput';\nimport { draggedWorldPose, grabbedPoseAdapter } from '../delta';\nimport type { MoveSession, ReparentOnDrop } from '../session';\nimport { translateOps } from '../translate';\n\n/** Resolved drop target — the new parent + layer + (for `'above'` mode)\n * the hit sibling whose z-order position the moved node should land\n * immediately above. `newParent === null` means \"land at the layer\n * root\" (top-level node of `newLayer`). */\nexport interface DropTarget {\n newParent: NodeId | null;\n newLayer: string;\n hitSibling: NodeId | null;\n}\n\n/** Walk the hit chain to find the appropriate drop target. Returns\n * `null` when no reparent should happen (drop on empty canvas, or the\n * only hits are the moved subtree itself). */\nexport function resolveDropTarget(\n session: MoveSession,\n at: { x: number; y: number },\n): DropTarget | null {\n const dep = session.nodeAtPoint;\n if (!dep) return null;\n\n // Exclude moved roots + their descendants. Otherwise we'd happily\n // reparent a node into itself (or under one of its own children).\n const exclude = new Set<NodeId>([...session.ids, ...session.cascadeIds]);\n const hit = dep(at, exclude);\n if (!hit) return null;\n\n const hitNode = session.scene.get(hit);\n if (!hitNode) return null;\n\n // A node that admits the drop is a drop-INTO target; any other is a\n // drop-NEXT-TO target (parent = its parent). When it has no parent\n // (top-level under a layer), `newParent === null` and the moved\n // subtree lands at the layer root.\n if (session.admits(hit)) {\n return { newParent: hit, newLayer: hitNode.layer, hitSibling: null };\n }\n // A node that refuses the drop is a sibling to land beside, inside\n // the nearest ancestor that admits it.\n let newParent = hitNode.parent;\n let hitSibling: NodeId = hit;\n while (newParent !== null && !session.admits(newParent)) {\n hitSibling = newParent;\n newParent = session.scene.get(newParent)?.parent ?? null;\n }\n return { newParent, newLayer: hitNode.layer, hitSibling };\n}\n\n/** Reparent and reposition each moved root as ops, keeping the world pose the\n * drag showed, then the ops that bring uncarried descendants along. */\nexport function reparentOps(\n session: MoveSession,\n target: DropTarget,\n mode: ReparentOnDrop,\n delta: { dx: number; dy: number },\n): Op[] {\n const { scene, pc, view } = session;\n const adapter = scenePoseAdapter(scene);\n const label = session.lifecycle.label;\n const ops: Op[] = [];\n // The destination's children as each op will find them: an earlier root's\n // landing shifts where a later one goes.\n const siblings = [...(target.newParent === null ? scene.roots : scene.childrenOf(target.newParent))];\n for (const id of session.ids) {\n if (!session.startPoses.has(id)) continue;\n const node = scene.get(id)!;\n const crossing = node.layer !== target.newLayer;\n const world = carryPose(\n session.descriptorOf(id),\n draggedWorldPose(session, grabbedPoseAdapter(session, adapter), id, delta),\n crossing ? planeToPlane(planeOf(view, node.layer), planeOf(view, target.newLayer)) : null,\n );\n const to = rebaseLocalPose(adapter, world, target.newParent as string | null, pc.compose, pc.decompose);\n\n let from = node.parent as string | null;\n if (crossing) {\n // The scene refuses a layer change on a node whose parent is on another layer.\n if (from !== null) {\n ops.push(createReparentOp({\n id: id as string, fromParentId: from, toParentId: null, label, coalesceKey: `reparent:${id}:orphan`,\n }));\n from = null;\n }\n ops.push(createSetLayerOp({ id: id as string, from: node.layer, to: target.newLayer, label }));\n }\n\n const was = siblings.indexOf(id);\n if (was >= 0) siblings.splice(was, 1);\n const hit = mode === 'above' && target.hitSibling\n ? siblings.indexOf(target.hitSibling)\n : -1;\n const toIndex = hit >= 0 ? hit + 1 : undefined;\n if (toIndex === undefined) siblings.push(id);\n else siblings.splice(toIndex, 0, id);\n\n ops.push(createReparentOp({\n id: id as string, fromParentId: from, toParentId: target.newParent as string | null, toIndex, label,\n }));\n ops.push(createTransformOp<unknown>({ id: id as string, from: node.pose, to, label }));\n }\n return [...ops, ...translateOps(session, session.cascadeIds, delta)];\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,SAAgB,kBACd,SACA,IACmB;CACnB,MAAM,MAAM,QAAQ;CACpB,IAAI,CAAC,KAAK,OAAO;CAKjB,MAAM,MAAM,IAAI,oBAAI,IADA,IAAY,CAAC,GAAG,QAAQ,KAAK,GAAG,QAAQ,UAAU,CAClD,CAAO;CAC3B,IAAI,CAAC,KAAK,OAAO;CAEjB,MAAM,UAAU,QAAQ,MAAM,IAAI,GAAG;CACrC,IAAI,CAAC,SAAS,OAAO;CAMrB,IAAI,QAAQ,OAAO,GAAG,GACpB,OAAO;EAAE,WAAW;EAAK,UAAU,QAAQ;EAAO,YAAY;CAAK;CAIrE,IAAI,YAAY,QAAQ;CACxB,IAAI,aAAqB;CACzB,OAAO,cAAc,QAAQ,CAAC,QAAQ,OAAO,SAAS,GAAG;EACvD,aAAa;EACb,YAAY,QAAQ,MAAM,IAAI,SAAS,CAAC,EAAE,UAAU;CACtD;CACA,OAAO;EAAE;EAAW,UAAU,QAAQ;EAAO;CAAW;AAC1D;;;AAIA,SAAgB,YACd,SACA,QACA,MACA,OACM;CACN,MAAM,EAAE,OAAO,IAAI,SAAS;CAC5B,MAAM,UAAU,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4B;GAAS;EAChG,CAAC,CAAC;EACF,IAAI,KAAK,kBAA2B;GAAM;GAAc,MAAM,KAAK;GAAM;GAAI;EAAM,CAAC,CAAC;CACvF;CACA,OAAO,CAAC,GAAG,KAAK,GAAG,aAAa,SAAS,QAAQ,YAAY,KAAK,CAAC;AACrE"}
|
|
@@ -16,16 +16,15 @@ function moveGestureAdapter(scene, commit, selection) {
|
|
|
16
16
|
for (const [id, pose] of poses) {
|
|
17
17
|
const nodeId = asNodeId(id);
|
|
18
18
|
const mine = previews.get(id);
|
|
19
|
-
const installed = mine !== void 0 && overrides.get(nodeId) === mine;
|
|
20
19
|
if (pose === null) {
|
|
21
20
|
previews.delete(id);
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
else {
|
|
25
|
-
const entry = { pose };
|
|
26
|
-
previews.set(id, entry);
|
|
27
|
-
overrides.set(nodeId, entry);
|
|
21
|
+
if (mine !== void 0) overrides.clear(nodeId, mine);
|
|
22
|
+
continue;
|
|
28
23
|
}
|
|
24
|
+
const entry = mine ?? { pose };
|
|
25
|
+
entry.pose = pose;
|
|
26
|
+
previews.set(id, entry);
|
|
27
|
+
if (!overrides.has(nodeId, entry)) overrides.set(nodeId, entry);
|
|
29
28
|
}
|
|
30
29
|
overrides.commit();
|
|
31
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestureAdapter.js","names":[],"sources":["../../../../src/interactions/actions/move/gestureAdapter.ts"],"sourcesContent":["/**\n * The scene-backed adapter the move behavior pipeline reads and commits\n * through: the default actions' commit adapter, plus what a behavior needs\n * while the gesture runs and after it ends (`previewPoses`, `poseTarget`, and\n * an `applyOps` of its own).\n */\nimport type { Op } from 'core/ops/types';\nimport type { Node, PoseOverride, Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { MoveAdapter } from 'core/adapters/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport { scenePoseTarget } from '../../../animation/poseTarget';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\n\nexport type MoveGestureAdapter<TPose> = MoveAdapter<Node<unknown, string, TPose>, TPose>\n & ReturnType<typeof defaultCommitAdapter<TPose>>\n & { previewPoses(poses: ReadonlyMap<string, TPose | null>): void };\n\n/** `commit` is how a behavior's own `applyOps` batch lands; the returned\n * adapter is passed back so the ops apply through it. Left out, the adapter\n * has no `applyOps`. `selection` is as `defaultCommitAdapter` takes it. */\nexport function moveGestureAdapter<TPose>(\n scene: Scene<unknown, string, TPose>,\n commit?: (ops: Op[], label: string, adapter: MoveGestureAdapter<TPose>) => void,\n selection?: SelectionApi['adapterMethods'],\n): MoveGestureAdapter<TPose> {\n const previews = new Map<string, PoseOverride<TPose>>();\n const adapter: MoveGestureAdapter<TPose> = {\n ...defaultCommitAdapter(scene, selection),\n ...(commit ? { applyOps: (ops: Op[], label: string) => commit(ops, label, adapter) } : {}),\n previewPoses: (poses) => {\n const { overrides } = scene;\n for (const [id, pose] of poses) {\n const nodeId = asNodeId(id);\n const mine = previews.get(id);\n
|
|
1
|
+
{"version":3,"file":"gestureAdapter.js","names":[],"sources":["../../../../src/interactions/actions/move/gestureAdapter.ts"],"sourcesContent":["/**\n * The scene-backed adapter the move behavior pipeline reads and commits\n * through: the default actions' commit adapter, plus what a behavior needs\n * while the gesture runs and after it ends (`previewPoses`, `poseTarget`, and\n * an `applyOps` of its own).\n */\nimport type { Op } from 'core/ops/types';\nimport type { Node, PoseOverride, Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { MoveAdapter } from 'core/adapters/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport { scenePoseTarget } from '../../../animation/poseTarget';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\n\nexport type MoveGestureAdapter<TPose> = MoveAdapter<Node<unknown, string, TPose>, TPose>\n & ReturnType<typeof defaultCommitAdapter<TPose>>\n & { previewPoses(poses: ReadonlyMap<string, TPose | null>): void };\n\n/** `commit` is how a behavior's own `applyOps` batch lands; the returned\n * adapter is passed back so the ops apply through it. Left out, the adapter\n * has no `applyOps`. `selection` is as `defaultCommitAdapter` takes it. */\nexport function moveGestureAdapter<TPose>(\n scene: Scene<unknown, string, TPose>,\n commit?: (ops: Op[], label: string, adapter: MoveGestureAdapter<TPose>) => void,\n selection?: SelectionApi['adapterMethods'],\n): MoveGestureAdapter<TPose> {\n const previews = new Map<string, PoseOverride<TPose>>();\n const adapter: MoveGestureAdapter<TPose> = {\n ...defaultCommitAdapter(scene, selection),\n ...(commit ? { applyOps: (ops: Op[], label: string) => commit(ops, label, adapter) } : {}),\n previewPoses: (poses) => {\n const { overrides } = scene;\n for (const [id, pose] of poses) {\n const nodeId = asNodeId(id);\n const mine = previews.get(id);\n if (pose === null) {\n previews.delete(id);\n if (mine !== undefined) overrides.clear(nodeId, mine);\n continue;\n }\n const entry = mine ?? { pose };\n entry.pose = pose;\n previews.set(id, entry);\n // Back where it stood if the table dropped it: the node went and came back.\n if (!overrides.has(nodeId, entry)) overrides.set(nodeId, entry);\n }\n overrides.commit();\n },\n poseTarget: (id, descriptor) => scenePoseTarget(scene, id, descriptor),\n };\n return adapter;\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,mBACd,OACA,QACA,WAC2B;CAC3B,MAAM,2BAAW,IAAI,IAAiC;CACtD,MAAM,UAAqC;EACzC,GAAG,qBAAqB,OAAO,SAAS;EACxC,GAAI,SAAS,EAAE,WAAW,KAAW,UAAkB,OAAO,KAAK,OAAO,OAAO,EAAE,IAAI,CAAC;EACxF,eAAe,UAAU;GACvB,MAAM,EAAE,cAAc;GACtB,KAAK,MAAM,CAAC,IAAI,SAAS,OAAO;IAC9B,MAAM,SAAS,SAAS,EAAE;IAC1B,MAAM,OAAO,SAAS,IAAI,EAAE;IAC5B,IAAI,SAAS,MAAM;KACjB,SAAS,OAAO,EAAE;KAClB,IAAI,SAAS,QAAW,UAAU,MAAM,QAAQ,IAAI;KACpD;IACF;IACA,MAAM,QAAQ,QAAQ,EAAE,KAAK;IAC7B,MAAM,OAAO;IACb,SAAS,IAAI,IAAI,KAAK;IAEtB,IAAI,CAAC,UAAU,IAAI,QAAQ,KAAK,GAAG,UAAU,IAAI,QAAQ,KAAK;GAChE;GACA,UAAU,OAAO;EACnB;EACA,aAAa,IAAI,eAAe,gBAAgB,OAAO,IAAI,UAAU;CACvE;CACA,OAAO;AACT"}
|
|
@@ -38,7 +38,7 @@ function resolveLayoutExits(session, dropCenter, ids) {
|
|
|
38
38
|
for (const id of parentId === null ? scene.roots : scene.childrenOf(parentId)) {
|
|
39
39
|
if (excluded.has(id)) continue;
|
|
40
40
|
const node = scene.get(id);
|
|
41
|
-
if (!node
|
|
41
|
+
if (!node) continue;
|
|
42
42
|
if (node.layer === layer && depth >= bestDepth && layoutDep.getLayout(id) === null && holds(id, null) && session.admits(id)) {
|
|
43
43
|
best = id;
|
|
44
44
|
bestDepth = depth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exits.js","names":[],"sources":["../../../../../src/interactions/actions/move/layout/exits.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport { poseDescriptorForNode } from 'core/geometry/poseDescriptor';\nimport { toPlane } from 'core/viewport/parallax';\nimport { composeWorldPose } from 'core/scene/composePose';\nimport { scenePoseAdapter } from 'core/scene/scenePoseAdapter';\nimport type { LayoutStrategy } from '../../../../layout/types';\nimport { planeOf } from '../../planeInput';\nimport type { MoveSession } from '../session';\nimport { pointInBounds } from './container';\n\n/** Where each dragged root that leaves its layout container on release lands.\n * A root leaves when the drop center falls outside the body of the layout\n * container holding it, and lands under the innermost plain container beneath\n * the drop that admits it (`canDropInto`) — a layout container there has\n * already declined it — or at the top level of its layer. A root whose parent\n * has no layout is not this pass's to move; `reparentOnDrop` decides for those. */\nexport function resolveLayoutExits(\n session: MoveSession, dropCenter: { x: number; y: number } | null, ids: Iterable<NodeId>,\n): Map<NodeId, NodeId | null> {\n const out = new Map<NodeId, NodeId | null>();\n const layoutDep = session.layout;\n const center = dropCenter;\n if (!layoutDep || !center) return out;\n const { scene, pc, projection: d } = session;\n const poseAdapter = scenePoseAdapter(scene);\n const excluded = new Set<NodeId>([...session.ids, ...session.cascadeIds]);\n const holds = (id: NodeId, layout: LayoutStrategy<unknown> | null): boolean => {\n const node = scene.get(id)!;\n const plane = planeOf(session.view, node.layer);\n const at = plane ? toPlane(plane, center) : center;\n const pose = composeWorldPose(poseAdapter, id as string, pc.compose);\n if (layout?.contains) return layout.contains(pose, at);\n const b = poseDescriptorForNode(d, node).getBounds(pose);\n return pointInBounds(b, at);\n };\n const landings = new Map<string, NodeId | null>();\n const landingOn = (layer: string): NodeId | null => {\n if (landings.has(layer)) return landings.get(layer)!;\n // Deepest wins; among equals, the later sibling (painted over the other).\n let best: NodeId | null = null;\n let bestDepth = -1;\n const walk = (parentId: NodeId | null, depth: number): void => {\n for (const id of parentId === null ? scene.roots : scene.childrenOf(parentId)) {\n if (excluded.has(id)) continue;\n const node = scene.get(id);\n if (!node
|
|
1
|
+
{"version":3,"file":"exits.js","names":[],"sources":["../../../../../src/interactions/actions/move/layout/exits.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport { poseDescriptorForNode } from 'core/geometry/poseDescriptor';\nimport { toPlane } from 'core/viewport/parallax';\nimport { composeWorldPose } from 'core/scene/composePose';\nimport { scenePoseAdapter } from 'core/scene/scenePoseAdapter';\nimport type { LayoutStrategy } from '../../../../layout/types';\nimport { planeOf } from '../../planeInput';\nimport type { MoveSession } from '../session';\nimport { pointInBounds } from './container';\n\n/** Where each dragged root that leaves its layout container on release lands.\n * A root leaves when the drop center falls outside the body of the layout\n * container holding it, and lands under the innermost plain container beneath\n * the drop that admits it (`canDropInto`) — a layout container there has\n * already declined it — or at the top level of its layer. A root whose parent\n * has no layout is not this pass's to move; `reparentOnDrop` decides for those. */\nexport function resolveLayoutExits(\n session: MoveSession, dropCenter: { x: number; y: number } | null, ids: Iterable<NodeId>,\n): Map<NodeId, NodeId | null> {\n const out = new Map<NodeId, NodeId | null>();\n const layoutDep = session.layout;\n const center = dropCenter;\n if (!layoutDep || !center) return out;\n const { scene, pc, projection: d } = session;\n const poseAdapter = scenePoseAdapter(scene);\n const excluded = new Set<NodeId>([...session.ids, ...session.cascadeIds]);\n const holds = (id: NodeId, layout: LayoutStrategy<unknown> | null): boolean => {\n const node = scene.get(id)!;\n const plane = planeOf(session.view, node.layer);\n const at = plane ? toPlane(plane, center) : center;\n const pose = composeWorldPose(poseAdapter, id as string, pc.compose);\n if (layout?.contains) return layout.contains(pose, at);\n const b = poseDescriptorForNode(d, node).getBounds(pose);\n return pointInBounds(b, at);\n };\n const landings = new Map<string, NodeId | null>();\n const landingOn = (layer: string): NodeId | null => {\n if (landings.has(layer)) return landings.get(layer)!;\n // Deepest wins; among equals, the later sibling (painted over the other).\n let best: NodeId | null = null;\n let bestDepth = -1;\n const walk = (parentId: NodeId | null, depth: number): void => {\n for (const id of parentId === null ? scene.roots : scene.childrenOf(parentId)) {\n if (excluded.has(id)) continue;\n const node = scene.get(id);\n if (!node) continue;\n if (node.layer === layer && depth >= bestDepth\n && layoutDep.getLayout(id as string) === null && holds(id, null) && session.admits(id)) {\n best = id;\n bestDepth = depth;\n }\n walk(id, depth + 1);\n }\n };\n walk(null, 0);\n landings.set(layer, best);\n return best;\n };\n for (const id of ids) {\n const node = scene.get(id);\n const parent = node?.parent ?? null;\n if (!node || parent === null) continue;\n const layout = layoutDep.getLayout(parent as string);\n if (!layout || holds(parent, layout)) continue;\n out.set(id, landingOn(node.layer));\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAgB,mBACd,SAAsB,YAA6C,KACvC;CAC5B,MAAM,sBAAM,IAAI,IAA2B;CAC3C,MAAM,YAAY,QAAQ;CAC1B,MAAM,SAAS;CACf,IAAI,CAAC,aAAa,CAAC,QAAQ,OAAO;CAClC,MAAM,EAAE,OAAO,IAAI,YAAY,MAAM;CACrC,MAAM,cAAc,iBAAiB,KAAK;CAC1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