@weasel-js/core 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1106 -0
- package/README.md +7 -5
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -93
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +27 -18
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +65 -104
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +22 -21
- 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 +38 -88
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +32 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -29
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -0
- package/dist/animation/wrappers/instantPose.js.map +1 -0
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/{autoPoseDescriptor-vCdt55xm.d.ts → autoPoseDescriptor-DHg5KqaJ.d.ts} +1 -1
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +18 -0
- package/dist/barrel/interactions.js +38 -0
- package/dist/barrel/paint.js +11 -0
- package/dist/barrel/paths.js +12 -0
- package/dist/barrel/renderer.js +14 -0
- package/dist/barrel/routing.js +57 -0
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -0
- package/dist/barrel/viewport.js +42 -0
- package/dist/canvas/Canvas.js +280 -559
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +147 -167
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +53 -49
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +40 -51
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +55 -374
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +50 -47
- 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 +126 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +64 -0
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/coordTrace.js +46 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +138 -85
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +74 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js +12 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +31 -34
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +39 -0
- package/dist/canvas/SceneCanvas/props.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/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +48 -48
- 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 +74 -78
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +311 -969
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +42 -46
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +111 -0
- package/dist/canvas/buildSceneLayer.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +16 -19
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +67 -55
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/changes.js +13 -0
- package/dist/canvas/deps/changes.js.map +1 -0
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +38 -57
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +130 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +26 -26
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +6 -5
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +47 -22
- 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 +4 -8
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/kitRequirements.js +2 -2
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerOrder.js +13 -6
- 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 +34 -0
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/imagePainter.js +87 -0
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +9 -0
- package/dist/canvas/nodeShapes/memo.js.map +1 -0
- package/dist/canvas/nodeShapes/nodePaint.js +68 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +39 -0
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/poseBox.js +20 -0
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/shapePainter.js +72 -0
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +55 -0
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +11 -14
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +59 -68
- 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 +9 -23
- 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 +11 -11
- 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 -81
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -214
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +112 -0
- package/dist/canvas/sceneClipboard.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -39
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +26 -6
- 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 +67 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +39 -31
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +11 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +16 -19
- package/dist/{types-B_9g6hMM.d.ts → clone-2a5hVbBd.d.ts} +123 -74
- package/dist/clone.d.ts +4 -7
- package/dist/clone.js +0 -2
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +38 -44
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/watchDevicePixelRatio.js +17 -0
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
- 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 +68 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +31 -34
- 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 +30 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/core/layers/gateLayer.js +13 -0
- 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/arrange.js +1 -0
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +10 -5
- 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 +12 -24
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +43 -40
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +34 -0
- package/dist/core/ops/reorder/setChildOrder.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} +282 -105
- 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/appliedLog.js +37 -0
- package/dist/core/scene/appliedLog.js.map +1 -0
- package/dist/core/scene/arrivalWindow.js +102 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +130 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +185 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +131 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- 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 +10 -11
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +45 -19
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +127 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseFeed.js +38 -38
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -40
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +80 -1266
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +71 -0
- package/dist/core/scene/serialization.js.map +1 -0
- 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/treeOrder.js +13 -0
- package/dist/core/scene/treeOrder.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +9 -9
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +10 -8
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +97 -97
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- 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 +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +28 -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/registerKitHandlers.js +7 -7
- 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 +22 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -14
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +44 -52
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +171 -179
- 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 +100 -93
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +8473 -9141
- package/dist/index.js +269 -307
- package/dist/input/keyState.js +38 -39
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +11 -0
- package/dist/input/useKeyModifiers.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +18 -20
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +20 -20
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +31 -15
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +44 -42
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +7 -32
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +60 -84
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +35 -38
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +40 -0
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
- 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 +13 -53
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +40 -50
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +44 -38
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +11 -12
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -69
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +14 -8
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +7 -4
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +8 -10
- 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 +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/distribute/action.js +66 -0
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +7 -9
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +30 -27
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +8 -0
- package/dist/interactions/actions/hitSelection.js.map +1 -0
- package/dist/interactions/actions/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +39 -27
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +22 -30
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +33 -0
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
- 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 +16 -63
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +25 -20
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +87 -78
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +62 -41
- 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/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -3
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +14 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → poseDescriptor-Bqk-11Rl.d.ts} +26 -36
- package/dist/renderer.d.ts +1 -91
- package/dist/renderer.js +2 -18
- package/dist/resize.d.ts +10 -22
- package/dist/resize.js +6 -6
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js +12 -6
- 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 +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +1 -0
- 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 +11 -11
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +1 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +198 -150
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +1 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +25 -24
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +42 -67
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +17 -0
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +72 -82
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +22 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +9 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +12 -22
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-A37hYkeR.d.ts → types-CIKDwlsP.d.ts} +113 -169
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -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 -62
- 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 -138
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -106
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -116
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -71
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -378
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/canvas/MinimapCanvas.js +0 -139
- 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 -80
- 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 -85
- 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/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/isPlainObject.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/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/debug/flag.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js +0 -14
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -94
- 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 -236
- 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 -103
- 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 -26
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -156
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -154
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -148
- 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/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/index.js +0 -23
- 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/resolveSpec.js +0 -57
- 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 -46
- 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/domRuns.js +0 -258
- 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 -45
- package/dist/features/text/hitTest.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 -135
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -59
- 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 -467
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -63
- 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 -107
- 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 +0 -66
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -119
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
- package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -288
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -156
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -760
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -335
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -184
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-Drrw4ewZ.d.ts +0 -160
- package/dist/registerProgram-BMZRDgrh.d.ts +0 -197
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -331
- 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 -64
- 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 -51
- 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.js +0 -1135
- 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 -45
- 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 -9
- 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 -19
- package/dist/renderer/math/color.js +0 -341
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -76
- 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 -30
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -13
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -24
- 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 -14
- 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-CuIxe0xY.d.ts +0 -356
- package/dist/tools/prefs.js +0 -62
- package/dist/tools/prefs.js.map +0 -1
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';
|
|
@@ -47,10 +49,10 @@ A bare `<SceneCanvas>` only renders. It keeps a selection that nothing sets from
|
|
|
47
49
|
| `resize` | resize handles |
|
|
48
50
|
| `rotate` | the rotation handle |
|
|
49
51
|
| `transform` | `resize` and `rotate` |
|
|
50
|
-
| `edit` | undo/redo, delete, duplicate, group/ungroup, nudge, select-all, Escape, cut/copy/paste, fill and stroke, and their keys |
|
|
52
|
+
| `edit` | undo/redo, delete, duplicate, group/ungroup, nudge, select-all, Escape, cut/copy/paste, fill and stroke, and their keys; Cmd/Ctrl+V pastes nodes a kit canvas copied, and nothing else |
|
|
51
53
|
| `arrange` | align, distribute, reorder, flip |
|
|
52
54
|
| `paths` | pathfinder operations, path editing and anchor editing |
|
|
53
|
-
| `ingest` | dropped and pasted content |
|
|
55
|
+
| `ingest` | dropped and pasted content: images, SVG, files, and consumer content handlers, on Cmd/Ctrl+V or an OS drop |
|
|
54
56
|
| `draw` | every preset above |
|
|
55
57
|
|
|
56
58
|
`defaultTools` adds built-in tools on top, and each brings the actions it binds: `defaultTools={['rect']}` brings `insert`.
|
|
@@ -139,7 +141,7 @@ await registerFont('Inter', { weight: 400 }, '/fonts/Inter-400.json', '/fonts/In
|
|
|
139
141
|
|
|
140
142
|
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
143
|
|
|
142
|
-
|
|
144
|
+
`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
145
|
|
|
144
146
|
## Custom shaders (`@experimental`)
|
|
145
147
|
|
package/dist/WeaselProvider.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { DepRegistryProviderIfRoot as a } from "./canvas/SceneCanvas/DepRegistryProviderIfRoot.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,29 +1,29 @@
|
|
|
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 } from "@weasel-js/geom";
|
|
6
6
|
//#region src/affordances/composeAffordanceLayer.ts
|
|
7
|
-
function
|
|
7
|
+
function g(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 = _(t), o = v(t), s = y(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 && S(t, r, n, a, l, c), o && b(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 = _(n);
|
|
25
|
+
if (!s) return null;
|
|
26
|
+
let l = c(r, e, t, s, i, o ?? y(n) ?? void 0);
|
|
27
27
|
if (!l) return null;
|
|
28
28
|
let { cursor: u, strength: d, claimedKinds: f } = l.region;
|
|
29
29
|
return {
|
|
@@ -35,145 +35,148 @@ function m(t, n, r) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function _(e) {
|
|
39
39
|
let t = e;
|
|
40
40
|
return typeof t?.getChromeState == "function" ? t.getChromeState() : e;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function v(e) {
|
|
43
43
|
let t = e;
|
|
44
44
|
return typeof t?.getDebug == "function" ? t.getDebug() : null;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function y(e) {
|
|
47
47
|
let t = e;
|
|
48
48
|
return typeof t?.getIsVisible == "function" ? t.getIsVisible() : null;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function b(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
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
let a = n.shape, { rx: o, ry: c } = s(a, i, r);
|
|
64
|
+
x(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
|
+
x(e, t, r, n.shape);
|
|
73
|
+
}
|
|
74
|
+
function x(e, t, a, s) {
|
|
75
|
+
if (!r(a)) {
|
|
69
76
|
e.recordHitbox(t, "handle", {
|
|
70
|
-
kind: "
|
|
71
|
-
|
|
72
|
-
y: p,
|
|
73
|
-
width: m - f,
|
|
74
|
-
height: h - p,
|
|
75
|
-
...a.identity ? {} : { rotation: Math.atan2(a.sin, a.cos) }
|
|
77
|
+
kind: "polygon",
|
|
78
|
+
points: o(s, a)
|
|
76
79
|
});
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
|
-
let
|
|
82
|
+
let c = i(a, s.x + s.width / 2, s.y + s.height / 2);
|
|
80
83
|
e.recordHitbox(t, "handle", {
|
|
81
84
|
kind: "rect",
|
|
82
|
-
x:
|
|
83
|
-
y:
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
86
|
-
...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) }
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
|
-
function
|
|
90
|
-
let
|
|
91
|
-
if (
|
|
92
|
+
function S(e, n, r, i, o, c) {
|
|
93
|
+
let l = e.paint;
|
|
94
|
+
if (l.kind === "square") {
|
|
92
95
|
if (e.shape.kind !== "point") return;
|
|
93
|
-
let
|
|
94
|
-
if (
|
|
95
|
-
|
|
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({
|
|
96
99
|
kind: "path",
|
|
97
100
|
path: {
|
|
98
101
|
kind: "rect",
|
|
99
|
-
x:
|
|
100
|
-
y:
|
|
101
|
-
width:
|
|
102
|
-
height:
|
|
102
|
+
x: a - d,
|
|
103
|
+
y: s - d,
|
|
104
|
+
width: l.sizePx,
|
|
105
|
+
height: l.sizePx
|
|
103
106
|
},
|
|
104
|
-
...
|
|
107
|
+
...f,
|
|
105
108
|
...g
|
|
106
109
|
});
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
109
|
-
let _ = Math.cos(
|
|
112
|
+
let _ = Math.cos(i.angle) * d, v = Math.sin(i.angle) * d, y = /* @__PURE__ */ new Float32Array(8);
|
|
110
113
|
[
|
|
111
114
|
[-1, -1],
|
|
112
115
|
[1, -1],
|
|
113
116
|
[1, 1],
|
|
114
117
|
[-1, 1]
|
|
115
118
|
].forEach(([e, t], n) => {
|
|
116
|
-
y[n * 2] =
|
|
117
|
-
}),
|
|
119
|
+
y[n * 2] = a + _ * e - v * t, y[n * 2 + 1] = s + v * e + _ * t;
|
|
120
|
+
}), c.push({
|
|
118
121
|
kind: "path",
|
|
119
122
|
path: {
|
|
120
123
|
kind: "polygon",
|
|
121
124
|
commands: new Uint8Array([
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
m,
|
|
126
|
+
p,
|
|
127
|
+
p,
|
|
128
|
+
p,
|
|
129
|
+
h
|
|
127
130
|
]),
|
|
128
131
|
coords: y,
|
|
129
132
|
fillRule: "nonzero"
|
|
130
133
|
},
|
|
131
|
-
...
|
|
134
|
+
...f,
|
|
132
135
|
...g
|
|
133
136
|
});
|
|
134
137
|
return;
|
|
135
138
|
}
|
|
136
|
-
if (
|
|
139
|
+
if (l.kind === "annulus") {
|
|
137
140
|
if (e.shape.kind !== "annulus") return;
|
|
138
|
-
let t = e.shape,
|
|
139
|
-
|
|
141
|
+
let t = e.shape, i = a(l.insetPx ?? 0, r.scale, n), u = C(t, s(t, r, n), i, n, o, l.fill, l.stroke);
|
|
142
|
+
u && c.push(u);
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
|
-
if (
|
|
145
|
+
if (l.kind === "custom") {
|
|
143
146
|
let t = {
|
|
144
|
-
world:
|
|
147
|
+
world: w(e, n, r),
|
|
145
148
|
local: e.shape,
|
|
146
|
-
view:
|
|
147
|
-
state:
|
|
149
|
+
view: r,
|
|
150
|
+
state: i
|
|
148
151
|
};
|
|
149
|
-
for (let e of
|
|
152
|
+
for (let e of l.draw(t)) c.push(e);
|
|
150
153
|
return;
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
|
-
function
|
|
156
|
+
function C(e, n, r, a, o, s, c) {
|
|
154
157
|
let l = n.rx - r.x, u = n.ry - r.y;
|
|
155
158
|
if (l <= 0 || u <= 0) return null;
|
|
156
|
-
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;
|
|
157
160
|
if (!v && !y) return null;
|
|
158
161
|
let b = v ? l * Math.sqrt(1 - (_ / u) ** 2) : 0, x = y ? u * Math.sqrt(1 - (g / l) ** 2) : 0, S = [], C = [];
|
|
159
162
|
function w(e, t) {
|
|
160
|
-
S.push(
|
|
161
|
-
x:
|
|
162
|
-
y:
|
|
163
|
+
S.push(m), C.push({
|
|
164
|
+
x: d + l * Math.cos(e),
|
|
165
|
+
y: f + u * Math.sin(e)
|
|
163
166
|
});
|
|
164
167
|
for (let n = 1; n <= 24; n++) {
|
|
165
168
|
let r = e + (t - e) * (n / 24);
|
|
166
|
-
S.push(
|
|
167
|
-
x:
|
|
168
|
-
y:
|
|
169
|
+
S.push(p), C.push({
|
|
170
|
+
x: d + l * Math.cos(r),
|
|
171
|
+
y: f + u * Math.sin(r)
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
|
-
S.push(
|
|
174
|
+
S.push(h);
|
|
172
175
|
}
|
|
173
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));
|
|
174
177
|
let T = new Float32Array(C.length * 2);
|
|
175
178
|
for (let e = 0; e < C.length; e++) {
|
|
176
|
-
let n =
|
|
179
|
+
let n = i(a, C[e].x, C[e].y), [r, s] = t(n.x, n.y, o);
|
|
177
180
|
T[e * 2] = r, T[e * 2 + 1] = s;
|
|
178
181
|
}
|
|
179
182
|
return {
|
|
@@ -188,37 +191,32 @@ function b(e, n, r, i, a, s, c) {
|
|
|
188
191
|
...c ? { stroke: c } : {}
|
|
189
192
|
};
|
|
190
193
|
}
|
|
191
|
-
function
|
|
194
|
+
function w(e, t, n) {
|
|
192
195
|
if (e.shape.kind === "point") {
|
|
193
|
-
let r =
|
|
196
|
+
let r = l(e.shape, t, n);
|
|
194
197
|
return {
|
|
195
198
|
x: r.x,
|
|
196
199
|
y: r.y
|
|
197
200
|
};
|
|
198
201
|
}
|
|
199
202
|
if (e.shape.kind === "annulus") {
|
|
200
|
-
let
|
|
201
|
-
o(t, a.cx + s, a.cy),
|
|
202
|
-
o(t, a.cx - s, a.cy),
|
|
203
|
-
o(t, a.cx, a.cy + c),
|
|
204
|
-
o(t, a.cx, a.cy - c)
|
|
205
|
-
], u = Math.min(...l.map((e) => e.x)), d = Math.min(...l.map((e) => e.y)), f = Math.max(...l.map((e) => e.x)), p = Math.max(...l.map((e) => e.y));
|
|
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);
|
|
206
204
|
return {
|
|
207
|
-
x:
|
|
208
|
-
y:
|
|
209
|
-
width:
|
|
210
|
-
height:
|
|
205
|
+
x: c.x - p,
|
|
206
|
+
y: c.y - m,
|
|
207
|
+
width: 2 * p,
|
|
208
|
+
height: 2 * m
|
|
211
209
|
};
|
|
212
210
|
}
|
|
213
|
-
let
|
|
211
|
+
let r = 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);
|
|
214
212
|
return {
|
|
215
|
-
x:
|
|
216
|
-
y:
|
|
217
|
-
width:
|
|
218
|
-
height:
|
|
213
|
+
x: d,
|
|
214
|
+
y: f,
|
|
215
|
+
width: p - d,
|
|
216
|
+
height: m - f
|
|
219
217
|
};
|
|
220
218
|
}
|
|
221
219
|
//#endregion
|
|
222
|
-
export {
|
|
220
|
+
export { g as composeAffordanceLayer };
|
|
223
221
|
|
|
224
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","pts","localToWorld","rx","ry","minX","p","minY","maxX","maxY","r","w","paint","sx","sy","worldToScreen","viewT","half","fill","stroke","c","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","b"],"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 { FillStyle, Stroke } 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 regions in reverse (top → bottom) and returns the first non-null\n * binding.\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 pts = [\n localToWorld(xf, s.cx + rx, s.cy),\n localToWorld(xf, s.cx - rx, s.cy),\n localToWorld(xf, s.cx, s.cy + ry),\n localToWorld(xf, s.cx, s.cy - ry),\n ];\n const minX = Math.min(...pts.map((p) => p.x));\n const minY = Math.min(...pts.map((p) => p.y));\n const maxX = Math.max(...pts.map((p) => p.x));\n const maxY = Math.max(...pts.map((p) => p.y));\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY,\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: FillStyle | undefined,\n stroke: Stroke | 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 // Outer ellipse bounding box, in world coords. Map the four cardinal\n // extrema through the target transform and AABB the result. (Rotated\n // ellipses are still ellipses; their AABB needs all four points.)\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n const pts = [\n localToWorld(xf, s.cx + rx, s.cy),\n localToWorld(xf, s.cx - rx, s.cy),\n localToWorld(xf, s.cx, s.cy + ry),\n localToWorld(xf, s.cx, s.cy - ry),\n ];\n const minX = Math.min(...pts.map((p) => p.x));\n const minY = Math.min(...pts.map((p) => p.y));\n const maxX = Math.max(...pts.map((p) => p.x));\n const maxY = Math.max(...pts.map((p) => p.y));\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\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: minY, width: maxX - minX, height: maxY - minY };\n}\n\n// Hit-testing lives in `hitAffordanceRegions.ts` — see `hitRegion` there.\n"],"mappings":";;;;;;AA4CA,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;EAKA,UAAU,GAAI,GAAI,GAAM,GAAM,GAAO,MAA+B;GAClE,IAAMP,IAAQC,EAAcC,CAAI;GAChC,IAAI,CAACF,GAAO,OAAO;GACnB,IAAMmB,IAAMC,EACVR,GAAaS,GAAIC,GAAItB,GAAOU,GAAML,KAAaC,EAAYJ,CAAI,KAAK,KAAA,CACtE;G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AO,OACXF,IAAI4B,EAAazB,GAAIiC,EAAE,GAAGA,EAAE,CAAC,GAC7BwC,IAAIhD,EAAazB,GAAIiC,EAAE,IAAIA,EAAE,OAAOA,EAAE,CAAC,GACvCU,IAAIlB,EAAazB,GAAIiC,EAAE,GAAGA,EAAE,IAAIA,EAAE,MAAM,GACxC,IAAIR,EAAazB,GAAIiC,EAAE,IAAIA,EAAE,OAAOA,EAAE,IAAIA,EAAE,MAAM,GAClDL,IAAO,KAAK,IAAI/B,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCb,IAAO,KAAK,IAAIjC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCZ,IAAO,KAAK,IAAIlC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCX,IAAO,KAAK,IAAInC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC;CACxC,OAAO;EAAE,GAAGf;EAAM,GAAGE;EAAM,OAAOC,IAAOH;EAAM,QAAQI,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","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 { 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, 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 recordLocalRect(debug, affordanceId, xf, region.shape);\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;\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,UAAU,GAAI,GAAI,GAAM,GAAM,GAAO,MAA+B;GAClE,IAAMP,IAAQC,EAAcC,CAAI;GAChC,IAAI,CAACF,GAAO,OAAO;GACnB,IAAMmB,IAAMC,EACVR,GAAaS,GAAIC,GAAItB,GAAOU,GAAML,KAAaC,EAAYJ,CAAI,KAAK,KAAA,CACtE;GACA,IAAI,CAACiB,GAAK,OAAO;GACjB,IAAM,EAAE,WAAQ,aAAU,oBAAiBA,EAAI;GAC/C,OAAO;IACL,GAAGA,EAAI;IACP,GAAII,MAAW,KAAA,IAAyB,CAAC,IAAd,EAAE,UAAO;IACpC,GAAIC,MAAa,KAAA,IAA2B,CAAC,IAAh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B,CAACiD,GAAIC,GAAIC,GAAIC,KAAMzE,EAAG,SACtB0E,IAAK,KAAK,MAAMnD,IAAK+C,GAAI9C,IAAKgD,CAAE,GAChCG,IAAK,KAAK,MAAMpD,IAAKgD,GAAI/C,IAAKiD,CAAE;EACtC,OAAO;GAAE,GAAG,EAAE,IAAIC;GAAI,GAAG,EAAE,IAAIC;GAAI,OAAO,IAAID;GAAI,QAAQ,IAAIC;EAAG;CACnE;CAGA,IAAM,IAAI5E,EAAO,OACX,IAAI+B,EAAa9B,GAAI,EAAE,GAAG,EAAE,CAAC,GAC7B4E,IAAI9C,EAAa9B,GAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GACvC,IAAI8B,EAAa9B,GAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GACxC6E,IAAI/C,EAAa9B,GAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAClD8E,IAAO,KAAK,IAAI,EAAE,GAAGF,EAAE,GAAG,EAAE,GAAGC,EAAE,CAAC,GAClCE,IAAO,KAAK,IAAI,EAAE,GAAGH,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,14 +1,15 @@
|
|
|
1
1
|
import { HANDLE_BASE_PX as e } from "../core/device/targets.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { angleOf as t, localToWorld as n } from "../core/geometry/targetFrame.js";
|
|
3
|
+
import { transformOf as r } from "./hitAffordanceRegions.js";
|
|
4
|
+
import { CORNER_ANCHORS as i, cornerPoint as a, fixedCornerOf as o } from "../interactions/actions/resize/cornerHandles.js";
|
|
5
|
+
import { MULTI_RESIZE_TARGET_ID as s } from "../core/selection/selectionTarget.js";
|
|
5
6
|
//#region src/affordances/cornerResize.ts
|
|
6
7
|
var c = "#d4c4a8", l = "#1a130d";
|
|
7
|
-
function u(
|
|
8
|
-
let { handleHitRadius: u = e, handleSize: f = e, fill: p = c, stroke: m = l } =
|
|
8
|
+
function u(s = {}) {
|
|
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
|
|
@@ -17,31 +18,39 @@ function u(i = {}) {
|
|
|
17
18
|
return {
|
|
18
19
|
id: "selection.resize-handles",
|
|
19
20
|
regions(e) {
|
|
20
|
-
let
|
|
21
|
-
if (!
|
|
22
|
-
let c =
|
|
23
|
-
return
|
|
24
|
-
let
|
|
21
|
+
let s = d(e);
|
|
22
|
+
if (!s) return [];
|
|
23
|
+
let c = s.bounds, l = r(e, s.id);
|
|
24
|
+
return i.map((e) => {
|
|
25
|
+
let r = a(c, e), i = o(c, e.anchor), d = n(l, i.x, i.y);
|
|
25
26
|
return {
|
|
26
27
|
id: `corner-${e.tag}`,
|
|
27
|
-
targetId:
|
|
28
|
+
targetId: s.id,
|
|
28
29
|
shape: {
|
|
29
30
|
kind: "point",
|
|
30
|
-
x:
|
|
31
|
-
y:
|
|
31
|
+
x: r.x,
|
|
32
|
+
y: r.y,
|
|
32
33
|
hitRadiusPx: u,
|
|
33
|
-
turned: !0
|
|
34
|
+
turned: !0,
|
|
35
|
+
cornerOf: {
|
|
36
|
+
width: c.width,
|
|
37
|
+
height: c.height,
|
|
38
|
+
outward: {
|
|
39
|
+
x: e.xEdge === "min" ? -1 : 1,
|
|
40
|
+
y: e.yEdge === "min" ? -1 : 1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
34
43
|
},
|
|
35
44
|
paint: h,
|
|
36
45
|
hitKind: e.kind,
|
|
37
46
|
cursor: {
|
|
38
47
|
glyph: "resize",
|
|
39
|
-
angle: (e.anchor.x === e.anchor.y ? Math.PI / 4 : -Math.PI / 4) +
|
|
48
|
+
angle: (e.anchor.x === e.anchor.y ? Math.PI / 4 : -Math.PI / 4) + t(l),
|
|
40
49
|
fallback: e.anchor.x === e.anchor.y ? "nwse-resize" : "nesw-resize"
|
|
41
50
|
},
|
|
42
51
|
bind: () => ({ initialScratch: {
|
|
43
52
|
anchor: e.anchor,
|
|
44
|
-
targetId:
|
|
53
|
+
targetId: s.id,
|
|
45
54
|
fixedPoint: d
|
|
46
55
|
} })
|
|
47
56
|
};
|
|
@@ -51,7 +60,7 @@ function u(i = {}) {
|
|
|
51
60
|
}
|
|
52
61
|
function d(e) {
|
|
53
62
|
if (e.multiActive && e.unionBounds) return {
|
|
54
|
-
id:
|
|
63
|
+
id: s,
|
|
55
64
|
bounds: e.unionBounds
|
|
56
65
|
};
|
|
57
66
|
if (e.selection.length === 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.
|
|
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, boun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