@weasel-js/core 1.9.4 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +918 -0
- package/README.md +38 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +92 -84
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +71 -101
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js +50 -28
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotateCursor.js +12 -0
- package/dist/affordances/rotateCursor.js.map +1 -0
- package/dist/affordances/rotationHandle.js +44 -46
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +48 -136
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +99 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +59 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +64 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +32 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +34 -37
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +13 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +54 -47
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +44 -51
- package/dist/canvas/Canvas.js +270 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +168 -190
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +24 -25
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +33 -36
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +38 -50
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +319 -270
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +71 -62
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
- package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
- package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
- package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +46 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +49 -113
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +51 -41
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +65 -101
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +8 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +301 -708
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/SurfaceCanvas.js +40 -0
- package/dist/canvas/SurfaceCanvas.js.map +1 -0
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/adapterPickSource.js +34 -0
- package/dist/canvas/adapterPickSource.js.map +1 -0
- package/dist/canvas/affordanceAt.js +12 -2
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +56 -34
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/copiesAbove.js +27 -0
- package/dist/canvas/copiesAbove.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +25 -24
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +47 -71
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +45 -25
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +149 -104
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/layout.js +9 -15
- package/dist/canvas/deps/layout.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +69 -43
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js +33 -31
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overChildren.js +29 -0
- package/dist/canvas/overChildren.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickReach.js +23 -0
- package/dist/canvas/pickReach.js.map +1 -0
- package/dist/canvas/pickWalk.js +43 -70
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +1 -3
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +12 -12
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +59 -144
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +10 -9
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +37 -42
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/useCanvasRenderer.js +23 -11
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +51 -44
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneAdapter.js +22 -0
- package/dist/canvas/useSceneAdapter.js.map +1 -0
- package/dist/canvas/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +39 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +40 -34
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +7 -2
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-C0eADtS0.d.ts} +129 -84
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +102 -29
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +2 -4
- package/dist/core/layers/children.js.map +1 -0
- package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/create.js +2 -2
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js +19 -23
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +3 -7
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +2 -4
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
- package/dist/core/ops/reparent.js +0 -1
- package/dist/core/ops/reparent.js.map +1 -1
- package/dist/core/ops/slot.js +3 -6
- package/dist/core/ops/slot.js.map +1 -1
- package/dist/core/pages/fitViewToPage.js +15 -0
- package/dist/core/pages/fitViewToPage.js.map +1 -0
- package/dist/core/pages/pages.js +65 -0
- package/dist/core/pages/pages.js.map +1 -0
- package/dist/core/pages/pagesLayer.js +27 -0
- package/dist/core/pages/pagesLayer.js.map +1 -0
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +104 -93
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/core/scene/composePose.js +105 -0
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +42 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +122 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +16 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +67 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +4 -3
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +91 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +31 -33
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +113 -53
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +14 -11
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/core/viewport/zoomAt.js +11 -2
- package/dist/core/viewport/zoomAt.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BSKbyuvQ.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +5 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +63 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -16
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/shapeGenerator.js +89 -0
- package/dist/features/paths/shapeGenerator.js.map +1 -0
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +44 -57
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +119 -88
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewResolver.js +28 -24
- package/dist/features/viewports/viewResolver.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/icons/SliceIcon.js +24 -0
- package/dist/icons/SliceIcon.js.map +1 -0
- package/dist/index.d.ts +5200 -8777
- package/dist/index.js +284 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +24 -24
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +74 -83
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +103 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +69 -74
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
- package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
- package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/bendSegment.js +46 -0
- package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +36 -21
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +35 -40
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
- package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +18 -34
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +43 -39
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
- package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +15 -15
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/action.js +101 -0
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/preview.js +26 -0
- package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
- package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +1 -1
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/geometryProjection.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +79 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +55 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/repositionAction.js +31 -0
- package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/move/action.js +91 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +35 -28
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +108 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +47 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +17 -64
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
- package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
- package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
- package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +66 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +88 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/replay.js +47 -0
- package/dist/interactions/actions/resize/replay.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +63 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +2 -1
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +71 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/replay.js +22 -0
- package/dist/interactions/actions/rotate/replay.js.map +1 -0
- package/dist/interactions/actions/rotate/session.js +102 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/transform-again/action.js +63 -0
- package/dist/interactions/actions/transform-again/action.js.map +1 -0
- package/dist/interactions/actions/transform-again/memory.js +35 -0
- package/dist/interactions/actions/transform-again/memory.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +84 -61
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +16 -15
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +162 -164
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js +11 -14
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +15 -14
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +40 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +5 -5
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +44 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +69 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +18 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +10 -2
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-DBbbCy0i.d.ts} +103 -176
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -60
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -82
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -94
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js +0 -67
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -104
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -239
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -85
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -51
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -91
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js +0 -100
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/layout/arrivals.js +0 -36
- package/dist/layout/arrivals.js.map +0 -1
- package/dist/math-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -74
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -68
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -48
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -11
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -34
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-DM2B87-g.d.ts +0 -356
package/README.md
CHANGED
|
@@ -24,8 +24,10 @@ npm install @weasel-js/core react
|
|
|
24
24
|
|
|
25
25
|
`react` is a peer dependency (>=18).
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Import core's stylesheet once. It gives every canvas the kit renders its size
|
|
28
|
+
on the page, and styles the canvas's debug overlays (`cursorCoordsHud`,
|
|
29
|
+
`pickHud`, `modalityHud`). Without it a canvas is as large as its drawing
|
|
30
|
+
buffer, which on a high-density screen is twice the size you asked for:
|
|
29
31
|
|
|
30
32
|
```ts
|
|
31
33
|
import '@weasel-js/core/style.css';
|
|
@@ -100,6 +102,39 @@ An `Action` is a named operation — `delete`, `duplicate`, `group`, `insert`, `
|
|
|
100
102
|
|
|
101
103
|
`<SceneCanvas>` mounts a provider when none is above it and registers the kit-standard actions its `features` presets name — under `draw`, all of them: escape, select-all, delete, duplicate, group and ungroup, undo and redo, flip, nudge, reorder, align, distribute, the pathfinder booleans, path-anchor editing, fill and stroke, clipboard, and the pointer-driven move, resize, rotate, clone, area-select and lasso. `FEATURE_ACTION_IDS` lists which preset registers which, and `COMPOSITE_FEATURES` what `pick`, `transform` and `draw` abbreviate. `insert` comes with the shape tools that bind it.
|
|
102
104
|
|
|
105
|
+
### Tuning an action
|
|
106
|
+
|
|
107
|
+
`tune` changes a built-in action on one canvas without restating it. Each entry, keyed by action id, can carry:
|
|
108
|
+
|
|
109
|
+
| Field | What it does |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `params` | Params every invocation of the action starts from. Whatever a binding or a `trigger(id, params)` call passes is laid over them, so these fill in only what the call leaves out. A thunk is read on every call, so a value that changes mid-drag reaches an ongoing action the next time it reads its params. |
|
|
112
|
+
| `bindings` | Gestures added beside the action's own `defaultBinding`, each a `GestureSpec` or `{ spec, opts: { params } }`. |
|
|
113
|
+
|
|
114
|
+
A tuning applies to whichever descriptor holds the id, whether a preset or a tool registered it, and whether it registered before the tuning or after. Changing `params` never requires knowing what gesture reaches the action.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
const radius = useRef(8);
|
|
118
|
+
const tune = useMemo<ActionTunings>(() => ({
|
|
119
|
+
brushDeleteAnchors: { params: () => ({ radiusPx: radius.current }) },
|
|
120
|
+
cycleCornerStyle: { bindings: [{ kind: 'key', key: 'k' }] },
|
|
121
|
+
}), []);
|
|
122
|
+
|
|
123
|
+
<SceneCanvas scene={scene} features={['paths']} tune={tune} />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`ActionParamSchema` types `params` for the kit actions that read them (`flip`, `align.*`, `distribute.*`, `reorder.*`, `nudge.*`, `tool.activate`); any other id takes a plain record. An action of your own declares its params the way `DepSchema` takes deps:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
declare module '@weasel-js/core' {
|
|
130
|
+
interface ActionParamSchema { 'app.stamp': { size: number } }
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Pass `tune` a stable object — a module constant or a `useMemo` — since a new one re-applies every tuning. The registry underneath is `ActionsRegistry.tune(id, tuning)`, which returns its release.
|
|
135
|
+
|
|
136
|
+
### Replacing actions (`@experimental`)
|
|
137
|
+
|
|
103
138
|
```tsx
|
|
104
139
|
<SceneCanvas
|
|
105
140
|
width={W}
|
|
@@ -139,7 +174,7 @@ await registerFont('Inter', { weight: 400 }, '/fonts/Inter-400.json', '/fonts/In
|
|
|
139
174
|
|
|
140
175
|
Core doesn't ship a prebuilt atlas — bake one from a weasel checkout with `npm run gen:font -- <font.ttf> --name Inter-400 --out public/fonts` (see [`packages/font/scripts/gen-font.ts`](https://github.com/orochi235/weasel/blob/main/packages/font/scripts/gen-font.ts)) and serve the resulting `.json`/`.png` pair. `@weasel-js/hud` bundles its own Inter atlas for its widgets.
|
|
141
176
|
|
|
142
|
-
|
|
177
|
+
`registerFont` lives in `@weasel-js/font` and is re-exported from core. An unregistered family renders in the default family with a one-time warning — see that package's README for `setFontFallbackPolicy`.
|
|
143
178
|
|
|
144
179
|
## Custom shaders (`@experimental`)
|
|
145
180
|
|
package/dist/WeaselProvider.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SelectionContextProvider as i, SelectionContextProviderIfRoot as a } from "./features/selection/SelectionContext.js";
|
|
6
|
-
import { ActionsProvider as o, ActiveToolContextProvider as s, ActiveToolContextProviderIfRoot as c, DepRegistryProvider as l } from "@weasel-js/routing/react";
|
|
1
|
+
import { PointerProviderIfRoot as e } from "./canvas/SceneCanvas/PointerProviderIfRoot.js";
|
|
2
|
+
import { ActionsProviderIfRoot as t } from "./canvas/SceneCanvas/ActionsProviderIfRoot.js";
|
|
3
|
+
import { DepRegistryProviderIfRoot as n } from "./canvas/SceneCanvas/DepRegistryProviderIfRoot.js";
|
|
4
|
+
import { ActionsProvider as r, ActiveToolContextProvider as i, ActiveToolContextProviderIfRoot as a, DepRegistryProvider as o, PointerContextProvider as s, SelectionContextProvider as c, SelectionContextProviderIfRoot as l } from "@weasel-js/routing/react";
|
|
7
5
|
import { jsx as u } from "react/jsx-runtime";
|
|
8
6
|
//#region src/WeaselProvider.tsx
|
|
9
7
|
function d({ children: d, isolate: f = !1 }) {
|
|
10
|
-
return /* @__PURE__ */ u(f ?
|
|
8
|
+
return /* @__PURE__ */ u(f ? o : n, { children: /* @__PURE__ */ u(f ? r : t, { children: /* @__PURE__ */ u(f ? i : a, { children: /* @__PURE__ */ u(f ? c : l, { children: /* @__PURE__ */ u(f ? s : e, { children: d }) }) }) }) });
|
|
11
9
|
}
|
|
12
10
|
//#endregion
|
|
13
11
|
export { d as WeaselProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeaselProvider.js","names":["WeaselProvider","isolate","DepRegistryProvider","DepRegistryProviderIfRoot","ActionsProvider","ActionsProviderIfRoot","ActiveToolContextProvider","ActiveToolContextProviderIfRoot","SelectionContextProvider","SelectionContextProviderIfRoot","PointerContextProvider","PointerProviderIfRoot"],"sources":["../src/WeaselProvider.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"WeaselProvider.js","names":["WeaselProvider","isolate","DepRegistryProvider","DepRegistryProviderIfRoot","ActionsProvider","ActionsProviderIfRoot","ActiveToolContextProvider","ActiveToolContextProviderIfRoot","SelectionContextProvider","SelectionContextProviderIfRoot","PointerContextProvider","PointerProviderIfRoot"],"sources":["../src/WeaselProvider.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\nimport { DepRegistryProviderIfRoot } from './canvas/SceneCanvas/DepRegistryProviderIfRoot';\nimport { ActionsProviderIfRoot } from './canvas/SceneCanvas/ActionsProviderIfRoot';\nimport { PointerProviderIfRoot } from './canvas/SceneCanvas/PointerProviderIfRoot';\nimport { ActiveToolContextProvider, ActiveToolContextProviderIfRoot } from '@weasel-js/routing/react';\nimport {\n SelectionContextProvider,\n SelectionContextProviderIfRoot,\n} from '@weasel-js/routing/react';\nimport { DepRegistryProvider } from '@weasel-js/routing/react';\nimport { ActionsProvider } from '@weasel-js/routing/react';\nimport { PointerContextProvider } from '@weasel-js/routing/react';\n\ntype Wrapper = ComponentType<{ children: ReactNode }>;\n\n/** Props for {@link WeaselProvider}. */\nexport interface WeaselProviderProps {\n children: ReactNode;\n /**\n * Mount every provider unconditionally rather than deferring to one already\n * in scope.\n *\n * An actions registry holds one dispatcher, so a second `<SceneCanvas>`\n * joining a scope displaces the first and takes its input away. Wrap each of\n * two canvases on one page in an isolated provider. They then share\n * nothing — a toolbar outside both can drive neither.\n */\n isolate?: boolean;\n}\n\n/**\n * Mounts every kit-wide provider at once — deps, actions, active tool,\n * selection, and pointer — each only if one is not already in scope, or\n * unconditionally under `isolate`.\n *\n * `<SceneCanvas>` does this for itself, so this is for the case where kit\n * state has to be shared by things outside a canvas: a toolbar, a property\n * panel, or two canvases that should agree on the selection. Mount it above\n * any `useTools(...)` call, or the dispatcher sees a stale active tool.\n */\nexport function WeaselProvider({ children, isolate = false }: WeaselProviderProps) {\n const Deps: Wrapper = isolate ? DepRegistryProvider : DepRegistryProviderIfRoot;\n const Actions: Wrapper = isolate ? ActionsProvider : ActionsProviderIfRoot;\n const ActiveTool: Wrapper = isolate\n ? ActiveToolContextProvider\n : ActiveToolContextProviderIfRoot;\n const Selection: Wrapper = isolate\n ? SelectionContextProvider\n : SelectionContextProviderIfRoot;\n const Pointer: Wrapper = isolate ? PointerContextProvider : PointerProviderIfRoot;\n return (\n <Deps>\n <Actions>\n <ActiveTool>\n <Selection>\n <Pointer>\n {children}\n </Pointer>\n </Selection>\n </ActiveTool>\n </Actions>\n </Deps>\n );\n}\n"],"mappings":";;;;;;AAwCA,SAAgBA,EAAe,EAAE,aAAU,aAAU,MAA8B;CAUjF,OACE,kBAVoBC,IAAUC,IAAsBC,GAUpD,EAAA,UACE,kBAVqBF,IAAUG,IAAkBC,GAUjD,EAAA,UACE,kBAVsBJ,IACxBK,IACAC,GAQE,EAAA,UACE,kBARmBN,IACvBO,IACAC,GAMI,EAAA,UACE,kBANeR,IAAUS,IAAyBC,GAMlD,EACG,YACM,CAAA,EACA,CAAA,EACD,CAAA,EACL,CAAA,EACL,CAAA;AAEV"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { viewToTransform as e } from "../core/viewport/view.js";
|
|
2
2
|
import { worldToScreen as t } from "../core/viewport/viewTransform.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { PATH_L as
|
|
3
|
+
import { angleOf as n, isRigid as r, localToWorld as i, pxExtentIn as a, targetCorners as o } from "../core/geometry/targetFrame.js";
|
|
4
|
+
import { annulusSemiAxes as s, hitAffordanceRegions as c, pointRegionAnchor as l, pointRegionFrame as u, pointRegionScreenQuad as d, transformOf as f } from "./hitAffordanceRegions.js";
|
|
5
|
+
import { PATH_L as p, PATH_M as m, PATH_Z as h, boundsOfPath as g } from "@weasel-js/geom";
|
|
6
6
|
//#region src/affordances/composeAffordanceLayer.ts
|
|
7
|
-
function
|
|
7
|
+
function _(t, n, r) {
|
|
8
8
|
return {
|
|
9
9
|
id: t,
|
|
10
10
|
label: n,
|
|
11
11
|
space: "screen",
|
|
12
12
|
draw: (t, n, i) => {
|
|
13
|
-
let a =
|
|
13
|
+
let a = v(t), o = y(t), s = b(t), c = [], l = e(n);
|
|
14
14
|
for (let e of r) if (!s || s(e.id)) {
|
|
15
15
|
for (let t of e.regions(a)) {
|
|
16
|
-
let r =
|
|
17
|
-
t.paint &&
|
|
16
|
+
let r = f(a, t.targetId);
|
|
17
|
+
t.paint && C(t, r, n, a, l, c), o && x(o, e.id, t, r, n);
|
|
18
18
|
}
|
|
19
19
|
if (e.decorate) for (let t of e.decorate(a, n)) c.push(t);
|
|
20
20
|
}
|
|
21
21
|
return c;
|
|
22
22
|
},
|
|
23
|
-
hitTest: (e, t, n, i,
|
|
24
|
-
let
|
|
25
|
-
if (!
|
|
26
|
-
let l =
|
|
23
|
+
hitTest: (e, t, n, i, a, o) => {
|
|
24
|
+
let s = v(n);
|
|
25
|
+
if (!s) return null;
|
|
26
|
+
let l = c(r, e, t, s, i, o ?? b(n) ?? void 0);
|
|
27
27
|
if (!l) return null;
|
|
28
|
-
let { cursor: u, strength: d, claimedKinds: f } = l.region;
|
|
28
|
+
let { cursor: u } = l, { strength: d, claimedKinds: f } = l.region;
|
|
29
29
|
return {
|
|
30
30
|
...l.binding,
|
|
31
31
|
...u === void 0 ? {} : { cursor: u },
|
|
@@ -35,140 +35,148 @@ function m(t, n, r) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function v(e) {
|
|
39
39
|
let t = e;
|
|
40
40
|
return typeof t?.getChromeState == "function" ? t.getChromeState() : e;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function y(e) {
|
|
43
43
|
let t = e;
|
|
44
44
|
return typeof t?.getDebug == "function" ? t.getDebug() : null;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function b(e) {
|
|
47
47
|
let t = e;
|
|
48
48
|
return typeof t?.getIsVisible == "function" ? t.getIsVisible() : null;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function x(e, t, n, r, i) {
|
|
51
51
|
if (n.shape.kind === "point") {
|
|
52
|
-
let
|
|
52
|
+
let a = u(n.shape, r, i), o = d(n.shape, r, i, (e, t) => [e, t]);
|
|
53
53
|
e.recordHitbox(t, "handle", {
|
|
54
54
|
kind: "polygon",
|
|
55
|
-
points:
|
|
56
|
-
x:
|
|
57
|
-
y:
|
|
55
|
+
points: o.map((e) => ({
|
|
56
|
+
x: a.x + (e.x - a.x) / i.scale.x,
|
|
57
|
+
y: a.y + (e.y - a.y) / i.scale.y
|
|
58
58
|
}))
|
|
59
59
|
});
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (n.shape.kind === "annulus") {
|
|
63
|
-
let
|
|
63
|
+
let a = n.shape, { rx: o, ry: c } = s(a, i, r);
|
|
64
|
+
S(e, t, r, {
|
|
65
|
+
x: a.cx - o,
|
|
66
|
+
y: a.cy - c,
|
|
67
|
+
width: 2 * o,
|
|
68
|
+
height: 2 * c
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
S(e, t, r, n.shape.kind === "outline" ? g(n.shape.path) : n.shape);
|
|
73
|
+
}
|
|
74
|
+
function S(e, t, a, s) {
|
|
75
|
+
if (!r(a)) {
|
|
64
76
|
e.recordHitbox(t, "handle", {
|
|
65
|
-
kind: "
|
|
66
|
-
|
|
67
|
-
y: d.y - u,
|
|
68
|
-
width: 2 * l,
|
|
69
|
-
height: 2 * u,
|
|
70
|
-
...a.identity ? {} : { rotation: Math.atan2(a.sin, a.cos) }
|
|
77
|
+
kind: "polygon",
|
|
78
|
+
points: o(s, a)
|
|
71
79
|
});
|
|
72
80
|
return;
|
|
73
81
|
}
|
|
74
|
-
let
|
|
82
|
+
let c = i(a, s.x + s.width / 2, s.y + s.height / 2);
|
|
75
83
|
e.recordHitbox(t, "handle", {
|
|
76
84
|
kind: "rect",
|
|
77
|
-
x:
|
|
78
|
-
y:
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
81
|
-
...a.identity ? {} : { rotation:
|
|
85
|
+
x: c.x - s.width / 2,
|
|
86
|
+
y: c.y - s.height / 2,
|
|
87
|
+
width: s.width,
|
|
88
|
+
height: s.height,
|
|
89
|
+
...a.identity ? {} : { rotation: n(a) }
|
|
82
90
|
});
|
|
83
91
|
}
|
|
84
|
-
function
|
|
85
|
-
let
|
|
86
|
-
if (
|
|
92
|
+
function C(e, n, r, i, o, c) {
|
|
93
|
+
let l = e.paint;
|
|
94
|
+
if (l.kind === "square") {
|
|
87
95
|
if (e.shape.kind !== "point") return;
|
|
88
|
-
let
|
|
89
|
-
if (
|
|
90
|
-
|
|
96
|
+
let i = u(e.shape, n, r), [a, s] = t(i.x, i.y, o), d = l.sizePx / 2, f = l.fill ? { fill: l.fill } : {}, g = l.stroke ? { stroke: l.stroke } : {};
|
|
97
|
+
if (i.angle === 0) {
|
|
98
|
+
c.push({
|
|
91
99
|
kind: "path",
|
|
92
100
|
path: {
|
|
93
101
|
kind: "rect",
|
|
94
|
-
x:
|
|
95
|
-
y:
|
|
96
|
-
width:
|
|
97
|
-
height:
|
|
102
|
+
x: a - d,
|
|
103
|
+
y: s - d,
|
|
104
|
+
width: l.sizePx,
|
|
105
|
+
height: l.sizePx
|
|
98
106
|
},
|
|
99
|
-
...
|
|
107
|
+
...f,
|
|
100
108
|
...g
|
|
101
109
|
});
|
|
102
110
|
return;
|
|
103
111
|
}
|
|
104
|
-
let _ = Math.cos(
|
|
112
|
+
let _ = Math.cos(i.angle) * d, v = Math.sin(i.angle) * d, y = /* @__PURE__ */ new Float32Array(8);
|
|
105
113
|
[
|
|
106
114
|
[-1, -1],
|
|
107
115
|
[1, -1],
|
|
108
116
|
[1, 1],
|
|
109
117
|
[-1, 1]
|
|
110
118
|
].forEach(([e, t], n) => {
|
|
111
|
-
y[n * 2] =
|
|
112
|
-
}),
|
|
119
|
+
y[n * 2] = a + _ * e - v * t, y[n * 2 + 1] = s + v * e + _ * t;
|
|
120
|
+
}), c.push({
|
|
113
121
|
kind: "path",
|
|
114
122
|
path: {
|
|
115
123
|
kind: "polygon",
|
|
116
124
|
commands: new Uint8Array([
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
m,
|
|
126
|
+
p,
|
|
127
|
+
p,
|
|
128
|
+
p,
|
|
129
|
+
h
|
|
122
130
|
]),
|
|
123
131
|
coords: y,
|
|
124
132
|
fillRule: "nonzero"
|
|
125
133
|
},
|
|
126
|
-
...
|
|
134
|
+
...f,
|
|
127
135
|
...g
|
|
128
136
|
});
|
|
129
137
|
return;
|
|
130
138
|
}
|
|
131
|
-
if (
|
|
139
|
+
if (l.kind === "annulus") {
|
|
132
140
|
if (e.shape.kind !== "annulus") return;
|
|
133
|
-
let t = e.shape,
|
|
134
|
-
|
|
141
|
+
let t = e.shape, i = a(l.insetPx ?? 0, r.scale, n), u = w(t, s(t, r, n), i, n, o, l.fill, l.stroke);
|
|
142
|
+
u && c.push(u);
|
|
135
143
|
return;
|
|
136
144
|
}
|
|
137
|
-
if (
|
|
145
|
+
if (l.kind === "custom") {
|
|
138
146
|
let t = {
|
|
139
|
-
world:
|
|
147
|
+
world: T(e, n, r),
|
|
140
148
|
local: e.shape,
|
|
141
|
-
view:
|
|
142
|
-
state:
|
|
149
|
+
view: r,
|
|
150
|
+
state: i
|
|
143
151
|
};
|
|
144
|
-
for (let e of
|
|
152
|
+
for (let e of l.draw(t)) c.push(e);
|
|
145
153
|
return;
|
|
146
154
|
}
|
|
147
155
|
}
|
|
148
|
-
function
|
|
156
|
+
function w(e, n, r, a, o, s, c) {
|
|
149
157
|
let l = n.rx - r.x, u = n.ry - r.y;
|
|
150
158
|
if (l <= 0 || u <= 0) return null;
|
|
151
|
-
let
|
|
159
|
+
let d = e.cx, f = e.cy, g = e.innerWidth / 2 + r.x, _ = e.innerHeight / 2 + r.y, v = _ < u, y = g < l;
|
|
152
160
|
if (!v && !y) return null;
|
|
153
161
|
let b = v ? l * Math.sqrt(1 - (_ / u) ** 2) : 0, x = y ? u * Math.sqrt(1 - (g / l) ** 2) : 0, S = [], C = [];
|
|
154
162
|
function w(e, t) {
|
|
155
|
-
S.push(
|
|
156
|
-
x:
|
|
157
|
-
y:
|
|
163
|
+
S.push(m), C.push({
|
|
164
|
+
x: d + l * Math.cos(e),
|
|
165
|
+
y: f + u * Math.sin(e)
|
|
158
166
|
});
|
|
159
167
|
for (let n = 1; n <= 24; n++) {
|
|
160
168
|
let r = e + (t - e) * (n / 24);
|
|
161
|
-
S.push(
|
|
162
|
-
x:
|
|
163
|
-
y:
|
|
169
|
+
S.push(p), C.push({
|
|
170
|
+
x: d + l * Math.cos(r),
|
|
171
|
+
y: f + u * Math.sin(r)
|
|
164
172
|
});
|
|
165
173
|
}
|
|
166
|
-
S.push(
|
|
174
|
+
S.push(h);
|
|
167
175
|
}
|
|
168
176
|
v && (w(Math.atan2(-_ / u, b / l), Math.atan2(-_ / u, -b / l)), w(Math.atan2(_ / u, b / l), Math.atan2(_ / u, -b / l))), y && (w(Math.atan2(-x / u, g / l), Math.atan2(x / u, g / l)), w(Math.atan2(-x / u, -g / l), Math.atan2(x / u, -g / l) - 2 * Math.PI));
|
|
169
177
|
let T = new Float32Array(C.length * 2);
|
|
170
178
|
for (let e = 0; e < C.length; e++) {
|
|
171
|
-
let n =
|
|
179
|
+
let n = i(a, C[e].x, C[e].y), [r, s] = t(n.x, n.y, o);
|
|
172
180
|
T[e * 2] = r, T[e * 2 + 1] = s;
|
|
173
181
|
}
|
|
174
182
|
return {
|
|
@@ -183,32 +191,32 @@ function b(e, n, r, i, a, s, c) {
|
|
|
183
191
|
...c ? { stroke: c } : {}
|
|
184
192
|
};
|
|
185
193
|
}
|
|
186
|
-
function
|
|
194
|
+
function T(e, t, n) {
|
|
187
195
|
if (e.shape.kind === "point") {
|
|
188
|
-
let r =
|
|
196
|
+
let r = l(e.shape, t, n);
|
|
189
197
|
return {
|
|
190
198
|
x: r.x,
|
|
191
199
|
y: r.y
|
|
192
200
|
};
|
|
193
201
|
}
|
|
194
202
|
if (e.shape.kind === "annulus") {
|
|
195
|
-
let
|
|
203
|
+
let r = e.shape, { rx: a, ry: o } = s(r, n, t), c = i(t, r.cx, r.cy), [l, u, d, f] = t.toWorld, p = Math.hypot(a * l, o * d), m = Math.hypot(a * u, o * f);
|
|
196
204
|
return {
|
|
197
|
-
x:
|
|
198
|
-
y:
|
|
199
|
-
width: 2 *
|
|
200
|
-
height: 2 *
|
|
205
|
+
x: c.x - p,
|
|
206
|
+
y: c.y - m,
|
|
207
|
+
width: 2 * p,
|
|
208
|
+
height: 2 * m
|
|
201
209
|
};
|
|
202
210
|
}
|
|
203
|
-
let
|
|
211
|
+
let r = e.shape.kind === "outline" ? g(e.shape.path) : e.shape, a = i(t, r.x, r.y), o = i(t, r.x + r.width, r.y), c = i(t, r.x, r.y + r.height), u = i(t, r.x + r.width, r.y + r.height), d = Math.min(a.x, o.x, c.x, u.x), f = Math.min(a.y, o.y, c.y, u.y), p = Math.max(a.x, o.x, c.x, u.x), m = Math.max(a.y, o.y, c.y, u.y);
|
|
204
212
|
return {
|
|
205
|
-
x:
|
|
206
|
-
y:
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
213
|
+
x: d,
|
|
214
|
+
y: f,
|
|
215
|
+
width: p - d,
|
|
216
|
+
height: m - f
|
|
209
217
|
};
|
|
210
218
|
}
|
|
211
219
|
//#endregion
|
|
212
|
-
export {
|
|
220
|
+
export { _ as composeAffordanceLayer };
|
|
213
221
|
|
|
214
222
|
//# sourceMappingURL=composeAffordanceLayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeAffordanceLayer.js","names":["composeAffordanceLayer","state","asChromeState","data","debug","asDebugSink","isVisible","asIsVisible","out","t","viewToTransform","view","a","affordances","region","xf","transformOf","paintRegion","recordRegionHitbox","cmd","hit","hitAffordanceRegions","wx","wy","cursor","strength","claimedKinds","maybe","f","pointRegionFrame","quad","pointRegionScreenQuad","x","y","affordanceId","q","s","annulusSemiAxes","angleOf","c","localToWorld","rx","ry","r","w","paint","sx","sy","worldToScreen","viewT","half","fill","stroke","sn","coords","u","v","i","PATH_M","PATH_L","PATH_Z","insetLocal","pxExtent","annulusCommand","ctx","worldOf","semiAxes","cx","shape","cy","rectHW","rectHH","haveTopBottom","haveLeftRight","xT","yR","cmds","localPts","appendPetal","t0","t1","pointRegionAnchor","hw","hh","b","minX","minY","maxX","maxY"],"sources":["../../src/affordances/composeAffordanceLayer.ts"],"sourcesContent":["import type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '../renderer';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { pxExtent } from 'core/viewport/pxExtent';\nimport type { DebugSink } from '../debug/types';\nimport type { CommandFill, CommandStroke } from '@weasel-js/paint';\nimport { PATH_M, PATH_L, PATH_Z } from '@weasel-js/geom';\nimport {\n angleOf,\n annulusSemiAxes,\n hitAffordanceRegions,\n localToWorld,\n pointRegionAnchor,\n pointRegionFrame,\n pointRegionScreenQuad,\n transformOf,\n type TargetTransform,\n} from './hitAffordanceRegions';\nimport type {\n Affordance,\n AffordanceRegion,\n CustomPaintContext,\n LayerHit,\n} from './types';\n\n/**\n * @experimental\n * Bundle a list of Affordances into a single RenderLayer.\n *\n * Each affordance declares interactive regions in target-local coordinates;\n * this layer composes each target's bounds transform (rotation around the\n * AABB center, when present) once per region for both paint and hit-test.\n *\n * FillStyle order matches array order (first → last = bottom → top). Hit-test\n * walks affordances in reverse (top → bottom) and stops at the first that\n * claims the point; within it the nearest region wins (see\n * `hitAffordanceRegions`).\n *\n * `decorate(state, view)` runs *after* a given affordance's regions for\n * paint only — useful for leader lines and other purely-visual chrome that\n * don't fit the region model.\n */\nexport function composeAffordanceLayer(\n id: string,\n label: string,\n affordances: readonly Affordance[],\n): RenderLayer<ChromeState> & {\n hitTest(\n wx: number,\n wy: number,\n state: unknown,\n view: View,\n dims: { width: number; height: number },\n isVisible?: (id: string) => boolean,\n ): LayerHit | null;\n} {\n return {\n id,\n label,\n space: 'screen',\n draw: (data, view, _dims): DrawCommand[] => {\n const state = asChromeState(data);\n const debug = asDebugSink(data);\n const isVisible = asIsVisible(data);\n const out: DrawCommand[] = [];\n const t = viewToTransform(view);\n for (const a of affordances) {\n if (isVisible && !isVisible(a.id)) continue;\n for (const region of a.regions(state)) {\n const xf = transformOf(state, region.targetId);\n if (region.paint) paintRegion(region, xf, view, state, t, out);\n if (debug) recordRegionHitbox(debug, a.id, region, xf, view);\n }\n if (a.decorate) {\n for (const cmd of a.decorate(state, view)) out.push(cmd);\n }\n }\n return out;\n },\n // The walk itself lives in `hitAffordanceRegions` so this layer and\n // `buildAffordanceAt` share one implementation rather than two that can\n // drift. This wrapper lifts the region's declared cursor and claim onto\n // the binding, the way `buildAffordanceAt` lifts them onto `AffordanceHit`.\n hitTest: (wx, wy, data, view, _dims, isVisible): LayerHit | null => {\n const state = asChromeState(data);\n if (!state) return null;\n const hit = hitAffordanceRegions(\n affordances, wx, wy, state, view, isVisible ?? asIsVisible(data) ?? undefined,\n );\n if (!hit) return null;\n const { cursor, strength, claimedKinds } = hit.region;\n return {\n ...hit.binding,\n ...(cursor !== undefined ? { cursor } : {}),\n ...(strength !== undefined ? { strength } : {}),\n ...(claimedKinds !== undefined ? { claimedKinds } : {}),\n };\n },\n };\n}\n\n// ─── Data unwrappers ────────────────────────────────────────────────────────\n\n// `draw` is called by Canvas with `CanvasHelpers` and by tests with a bare\n// `ChromeState`. Tests stay terse this way, and production gets the live\n// debug sink via the same channel.\nfunction asChromeState(data: unknown): ChromeState {\n const maybe = data as { getChromeState?: () => ChromeState };\n if (typeof maybe?.getChromeState === 'function') return maybe.getChromeState();\n return data as ChromeState;\n}\n\nfunction asDebugSink(data: unknown): DebugSink | null {\n const maybe = data as { getDebug?: () => DebugSink | null };\n if (typeof maybe?.getDebug === 'function') return maybe.getDebug();\n return null;\n}\n\n/** Pull a chrome-caps visibility predicate off the data envelope when\n * present. When absent (legacy callers / tests passing bare state),\n * every affordance renders — preserves pre-chrome-caps behavior. */\nfunction asIsVisible(data: unknown): ((id: string) => boolean) | null {\n const maybe = data as { getIsVisible?: () => (id: string) => boolean };\n if (typeof maybe?.getIsVisible === 'function') return maybe.getIsVisible();\n return null;\n}\n\nfunction recordRegionHitbox(\n debug: DebugSink,\n affordanceId: string,\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n): void {\n if (region.shape.kind === 'point') {\n // The hit square is a square on *screen* — turned with the target when the\n // region asks — so in world it is a parallelogram, recorded as one.\n const f = pointRegionFrame(region.shape, xf, view);\n const quad = pointRegionScreenQuad(region.shape, xf, view, (x, y) => [x, y]);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'polygon',\n points: quad.map((q) => ({\n x: f.x + (q.x - f.x) / view.scale.x,\n y: f.y + (q.y - f.y) / view.scale.y,\n })),\n });\n return;\n }\n if (region.shape.kind === 'annulus') {\n // Approximate the annulus visualization as the outer ellipse's AABB.\n // The DebugSink's hitbox primitives don't model ring shapes; the\n // always-visible dev paint (`paint.kind === 'annulus'`) draws the\n // actual ring. Consumers that want a precise debug overlay can match\n // against the affordance id and render the annulus themselves.\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n const c = localToWorld(xf, s.cx, s.cy);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: c.x - rx,\n y: c.y - ry,\n width: 2 * rx,\n height: 2 * ry,\n ...(xf.identity ? {} : { rotation: Math.atan2(xf.sin, xf.cos) }),\n });\n return;\n }\n // rect: axis-aligned in local frame; apply target rotation around the\n // AABB pivot when present.\n const r = region.shape;\n const w = localToWorld(xf, r.x + r.width / 2, r.y + r.height / 2);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: w.x - r.width / 2,\n y: w.y - r.height / 2,\n width: r.width,\n height: r.height,\n ...(xf.identity ? {} : { rotation: Math.atan2(xf.sin, xf.cos) }),\n });\n}\n\n// ─── FillStyle ──────────────────────────────────────────────────────────────────\n\nfunction paintRegion(\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n state: ChromeState,\n viewT: ReturnType<typeof viewToTransform>,\n out: DrawCommand[],\n): void {\n const paint = region.paint!;\n if (paint.kind === 'square') {\n if (region.shape.kind !== 'point') {\n // 'square' only makes sense over a point shape. Silently skip — a\n // future paint variant can cover rect outlines.\n return;\n }\n // Same frame the hit-test reads, at the paint's own size.\n const f = pointRegionFrame(region.shape, xf, view);\n const [sx, sy] = worldToScreen(f.x, f.y, viewT);\n const half = paint.sizePx / 2;\n const fill = paint.fill ? { fill: paint.fill } : {};\n const stroke = paint.stroke ? { stroke: paint.stroke } : {};\n if (f.angle === 0) {\n out.push({\n kind: 'path',\n path: { kind: 'rect', x: sx - half, y: sy - half, width: paint.sizePx, height: paint.sizePx },\n ...fill, ...stroke,\n });\n return;\n }\n const c = Math.cos(f.angle) * half, sn = Math.sin(f.angle) * half;\n const coords = new Float32Array(8);\n [[-1, -1], [1, -1], [1, 1], [-1, 1]].forEach(([u, v], i) => {\n coords[i * 2] = sx + c * u - sn * v;\n coords[i * 2 + 1] = sy + sn * u + c * v;\n });\n out.push({\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]), coords, fillRule: 'nonzero' },\n ...fill, ...stroke,\n });\n return;\n }\n if (paint.kind === 'annulus') {\n if (region.shape.kind !== 'annulus') return; // type mismatch — silent skip\n const s = region.shape;\n // Convert the screen-px inset to target-local units so it visually\n // matches at any zoom. `localToWorld` is rotation+translation (no\n // scale), so target-local units equal world units for ring math.\n const insetLocal = pxExtent(paint.insetPx ?? 0, view.scale, angleOf(xf));\n // Same `minBandPx` clamp the hit-test applies, so the ring you can see is\n // the ring you can grab.\n const cmd = annulusCommand(s, annulusSemiAxes(s, view, angleOf(xf)), insetLocal, xf, viewT, paint.fill, paint.stroke);\n if (cmd) out.push(cmd);\n return;\n }\n if (paint.kind === 'custom') {\n const ctx: CustomPaintContext = {\n world: worldOf(region, xf, view),\n local: region.shape,\n view,\n state,\n };\n for (const cmd of paint.draw(ctx)) out.push(cmd);\n return;\n }\n}\n\n/** Build a screen-space DrawCommand for an annulus region: the area\n * inside the (contracted) outer ellipse but outside the (expanded)\n * inner rect. Renders as four disjoint petal subpaths — one per rect\n * edge — so the visible fill is true `ellipse \\ rect`. A naive\n * ellipse + rect even-odd path would also fill the rect's corner\n * triangles where they poke past the contracted ellipse. Returns null\n * when the band collapses on both axes. */\nfunction annulusCommand(\n shape: Extract<AffordanceRegion['shape'], { kind: 'annulus' }>,\n semiAxes: { rx: number; ry: number },\n insetLocal: { x: number; y: number },\n xf: TargetTransform,\n viewT: ReturnType<typeof viewToTransform>,\n fill: CommandFill | undefined,\n stroke: CommandStroke | undefined,\n): DrawCommand | null {\n const rx = semiAxes.rx - insetLocal.x;\n const ry = semiAxes.ry - insetLocal.y;\n if (rx <= 0 || ry <= 0) return null;\n const cx = shape.cx;\n const cy = shape.cy;\n // Expanded inner rect (still in target-local coords).\n const rectHW = shape.innerWidth / 2 + insetLocal.x;\n const rectHH = shape.innerHeight / 2 + insetLocal.y;\n // Each petal exists only when the corresponding rect edge actually\n // intersects the ellipse interior — otherwise the rect already\n // extends past the ellipse on that axis and there's no band to show.\n const haveTopBottom = rectHH < ry;\n const haveLeftRight = rectHW < rx;\n if (!haveTopBottom && !haveLeftRight) return null;\n const xT = haveTopBottom ? rx * Math.sqrt(1 - (rectHH / ry) ** 2) : 0;\n const yR = haveLeftRight ? ry * Math.sqrt(1 - (rectHW / rx) ** 2) : 0;\n\n // Sampling density per petal arc — line segments are visually clean\n // for the rotate-band band thickness and avoid the cubic-Bézier\n // sub-arc bookkeeping. 24 is smooth at typical zooms.\n const SAMPLES = 24;\n const cmds: number[] = [];\n const localPts: { x: number; y: number }[] = [];\n\n function appendPetal(t0: number, t1: number): void {\n cmds.push(PATH_M);\n localPts.push({ x: cx + rx * Math.cos(t0), y: cy + ry * Math.sin(t0) });\n for (let i = 1; i <= SAMPLES; i++) {\n const t = t0 + (t1 - t0) * (i / SAMPLES);\n cmds.push(PATH_L);\n localPts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });\n }\n // PATH_Z closes back to the move-to point along the rect edge — both\n // endpoints share the rect-edge coord by construction, so the\n // closing segment IS the chord.\n cmds.push(PATH_Z);\n }\n\n if (haveTopBottom) {\n // Top petal: y < cy. Arc from right endpoint over t = -π/2 to left.\n appendPetal(\n Math.atan2(-rectHH / ry, xT / rx), // in (-π/2, 0)\n Math.atan2(-rectHH / ry, -xT / rx), // in (-π, -π/2), decreasing through -π/2\n );\n // Bottom petal: y > cy. Arc through t = +π/2.\n appendPetal(\n Math.atan2(rectHH / ry, xT / rx), // in (0, π/2)\n Math.atan2(rectHH / ry, -xT / rx), // in (π/2, π), increasing through π/2\n );\n }\n if (haveLeftRight) {\n // Right petal: x > cx. Arc through t = 0.\n appendPetal(\n Math.atan2(-yR / ry, rectHW / rx), // in (-π/2, 0)\n Math.atan2(yR / ry, rectHW / rx), // in (0, π/2)\n );\n // Left petal: x < cx. Arc through t = ±π. Shift the end angle by\n // -2π so the parametric trace passes through the leftmost point\n // monotonically instead of crossing the right side.\n appendPetal(\n Math.atan2(-yR / ry, -rectHW / rx), // in (-π, -π/2)\n Math.atan2(yR / ry, -rectHW / rx) - 2 * Math.PI, // in (-3π/2, -π), decreasing through -π\n );\n }\n\n const coords = new Float32Array(localPts.length * 2);\n for (let i = 0; i < localPts.length; i++) {\n const w = localToWorld(xf, localPts[i].x, localPts[i].y);\n const [sx, sy] = worldToScreen(w.x, w.y, viewT);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n }\n return {\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array(cmds), coords, fillRule: 'nonzero' },\n ...(fill ? { fill } : {}),\n ...(stroke ? { stroke } : {}),\n };\n}\n\nfunction worldOf(region: AffordanceRegion, xf: TargetTransform, view: View): CustomPaintContext['world'] {\n if (region.shape.kind === 'point') {\n const w = pointRegionAnchor(region.shape, xf, view);\n return { x: w.x, y: w.y };\n }\n if (region.shape.kind === 'annulus') {\n // The outer ellipse's bounding box in world coords. Turned by θ, its\n // half-extents are √(rx²cos²θ + ry²sin²θ) and √(rx²sin²θ + ry²cos²θ).\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n const c = localToWorld(xf, s.cx, s.cy);\n const hw = Math.hypot(rx * xf.cos, ry * xf.sin);\n const hh = Math.hypot(rx * xf.sin, ry * xf.cos);\n return { x: c.x - hw, y: c.y - hh, width: 2 * hw, height: 2 * hh };\n }\n // Rect: map the rect's origin and far corner; width/height under rotation\n // describe the AABB of the rotated rect, which is what custom-paint\n // consumers most often want. Affordances needing exact rotated geometry\n // can read `local` + reapply rotation themselves via `view`/`state`.\n const r = region.shape;\n const a = localToWorld(xf, r.x, r.y);\n const b = localToWorld(xf, r.x + r.width, r.y);\n const c = localToWorld(xf, r.x, r.y + r.height);\n const d = localToWorld(xf, r.x + r.width, r.y + r.height);\n const minX = Math.min(a.x, b.x, c.x, d.x);\n const minY = Math.min(a.y, b.y, c.y, d.y);\n const maxX = Math.max(a.x, b.x, c.x, d.x);\n const maxY = Math.max(a.y, b.y, c.y, d.y);\n return { x: minX, y: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,GAC/B8C,IAAK,KAAK,MAAMzC,IAAK1B,EAAG,KAAK2B,IAAK3B,EAAG,GAAG,GACxCoE,IAAK,KAAK,MAAM1C,IAAK1B,EAAG,KAAK2B,IAAK3B,EAAG,GAAG;EAC9C,OAAO;GAAE,GAAGwB,EAAE,IAAI2C;GAAI,GAAG3C,EAAE,IAAI4C;GAAI,OAAO,IAAID;GAAI,QAAQ,IAAIC;EAAG;CACnE;CAKA,IAAMxC,IAAI7B,EAAO,OACXF,IAAI4B,EAAazB,GAAI4B,EAAE,GAAGA,EAAE,CAAC,GAC7ByC,IAAI5C,EAAazB,GAAI4B,EAAE,IAAIA,EAAE,OAAOA,EAAE,CAAC,GACvCJ,IAAIC,EAAazB,GAAI4B,EAAE,GAAGA,EAAE,IAAIA,EAAE,MAAM,GACxC,IAAIH,EAAazB,GAAI4B,EAAE,IAAIA,EAAE,OAAOA,EAAE,IAAIA,EAAE,MAAM,GAClD0C,IAAO,KAAK,IAAIzE,EAAE,GAAGwE,EAAE,GAAG7C,EAAE,GAAG,EAAE,CAAC,GAClC+C,IAAO,KAAK,IAAI1E,EAAE,GAAGwE,EAAE,GAAG7C,EAAE,GAAG,EAAE,CAAC,GAClCgD,IAAO,KAAK,IAAI3E,EAAE,GAAGwE,EAAE,GAAG7C,EAAE,GAAG,EAAE,CAAC,GAClCiD,IAAO,KAAK,IAAI5E,EAAE,GAAGwE,EAAE,GAAG7C,EAAE,GAAG,EAAE,CAAC;CACxC,OAAO;EAAE,GAAG8C;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK;AACrE"}
|
|
1
|
+
{"version":3,"file":"composeAffordanceLayer.js","names":["composeAffordanceLayer","state","asChromeState","data","debug","asDebugSink","isVisible","asIsVisible","out","t","viewToTransform","view","a","affordances","region","xf","transformOf","paintRegion","recordRegionHitbox","cmd","hit","hitAffordanceRegions","wx","wy","cursor","strength","claimedKinds","maybe","f","pointRegionFrame","quad","pointRegionScreenQuad","x","y","affordanceId","q","s","annulusSemiAxes","rx","ry","boundsOfPath","recordLocalRect","isRigid","targetCorners","r","w","localToWorld","angleOf","paint","sx","sy","worldToScreen","viewT","half","fill","stroke","c","sn","coords","u","v","i","PATH_M","PATH_L","PATH_Z","insetLocal","pxExtentIn","annulusCommand","ctx","worldOf","semiAxes","cx","shape","cy","rectHW","rectHH","haveTopBottom","haveLeftRight","xT","yR","cmds","localPts","appendPetal","t0","t1","pointRegionAnchor","ma","mb","mc","md","hw","hh","b","d","minX","minY","maxX","maxY"],"sources":["../../src/affordances/composeAffordanceLayer.ts"],"sourcesContent":["import type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '@weasel-js/renderer';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { isRigid, pxExtentIn, targetCorners } from 'core/geometry/targetFrame';\nimport type { DebugSink } from '../debug/types';\nimport type { CommandFill, CommandStroke } from '@weasel-js/paint';\nimport { boundsOfPath, PATH_M, PATH_L, PATH_Z } from '@weasel-js/geom';\nimport {\n angleOf,\n annulusSemiAxes,\n hitAffordanceRegions,\n localToWorld,\n pointRegionAnchor,\n pointRegionFrame,\n pointRegionScreenQuad,\n transformOf,\n type TargetTransform,\n} from './hitAffordanceRegions';\nimport type {\n Affordance,\n AffordanceRegion,\n CustomPaintContext,\n LayerHit,\n} from './types';\n\n/**\n * @experimental\n * Bundle a list of Affordances into a single RenderLayer.\n *\n * Paint order matches array order (first → last = bottom → top). Hit-test walks affordances in\n * reverse and stops at the first that claims the point; within it the nearest region wins.\n *\n * `decorate(state, view)` runs *after* a given affordance's regions, for paint only.\n */\nexport function composeAffordanceLayer(\n id: string,\n label: string,\n affordances: readonly Affordance[],\n): RenderLayer<ChromeState> & {\n hitTest(\n wx: number,\n wy: number,\n state: unknown,\n view: View,\n dims: { width: number; height: number },\n isVisible?: (id: string) => boolean,\n ): LayerHit | null;\n} {\n return {\n id,\n label,\n space: 'screen',\n draw: (data, view, _dims): DrawCommand[] => {\n const state = asChromeState(data);\n const debug = asDebugSink(data);\n const isVisible = asIsVisible(data);\n const out: DrawCommand[] = [];\n const t = viewToTransform(view);\n for (const a of affordances) {\n if (isVisible && !isVisible(a.id)) continue;\n for (const region of a.regions(state)) {\n const xf = transformOf(state, region.targetId);\n if (region.paint) paintRegion(region, xf, view, state, t, out);\n if (debug) recordRegionHitbox(debug, a.id, region, xf, view);\n }\n if (a.decorate) {\n for (const cmd of a.decorate(state, view)) out.push(cmd);\n }\n }\n return out;\n },\n // The walk lives in `hitAffordanceRegions` so this layer and `buildAffordanceAt` share one\n // implementation. This wrapper lifts the region's declared cursor and claim onto the binding.\n hitTest: (wx, wy, data, view, _dims, isVisible): LayerHit | null => {\n const state = asChromeState(data);\n if (!state) return null;\n const hit = hitAffordanceRegions(\n affordances, wx, wy, state, view, isVisible ?? asIsVisible(data) ?? undefined,\n );\n if (!hit) return null;\n const { cursor } = hit;\n const { strength, claimedKinds } = hit.region;\n return {\n ...hit.binding,\n ...(cursor !== undefined ? { cursor } : {}),\n ...(strength !== undefined ? { strength } : {}),\n ...(claimedKinds !== undefined ? { claimedKinds } : {}),\n };\n },\n };\n}\n\n// `draw` is called by Canvas with `CanvasHelpers` and by tests with a bare `ChromeState`.\nfunction asChromeState(data: unknown): ChromeState {\n const maybe = data as { getChromeState?: () => ChromeState };\n if (typeof maybe?.getChromeState === 'function') return maybe.getChromeState();\n return data as ChromeState;\n}\n\nfunction asDebugSink(data: unknown): DebugSink | null {\n const maybe = data as { getDebug?: () => DebugSink | null };\n if (typeof maybe?.getDebug === 'function') return maybe.getDebug();\n return null;\n}\n\n/** The chrome-caps visibility predicate off the data envelope. When absent (tests passing\n * bare state), every affordance renders. */\nfunction asIsVisible(data: unknown): ((id: string) => boolean) | null {\n const maybe = data as { getIsVisible?: () => (id: string) => boolean };\n if (typeof maybe?.getIsVisible === 'function') return maybe.getIsVisible();\n return null;\n}\n\nfunction recordRegionHitbox(\n debug: DebugSink,\n affordanceId: string,\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n): void {\n if (region.shape.kind === 'point') {\n // The hit square is a square on *screen* — turned with the target when the\n // region asks — so in world it is a parallelogram, recorded as one.\n const f = pointRegionFrame(region.shape, xf, view);\n const quad = pointRegionScreenQuad(region.shape, xf, view, (x, y) => [x, y]);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'polygon',\n points: quad.map((q) => ({\n x: f.x + (q.x - f.x) / view.scale.x,\n y: f.y + (q.y - f.y) / view.scale.y,\n })),\n });\n return;\n }\n if (region.shape.kind === 'annulus') {\n // Approximated as the outer ellipse's AABB: the DebugSink's hitbox primitives don't\n // model ring shapes.\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, xf);\n recordLocalRect(debug, affordanceId, xf, { x: s.cx - rx, y: s.cy - ry, width: 2 * rx, height: 2 * ry });\n return;\n }\n const box = region.shape.kind === 'outline' ? boundsOfPath(region.shape.path) : region.shape;\n recordLocalRect(debug, affordanceId, xf, box);\n}\n\n/** A rect of the target's own frame as a debug hitbox: the unturned box plus\n * the rotation while the frame only turns it, and the quad it lands on once\n * the frame skews or stretches it. */\nfunction recordLocalRect(\n debug: DebugSink,\n affordanceId: string,\n xf: TargetTransform,\n r: { x: number; y: number; width: number; height: number },\n): void {\n if (!isRigid(xf)) {\n debug.recordHitbox(affordanceId, 'handle', { kind: 'polygon', points: targetCorners(r, xf) });\n return;\n }\n const w = localToWorld(xf, r.x + r.width / 2, r.y + r.height / 2);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: w.x - r.width / 2,\n y: w.y - r.height / 2,\n width: r.width,\n height: r.height,\n ...(xf.identity ? {} : { rotation: angleOf(xf) }),\n });\n}\n\nfunction paintRegion(\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n state: ChromeState,\n viewT: ReturnType<typeof viewToTransform>,\n out: DrawCommand[],\n): void {\n const paint = region.paint!;\n if (paint.kind === 'square') {\n if (region.shape.kind !== 'point') {\n // 'square' only makes sense over a point shape.\n return;\n }\n // Same frame the hit-test reads, at the paint's own size.\n const f = pointRegionFrame(region.shape, xf, view);\n const [sx, sy] = worldToScreen(f.x, f.y, viewT);\n const half = paint.sizePx / 2;\n const fill = paint.fill ? { fill: paint.fill } : {};\n const stroke = paint.stroke ? { stroke: paint.stroke } : {};\n if (f.angle === 0) {\n out.push({\n kind: 'path',\n path: { kind: 'rect', x: sx - half, y: sy - half, width: paint.sizePx, height: paint.sizePx },\n ...fill, ...stroke,\n });\n return;\n }\n const c = Math.cos(f.angle) * half, sn = Math.sin(f.angle) * half;\n const coords = new Float32Array(8);\n [[-1, -1], [1, -1], [1, 1], [-1, 1]].forEach(([u, v], i) => {\n coords[i * 2] = sx + c * u - sn * v;\n coords[i * 2 + 1] = sy + sn * u + c * v;\n });\n out.push({\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]), coords, fillRule: 'nonzero' },\n ...fill, ...stroke,\n });\n return;\n }\n if (paint.kind === 'annulus') {\n if (region.shape.kind !== 'annulus') return; // type mismatch — silent skip\n const s = region.shape;\n // The screen-px inset in target-local units, so it visually matches at any zoom.\n const insetLocal = pxExtentIn(paint.insetPx ?? 0, view.scale, xf);\n // Same `minBandPx` clamp the hit-test applies, so the ring you can see is\n // the ring you can grab.\n const cmd = annulusCommand(s, annulusSemiAxes(s, view, xf), insetLocal, xf, viewT, paint.fill, paint.stroke);\n if (cmd) out.push(cmd);\n return;\n }\n if (paint.kind === 'custom') {\n const ctx: CustomPaintContext = {\n world: worldOf(region, xf, view),\n local: region.shape,\n view,\n state,\n };\n for (const cmd of paint.draw(ctx)) out.push(cmd);\n return;\n }\n}\n\n/** Build a screen-space DrawCommand for an annulus region: the area\n * inside the (contracted) outer ellipse but outside the (expanded)\n * inner rect. Renders as four disjoint petal subpaths — one per rect\n * edge — so the visible fill is true `ellipse \\ rect`. A naive\n * ellipse + rect even-odd path would also fill the rect's corner\n * triangles where they poke past the contracted ellipse. Returns null\n * when the band collapses on both axes. */\nfunction annulusCommand(\n shape: Extract<AffordanceRegion['shape'], { kind: 'annulus' }>,\n semiAxes: { rx: number; ry: number },\n insetLocal: { x: number; y: number },\n xf: TargetTransform,\n viewT: ReturnType<typeof viewToTransform>,\n fill: CommandFill | undefined,\n stroke: CommandStroke | undefined,\n): DrawCommand | null {\n const rx = semiAxes.rx - insetLocal.x;\n const ry = semiAxes.ry - insetLocal.y;\n if (rx <= 0 || ry <= 0) return null;\n const cx = shape.cx;\n const cy = shape.cy;\n // Expanded inner rect (still in target-local coords).\n const rectHW = shape.innerWidth / 2 + insetLocal.x;\n const rectHH = shape.innerHeight / 2 + insetLocal.y;\n // A petal exists only when its rect edge intersects the ellipse interior — otherwise the\n // rect already extends past the ellipse on that axis.\n const haveTopBottom = rectHH < ry;\n const haveLeftRight = rectHW < rx;\n if (!haveTopBottom && !haveLeftRight) return null;\n const xT = haveTopBottom ? rx * Math.sqrt(1 - (rectHH / ry) ** 2) : 0;\n const yR = haveLeftRight ? ry * Math.sqrt(1 - (rectHW / rx) ** 2) : 0;\n\n // Line segments per petal arc; 24 is smooth at typical zooms.\n const SAMPLES = 24;\n const cmds: number[] = [];\n const localPts: { x: number; y: number }[] = [];\n\n function appendPetal(t0: number, t1: number): void {\n cmds.push(PATH_M);\n localPts.push({ x: cx + rx * Math.cos(t0), y: cy + ry * Math.sin(t0) });\n for (let i = 1; i <= SAMPLES; i++) {\n const t = t0 + (t1 - t0) * (i / SAMPLES);\n cmds.push(PATH_L);\n localPts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });\n }\n // PATH_Z closes along the rect edge: both endpoints share the rect-edge coord by\n // construction, so the closing segment IS the chord.\n cmds.push(PATH_Z);\n }\n\n if (haveTopBottom) {\n // Top petal: y < cy. Arc from right endpoint over t = -π/2 to left.\n appendPetal(\n Math.atan2(-rectHH / ry, xT / rx), // in (-π/2, 0)\n Math.atan2(-rectHH / ry, -xT / rx), // in (-π, -π/2), decreasing through -π/2\n );\n // Bottom petal: y > cy. Arc through t = +π/2.\n appendPetal(\n Math.atan2(rectHH / ry, xT / rx), // in (0, π/2)\n Math.atan2(rectHH / ry, -xT / rx), // in (π/2, π), increasing through π/2\n );\n }\n if (haveLeftRight) {\n // Right petal: x > cx. Arc through t = 0.\n appendPetal(\n Math.atan2(-yR / ry, rectHW / rx), // in (-π/2, 0)\n Math.atan2(yR / ry, rectHW / rx), // in (0, π/2)\n );\n // Left petal: x < cx. Arc through t = ±π. Shift the end angle by\n // -2π so the parametric trace passes through the leftmost point\n // monotonically instead of crossing the right side.\n appendPetal(\n Math.atan2(-yR / ry, -rectHW / rx), // in (-π, -π/2)\n Math.atan2(yR / ry, -rectHW / rx) - 2 * Math.PI, // in (-3π/2, -π), decreasing through -π\n );\n }\n\n const coords = new Float32Array(localPts.length * 2);\n for (let i = 0; i < localPts.length; i++) {\n const w = localToWorld(xf, localPts[i].x, localPts[i].y);\n const [sx, sy] = worldToScreen(w.x, w.y, viewT);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n }\n return {\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array(cmds), coords, fillRule: 'nonzero' },\n ...(fill ? { fill } : {}),\n ...(stroke ? { stroke } : {}),\n };\n}\n\nfunction worldOf(region: AffordanceRegion, xf: TargetTransform, view: View): CustomPaintContext['world'] {\n if (region.shape.kind === 'point') {\n const w = pointRegionAnchor(region.shape, xf, view);\n return { x: w.x, y: w.y };\n }\n if (region.shape.kind === 'annulus') {\n // The outer ellipse's bounding box in world coords: each half-extent is\n // the length of that row of the frame applied to the semi-axes.\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, xf);\n const c = localToWorld(xf, s.cx, s.cy);\n const [ma, mb, mc, md] = xf.toWorld;\n const hw = Math.hypot(rx * ma, ry * mc);\n const hh = Math.hypot(rx * mb, ry * md);\n return { x: c.x - hw, y: c.y - hh, width: 2 * hw, height: 2 * hh };\n }\n // Rect: under rotation, width/height describe the AABB of the rotated rect. Affordances\n // needing exact rotated geometry can read `local` and reapply the rotation themselves.\n const r = region.shape.kind === 'outline' ? boundsOfPath(region.shape.path) : region.shape;\n const a = localToWorld(xf, r.x, r.y);\n const b = localToWorld(xf, r.x + r.width, r.y);\n const c = localToWorld(xf, r.x, r.y + r.height);\n const d = localToWorld(xf, r.x + r.width, r.y + r.height);\n const minX = Math.min(a.x, b.x, c.x, d.x);\n const minY = Math.min(a.y, b.y, c.y, d.y);\n const maxX = Math.max(a.x, b.x, c.x, d.x);\n const maxY = Math.max(a.y, b.y, c.y, d.y);\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n// Hit-testing lives in `hitAffordanceRegions.ts` — see `hitRegion` there.\n"],"mappings":";;;;;;AAqCA,SAAgBA,EACd,GACA,GACA,GAUA;CACA,OAAO;EACL;EACA;EACA,OAAO;EACP,OAAO,GAAM,GAAM,MAAyB;GAC1C,IAAMC,IAAQC,EAAcC,CAAI,GAC1BC,IAAQC,EAAYF,CAAI,GACxBG,IAAYC,EAAYJ,CAAI,GAC5BK,IAAqB,CAAC,GACtBC,IAAIC,EAAgBC,CAAI;GAC9B,KAAK,IAAMC,KAAKC,GACd,IAAI,MAAcP,EAAUM,EAAE,EAAE,GAChC;SAAK,IAAME,KAAUF,EAAE,QAAQX,CAAK,GAAG;KACrC,IAAMc,IAAKC,EAAYf,GAAOa,EAAO,QAAQ;KAE7C,AADIA,EAAO,SAAOG,EAAYH,GAAQC,GAAIJ,GAAMV,GAAOQ,GAAGD,CAAG,GACzDJ,KAAOc,EAAmBd,GAAOQ,EAAE,IAAIE,GAAQC,GAAIJ,CAAI;IAC7D;IACA,IAAIC,EAAE,UACJ,KAAK,IAAMO,KAAOP,EAAE,SAASX,GAAOU,CAAI,GAAG,EAAI,KAAKQ,CAAG;GAFzD;GAKF,OAAOX;EACT;EAGA,UAA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EAAE,GAAG,EAAE,GAAGC,EAAE,CAAC,GAClCG,IAAO,KAAK,IAAI,EAAE,GAAGJ,EAAE,GAAG,EAAE,GAAGC,EAAE,CAAC,GAClCI,IAAO,KAAK,IAAI,EAAE,GAAGL,EAAE,GAAG,EAAE,GAAGC,EAAE,CAAC;CACxC,OAAO;EAAE,GAAGC;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK;AACrE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HANDLE_BASE_PX as e } from "../core/device/targets.js";
|
|
2
|
-
import { angleOf as t, localToWorld as n
|
|
2
|
+
import { angleOf as t, localToWorld as n } from "../core/geometry/targetFrame.js";
|
|
3
|
+
import { transformOf as r } from "./hitAffordanceRegions.js";
|
|
3
4
|
import { CORNER_ANCHORS as i, cornerPoint as a, fixedCornerOf as o } from "../interactions/actions/resize/cornerHandles.js";
|
|
4
5
|
import { MULTI_RESIZE_TARGET_ID as s } from "../core/selection/selectionTarget.js";
|
|
5
6
|
//#region src/affordances/cornerResize.ts
|
|
@@ -8,7 +9,7 @@ function u(s = {}) {
|
|
|
8
9
|
let { handleHitRadius: u = e, handleSize: f = e, fill: p = c, stroke: m = l } = s, h = {
|
|
9
10
|
kind: "square",
|
|
10
11
|
sizePx: f,
|
|
11
|
-
fill: { color: p },
|
|
12
|
+
fill: { paint: { color: p } },
|
|
12
13
|
stroke: {
|
|
13
14
|
paint: { color: m },
|
|
14
15
|
width: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cornerResize.js","names":["DEFAULT_FILL","DEFAULT_STROKE","createCornerResizeAffordance","HANDLE_BASE_PX","opts","paint","handleSize","fill","stroke","target","pickRenderTarget","state","b","xf","transformOf","CORNER_ANCHORS","corner","cornerPoint","c","fixedLocal","fixedCornerOf","fixedPoint","localToWorld","handleHitRadius","angleOf","MULTI_RESIZE_TARGET_ID","id"],"sources":["../../src/affordances/cornerResize.ts"],"sourcesContent":["import type { Affordance, AffordanceBinding, AffordanceRegion, CommonAffordanceScratch } from './types';\nimport type { ChromeState, Bounds } from 'core/selection/chromeState';\nimport type { ResizeAnchor } from 'interactions/gestures/types';\nimport { CORNER_ANCHORS, cornerPoint, fixedCornerOf } from 'interactions/actions/resize/cornerHandles';\nimport { MULTI_RESIZE_TARGET_ID } from 'core/selection/selectionTarget';\nimport { angleOf, localToWorld, transformOf } from './hitAffordanceRegions';\nimport { HANDLE_BASE_PX } from 'core/device/targets';\n\n/** Options for `createCornerResizeAffordance` — the size and appearance of\n * the corner handles. */\nexport interface CornerResizeAffordanceOptions {\n /** Hit radius (screen-px) for the corner handles. Default 8. */\n handleHitRadius?: number;\n /** Visual handle size (screen-px). Default 8. */\n handleSize?: number;\n fill?: string;\n stroke?: string;\n}\n\n/** What a corner-resize hit hands to the resize action: which corner stays\n * put, what is being resized, and the world-space pivot to scale from. */\nexport interface CornerResizeScratch extends CommonAffordanceScratch {\n /** Resize anchor identifying the OPPOSITE corner (the one that stays\n * fixed). Matches the kit's existing ResizeAnchor convention. */\n anchor: ResizeAnchor;\n /** Id of the resize target. In multi-mode this is `MULTI_RESIZE_TARGET_ID`. */\n targetId: string;\n /** The fixed corner in **world** coords, with the target's rotation already\n * applied. `resizeAction` scales from this point, and it has no access to\n * the target transform, so the affordance resolves it here. */\n fixedPoint: { x: number; y: number };\n}\n\nconst DEFAULT_FILL = '#d4c4a8';\nconst DEFAULT_STROKE = '#1a130d';\n\n/**\n * @experimental\n * Corner-handle affordance for resizing the active selection (single\n * member in single-mode; the union AABB in multi-mode).\n *\n * Declares four point regions in the target's local frame; the framework\n * applies the target's bounds rotation for both paint and hit-test. A\n * region's `bind()` carries only the scratch a hit hands to the resize\n * action: the anchor, the target, and the world-space fixed point.\n */\nexport function createCornerResizeAffordance(\n opts: CornerResizeAffordanceOptions = {},\n): Affordance {\n const {\n handleHitRadius = HANDLE_BASE_PX,\n handleSize = HANDLE_BASE_PX,\n fill = DEFAULT_FILL,\n stroke = DEFAULT_STROKE,\n } = opts;\n\n const paint = {\n kind: 'square' as const,\n sizePx: handleSize,\n fill: { color: fill },\n stroke: { paint: { color: stroke }, width: 1 },\n };\n\n return {\n id: 'selection.resize-handles',\n regions(state: ChromeState): readonly AffordanceRegion[] {\n const target = pickRenderTarget(state);\n if (!target) return [];\n const b = target.bounds;\n // The transform the framework applies to these regions. Needed here too,\n // because `fixedPoint` leaves the local frame — it travels to\n // `resizeAction`, which works in world coords.\n const xf = transformOf(state, target.id);\n return CORNER_ANCHORS.map((c) => {\n const corner = cornerPoint(b, c);\n const fixedLocal = fixedCornerOf(b, c.anchor);\n const fixedPoint = localToWorld(xf, fixedLocal.x, fixedLocal.y);\n return {\n id: `corner-${c.tag}`,\n targetId: target.id,\n shape: {\n kind: 'point' as const,\n x: corner.x,\n y: corner.y,\n hitRadiusPx: handleHitRadius,\n turned: true,\n cornerOf: {\n width: b.width,\n height: b.height,\n outward: { x: c.xEdge === 'min' ? -1 : 1, y: c.yEdge === 'min' ? -1 : 1 },\n },\n },\n paint,\n hitKind: c.kind,\n // Diagonal by fixed-corner parity: a matched-axis anchor (min-min /\n // max-max fixed) means the dragged corner sits on the ↘ diagonal;\n // mixed axes sit on the ↗ diagonal. The glyph is horizontal at angle\n // 0, so the diagonal is a half-quarter-turn either way, plus the\n // target's own rotation. The keyword is the fallback rather than the\n // answer: CSS has four of them, which cannot express a target\n // rotated to anything but a multiple of 45°.\n cursor: {\n glyph: 'resize',\n angle: (c.anchor.x === c.anchor.y ? Math.PI / 4 : -Math.PI / 4) + angleOf(xf),\n fallback: c.anchor.x === c.anchor.y ? 'nwse-resize' : 'nesw-resize',\n },\n bind: (): AffordanceBinding => ({\n initialScratch: {\n anchor: c.anchor,\n targetId: target.id,\n fixedPoint,\n } satisfies CornerResizeScratch,\n }),\n } satisfies AffordanceRegion;\n });\n },\n };\n}\n\nfunction pickRenderTarget(state: ChromeState): { id: string; bounds: Bounds } | null {\n if (state.multiActive && state.unionBounds) {\n return { id: MULTI_RESIZE_TARGET_ID, bounds: state.unionBounds };\n }\n if (state.selection.length === 1) {\n const id = state.selection[0];\n const b = state.boundsOf(id);\n return b ? { id, bounds: b } : null;\n }\n return null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cornerResize.js","names":["DEFAULT_FILL","DEFAULT_STROKE","createCornerResizeAffordance","HANDLE_BASE_PX","opts","paint","handleSize","fill","stroke","target","pickRenderTarget","state","b","xf","transformOf","CORNER_ANCHORS","corner","cornerPoint","c","fixedLocal","fixedCornerOf","fixedPoint","localToWorld","handleHitRadius","angleOf","MULTI_RESIZE_TARGET_ID","id"],"sources":["../../src/affordances/cornerResize.ts"],"sourcesContent":["import type { Affordance, AffordanceBinding, AffordanceRegion, CommonAffordanceScratch } from './types';\nimport type { ChromeState, Bounds } from 'core/selection/chromeState';\nimport type { ResizeAnchor } from 'interactions/gestures/types';\nimport { CORNER_ANCHORS, cornerPoint, fixedCornerOf } from 'interactions/actions/resize/cornerHandles';\nimport { MULTI_RESIZE_TARGET_ID } from 'core/selection/selectionTarget';\nimport { angleOf, localToWorld, transformOf } from './hitAffordanceRegions';\nimport { HANDLE_BASE_PX } from 'core/device/targets';\n\n/** Options for `createCornerResizeAffordance` — the size and appearance of\n * the corner handles. */\nexport interface CornerResizeAffordanceOptions {\n /** Hit radius (screen-px) for the corner handles. Default 8. */\n handleHitRadius?: number;\n /** Visual handle size (screen-px). Default 8. */\n handleSize?: number;\n fill?: string;\n stroke?: string;\n}\n\n/** What a corner-resize hit hands to the resize action: which corner stays\n * put, what is being resized, and the world-space pivot to scale from. */\nexport interface CornerResizeScratch extends CommonAffordanceScratch {\n /** Resize anchor identifying the OPPOSITE corner (the one that stays\n * fixed). Matches the kit's existing ResizeAnchor convention. */\n anchor: ResizeAnchor;\n /** Id of the resize target. In multi-mode this is `MULTI_RESIZE_TARGET_ID`. */\n targetId: string;\n /** The fixed corner in **world** coords, with the target's rotation already\n * applied. `resizeAction` scales from this point, and it has no access to\n * the target transform, so the affordance resolves it here. */\n fixedPoint: { x: number; y: number };\n}\n\nconst DEFAULT_FILL = '#d4c4a8';\nconst DEFAULT_STROKE = '#1a130d';\n\n/**\n * @experimental\n * Corner-handle affordance for resizing the active selection (single\n * member in single-mode; the union AABB in multi-mode).\n *\n * Declares four point regions in the target's local frame; the framework\n * applies the target's bounds rotation for both paint and hit-test. A\n * region's `bind()` carries only the scratch a hit hands to the resize\n * action: the anchor, the target, and the world-space fixed point.\n */\nexport function createCornerResizeAffordance(\n opts: CornerResizeAffordanceOptions = {},\n): Affordance {\n const {\n handleHitRadius = HANDLE_BASE_PX,\n handleSize = HANDLE_BASE_PX,\n fill = DEFAULT_FILL,\n stroke = DEFAULT_STROKE,\n } = opts;\n\n const paint = {\n kind: 'square' as const,\n sizePx: handleSize,\n fill: { paint: { color: fill } },\n stroke: { paint: { color: stroke }, width: 1 },\n };\n\n return {\n id: 'selection.resize-handles',\n regions(state: ChromeState): readonly AffordanceRegion[] {\n const target = pickRenderTarget(state);\n if (!target) return [];\n const b = target.bounds;\n // The transform the framework applies to these regions. Needed here too,\n // because `fixedPoint` leaves the local frame — it travels to\n // `resizeAction`, which works in world coords.\n const xf = transformOf(state, target.id);\n return CORNER_ANCHORS.map((c) => {\n const corner = cornerPoint(b, c);\n const fixedLocal = fixedCornerOf(b, c.anchor);\n const fixedPoint = localToWorld(xf, fixedLocal.x, fixedLocal.y);\n return {\n id: `corner-${c.tag}`,\n targetId: target.id,\n shape: {\n kind: 'point' as const,\n x: corner.x,\n y: corner.y,\n hitRadiusPx: handleHitRadius,\n turned: true,\n cornerOf: {\n width: b.width,\n height: b.height,\n outward: { x: c.xEdge === 'min' ? -1 : 1, y: c.yEdge === 'min' ? -1 : 1 },\n },\n },\n paint,\n hitKind: c.kind,\n // Diagonal by fixed-corner parity: a matched-axis anchor (min-min /\n // max-max fixed) means the dragged corner sits on the ↘ diagonal;\n // mixed axes sit on the ↗ diagonal. The glyph is horizontal at angle\n // 0, so the diagonal is a half-quarter-turn either way, plus the\n // target's own rotation. The keyword is the fallback rather than the\n // answer: CSS has four of them, which cannot express a target\n // rotated to anything but a multiple of 45°.\n cursor: {\n glyph: 'resize',\n angle: (c.anchor.x === c.anchor.y ? Math.PI / 4 : -Math.PI / 4) + angleOf(xf),\n fallback: c.anchor.x === c.anchor.y ? 'nwse-resize' : 'nesw-resize',\n },\n bind: (): AffordanceBinding => ({\n initialScratch: {\n anchor: c.anchor,\n targetId: target.id,\n fixedPoint,\n } satisfies CornerResizeScratch,\n }),\n } satisfies AffordanceRegion;\n });\n },\n };\n}\n\nfunction pickRenderTarget(state: ChromeState): { id: string; bounds: Bounds } | null {\n if (state.multiActive && state.unionBounds) {\n return { id: MULTI_RESIZE_TARGET_ID, bounds: state.unionBounds };\n }\n if (state.selection.length === 1) {\n const id = state.selection[0];\n const b = state.boundsOf(id);\n return b ? { id, bounds: b } : null;\n }\n return null;\n}\n"],"mappings":";;;;;;AAiCA,IAAMA,IAAe,WACfC,IAAiB;AAYvB,SAAgBC,EACd,IAAsC,CAAC,GAC3B;CACZ,IAAM,EACJ,qBAAkBC,GAClB,gBAAaA,GACb,UAAOH,GACP,YAASC,MACPG,GAEEC,IAAQ;EACZ,MAAM;EACN,QAAQC;EACR,MAAM,EAAE,OAAO,EAAE,OAAOC,EAAK,EAAE;EAC/B,QAAQ;GAAE,OAAO,EAAE,OAAOC,EAAO;GAAG,OAAO;EAAE;CAC/C;CAEA,OAAO;EACL,IAAI;EACJ,QAAQ,GAAiD;GACvD,IAAMC,IAASC,EAAiBC,CAAK;GACrC,IAAI,CAACF,GAAQ,OAAO,CAAC;GACrB,IAAMG,IAAIH,EAAO,QAIXI,IAAKC,EAAYH,GAAOF,EAAO,EAAE;GACvC,OAAOM,EAAe,KAAK,MAAM;IAC/B,IAAMC,IAASC,EAAYL,GAAGM,CAAC,GACzBC,IAAaC,EAAcR,GAAGM,EAAE,MAAM,GACtCG,IAAaC,EAAaT,GAAIM,EAAW,GAAGA,EAAW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