@weasel-js/core 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1006 -0
- package/README.md +28 -9
- package/dist/WeaselProvider.js +15 -0
- package/dist/WeaselProvider.js.map +1 -0
- package/dist/affordances/composeAffordanceLayer.js +224 -0
- package/dist/affordances/composeAffordanceLayer.js.map +1 -0
- package/dist/affordances/cornerResize.js +69 -0
- package/dist/affordances/cornerResize.js.map +1 -0
- package/dist/affordances/hitAffordanceRegions.js +138 -0
- package/dist/affordances/hitAffordanceRegions.js.map +1 -0
- package/dist/affordances/pathAnchors.js +66 -0
- package/dist/affordances/pathAnchors.js.map +1 -0
- package/dist/affordances/rotationHandle.js +103 -0
- package/dist/affordances/rotationHandle.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +118 -0
- package/dist/animation/behaviors/momentum.js.map +1 -0
- package/dist/animation/colorHelpers.js +135 -0
- package/dist/animation/colorHelpers.js.map +1 -0
- package/dist/animation/colorRegistry.js +37 -0
- package/dist/animation/colorRegistry.js.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/loop.js +62 -0
- package/dist/animation/loop.js.map +1 -0
- package/dist/animation/observe.js +23 -0
- package/dist/animation/observe.js.map +1 -0
- package/dist/animation/poseHelpers.js +50 -0
- package/dist/animation/poseHelpers.js.map +1 -0
- package/dist/animation/reflow.js +121 -0
- package/dist/animation/reflow.js.map +1 -0
- package/dist/animation/rig/bindRig.js +74 -0
- package/dist/animation/rig/bindRig.js.map +1 -0
- package/dist/animation/rig/blendPoses.js +43 -0
- package/dist/animation/rig/blendPoses.js.map +1 -0
- package/dist/animation/rig/mirrorPose.js +19 -0
- package/dist/animation/rig/mirrorPose.js.map +1 -0
- package/dist/animation/rig/resolveSkeleton.js +33 -0
- package/dist/animation/rig/resolveSkeleton.js.map +1 -0
- package/dist/animation/rig/solveIk.js +103 -0
- package/dist/animation/rig/solveIk.js.map +1 -0
- package/dist/animation/rig/types.js +12 -0
- package/dist/animation/rig/types.js.map +1 -0
- package/dist/animation/rig/useRig.js +23 -0
- package/dist/animation/rig/useRig.js.map +1 -0
- package/dist/animation/slew.js +27 -0
- package/dist/animation/slew.js.map +1 -0
- package/dist/animation/stagger.js +138 -0
- package/dist/animation/stagger.js.map +1 -0
- package/dist/animation/timeline/booking.js +106 -0
- package/dist/animation/timeline/booking.js.map +1 -0
- package/dist/animation/timeline/createTimeline.js +116 -0
- package/dist/animation/timeline/createTimeline.js.map +1 -0
- package/dist/animation/timeline/sampleTrack.js +29 -0
- package/dist/animation/timeline/sampleTrack.js.map +1 -0
- package/dist/animation/useAnimator.js +329 -0
- package/dist/animation/useAnimator.js.map +1 -0
- package/dist/animation/wrappers/animateLifecycle.js +40 -0
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
- package/dist/animation/wrappers/animateOnSetPose.js +44 -0
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
- package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-BT_vp9FO.d.ts} +2 -2
- package/dist/{builtins-HWyuLzE-.d.ts → builtins-BSUfH8nU.d.ts} +1301 -508
- package/dist/canvas/Canvas.js +608 -0
- package/dist/canvas/Canvas.js.map +1 -0
- package/dist/canvas/CanvasView.js +255 -0
- package/dist/canvas/CanvasView.js.map +1 -0
- package/dist/canvas/CursorCoordsHud.js +75 -0
- package/dist/canvas/CursorCoordsHud.js.map +1 -0
- package/dist/canvas/DrawCanvas.js +67 -0
- package/dist/canvas/DrawCanvas.js.map +1 -0
- package/dist/canvas/MinimapCanvas.js +139 -0
- package/dist/canvas/MinimapCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +66 -0
- package/dist/canvas/ModalityHud.js.map +1 -0
- package/dist/canvas/NodeShape.js +391 -0
- package/dist/canvas/NodeShape.js.map +1 -0
- package/dist/canvas/PickHud.js +93 -0
- package/dist/canvas/PickHud.js.map +1 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
- package/dist/canvas/SceneCanvas/features.js +97 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +992 -0
- package/dist/canvas/SceneCanvas.js.map +1 -0
- package/dist/canvas/SceneViewCanvas.js +54 -0
- package/dist/canvas/SceneViewCanvas.js.map +1 -0
- package/dist/canvas/accentColor.js +9 -0
- package/dist/canvas/accentColor.js.map +1 -0
- package/dist/canvas/affordanceAt.js +63 -0
- package/dist/canvas/affordanceAt.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +65 -0
- package/dist/canvas/buildSceneTree.js.map +1 -0
- package/dist/canvas/canvasRenderer.js +89 -0
- package/dist/canvas/canvasRenderer.js.map +1 -0
- package/dist/canvas/colorOverrides.js +16 -0
- package/dist/canvas/colorOverrides.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +43 -0
- package/dist/canvas/defaultDrawOne.js.map +1 -0
- package/dist/canvas/deps/areaSelect.js +19 -0
- package/dist/canvas/deps/areaSelect.js.map +1 -0
- package/dist/canvas/deps/debug.js +9 -0
- package/dist/canvas/deps/debug.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +11 -0
- package/dist/canvas/deps/dispatcher.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +101 -0
- package/dist/canvas/deps/editAnchors.js.map +1 -0
- package/dist/canvas/deps/geometryProjection.js +11 -0
- package/dist/canvas/deps/geometryProjection.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +51 -0
- package/dist/canvas/deps/hitTestArea.js.map +1 -0
- package/dist/canvas/deps/ingestion.js +31 -0
- package/dist/canvas/deps/ingestion.js.map +1 -0
- package/dist/canvas/deps/insert.js +116 -0
- package/dist/canvas/deps/insert.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +20 -0
- package/dist/canvas/deps/lassoSelect.js.map +1 -0
- package/dist/canvas/deps/layout.js +34 -0
- package/dist/canvas/deps/layout.js.map +1 -0
- package/dist/canvas/deps/nodeAtPoint.js +19 -0
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
- package/dist/canvas/deps/poseComposition.js +11 -0
- package/dist/canvas/deps/poseComposition.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +12 -0
- package/dist/canvas/deps/poseDescriptor.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +35 -0
- package/dist/canvas/deps/resizePolicy.js.map +1 -0
- package/dist/canvas/deps/slice.js +99 -0
- package/dist/canvas/deps/slice.js.map +1 -0
- package/dist/canvas/deps/snap.js +11 -0
- package/dist/canvas/deps/snap.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -0
- package/dist/canvas/deps/textEdit.js.map +1 -0
- package/dist/canvas/deps/view.js +43 -0
- package/dist/canvas/deps/view.js.map +1 -0
- package/dist/canvas/derivedPath.js +47 -0
- package/dist/canvas/derivedPath.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +22 -0
- package/dist/canvas/drawEnvelope.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +18 -0
- package/dist/canvas/getNodeAtPoint.js.map +1 -0
- package/dist/canvas/hostAnchor.js +29 -0
- package/dist/canvas/hostAnchor.js.map +1 -0
- package/dist/canvas/hud.module.js +18 -0
- package/dist/canvas/hud.module.js.map +1 -0
- package/dist/canvas/insertPreviewExtent.js +103 -0
- package/dist/canvas/insertPreviewExtent.js.map +1 -0
- package/dist/canvas/kitRequirements.js +177 -0
- package/dist/canvas/kitRequirements.js.map +1 -0
- package/dist/canvas/layerOrder.js +66 -0
- package/dist/canvas/layerOrder.js.map +1 -0
- package/dist/canvas/layerSlots.js +14 -0
- package/dist/canvas/layerSlots.js.map +1 -0
- package/dist/canvas/minimapMath.js +80 -0
- package/dist/canvas/minimapMath.js.map +1 -0
- package/dist/canvas/mountedCanvases.js +20 -0
- package/dist/canvas/mountedCanvases.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js +17 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -0
- package/dist/canvas/paintCull.js +20 -0
- package/dist/canvas/paintCull.js.map +1 -0
- package/dist/canvas/pickWalk.js +158 -0
- package/dist/canvas/pickWalk.js.map +1 -0
- package/dist/canvas/planeClips.js +30 -0
- package/dist/canvas/planeClips.js.map +1 -0
- package/dist/canvas/poseRotation.js +35 -0
- package/dist/canvas/poseRotation.js.map +1 -0
- package/dist/canvas/rasterToPng.js +21 -0
- package/dist/canvas/rasterToPng.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +32 -0
- package/dist/canvas/renderDebugSnapshot.js.map +1 -0
- package/dist/canvas/renderNeeds.js +25 -0
- package/dist/canvas/renderNeeds.js.map +1 -0
- package/dist/canvas/renderSceneToPixels.js +143 -0
- package/dist/canvas/renderSceneToPixels.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +270 -0
- package/dist/canvas/sceneAdapter.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +37 -0
- package/dist/canvas/sceneLayerPaint.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +20 -0
- package/dist/canvas/sceneSlotWiring.js.map +1 -0
- package/dist/canvas/sceneViewRender.js +72 -0
- package/dist/canvas/sceneViewRender.js.map +1 -0
- package/dist/canvas/slopsDebugLayer.js +61 -0
- package/dist/canvas/slopsDebugLayer.js.map +1 -0
- package/dist/canvas/surfaceContribution.js +15 -0
- package/dist/canvas/surfaceContribution.js.map +1 -0
- package/dist/canvas/toolPreview.js +39 -0
- package/dist/canvas/toolPreview.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +11 -0
- package/dist/canvas/useCanvasRenderer.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +60 -0
- package/dist/canvas/useFrameLoop.js.map +1 -0
- package/dist/canvas/useHostAnchor.js +71 -0
- package/dist/canvas/useHostAnchor.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -0
- package/dist/canvas/useLateContentRedraw.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +21 -0
- package/dist/canvas/useRedrawOn.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +120 -0
- package/dist/canvas/useViewHelpers.js.map +1 -0
- package/dist/canvas/viewInputs.js +17 -0
- package/dist/canvas/viewInputs.js.map +1 -0
- package/dist/canvas/viewRegistry.js +61 -0
- package/dist/canvas/viewRegistry.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +14 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -0
- package/dist/clipboard.d.ts +10 -5
- package/dist/clipboard.js +3 -5
- package/dist/clone.d.ts +3 -3
- package/dist/clone.js +2 -5
- package/dist/core/adapters/arrayAdapter.js +85 -0
- package/dist/core/adapters/arrayAdapter.js.map +1 -0
- package/dist/core/adapters/useArrayAdapter.js +13 -0
- package/dist/core/adapters/useArrayAdapter.js.map +1 -0
- package/dist/core/applyOps.js +12 -0
- package/dist/core/applyOps.js.map +1 -0
- package/dist/core/device/index.js +4 -0
- package/dist/core/device/targets.js +17 -0
- package/dist/core/device/targets.js.map +1 -0
- package/dist/core/device/useDeviceProfile.js +75 -0
- package/dist/core/device/useDeviceProfile.js.map +1 -0
- package/dist/core/fillInPoseFrame.js +102 -0
- package/dist/core/fillInPoseFrame.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +98 -0
- package/dist/core/geometry/poseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseRotation.js +58 -0
- package/dist/core/geometry/poseRotation.js.map +1 -0
- package/dist/core/geometry/regionHit.js +102 -0
- package/dist/core/geometry/regionHit.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +60 -0
- package/dist/core/geometry/unionBounds.js.map +1 -0
- package/dist/core/gradient.js +136 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/isPlainObject.js +11 -0
- package/dist/core/isPlainObject.js.map +1 -0
- package/dist/core/layers/render.js +150 -0
- package/dist/core/layers/render.js.map +1 -0
- package/dist/core/markerInset.js +24 -0
- package/dist/core/markerInset.js.map +1 -0
- package/dist/core/mixed.js +6 -0
- package/dist/core/mixed.js.map +1 -0
- package/dist/core/ops/arrange.js +31 -0
- package/dist/core/ops/arrange.js.map +1 -0
- package/dist/core/ops/create.js +32 -0
- package/dist/core/ops/create.js.map +1 -0
- package/dist/core/ops/createHistory.js +20 -0
- package/dist/core/ops/createHistory.js.map +1 -0
- package/dist/core/ops/delete.js +89 -0
- package/dist/core/ops/delete.js.map +1 -0
- package/dist/core/ops/registry.js +17 -0
- package/dist/core/ops/registry.js.map +1 -0
- package/dist/core/ops/reorder/algorithms.js +55 -0
- package/dist/core/ops/reorder/algorithms.js.map +1 -0
- package/dist/core/ops/reorder/index.js +140 -0
- package/dist/core/ops/reorder/index.js.map +1 -0
- package/dist/core/ops/reparent.js +52 -0
- package/dist/core/ops/reparent.js.map +1 -0
- package/dist/core/ops/select.js +34 -0
- package/dist/core/ops/select.js.map +1 -0
- package/dist/core/ops/setData.js +34 -0
- package/dist/core/ops/setData.js.map +1 -0
- package/dist/core/ops/setLayer.js +34 -0
- package/dist/core/ops/setLayer.js.map +1 -0
- package/dist/core/ops/setLayout.js +31 -0
- package/dist/core/ops/setLayout.js.map +1 -0
- package/dist/core/ops/setPath.js +57 -0
- package/dist/core/ops/setPath.js.map +1 -0
- package/dist/core/ops/setText.js +34 -0
- package/dist/core/ops/setText.js.map +1 -0
- package/dist/core/ops/slot.js +37 -0
- package/dist/core/ops/slot.js.map +1 -0
- package/dist/core/ops/transform.js +42 -0
- package/dist/core/ops/transform.js.map +1 -0
- package/dist/core/paintKinds.js +156 -0
- package/dist/core/paintKinds.js.map +1 -0
- package/dist/core/scene/NodeProperties.js +20 -0
- package/dist/core/scene/NodeProperties.js.map +1 -0
- package/dist/core/scene/NodeRouting.js +24 -0
- package/dist/core/scene/NodeRouting.js.map +1 -0
- package/dist/core/scene/arrivals.js +12 -0
- package/dist/core/scene/arrivals.js.map +1 -0
- package/dist/core/scene/composeFrame.js +29 -0
- package/dist/core/scene/composeFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +18 -0
- package/dist/core/scene/depMemo.js.map +1 -0
- package/dist/core/scene/dependents.js +66 -0
- package/dist/core/scene/dependents.js.map +1 -0
- package/dist/core/scene/derivedPath.js +31 -0
- package/dist/core/scene/derivedPath.js.map +1 -0
- package/dist/core/scene/effectivePose.js +78 -0
- package/dist/core/scene/effectivePose.js.map +1 -0
- package/dist/core/scene/kitRegistry.js +33 -0
- package/dist/core/scene/kitRegistry.js.map +1 -0
- package/dist/core/scene/layoutPass.js +96 -0
- package/dist/core/scene/layoutPass.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +83 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +28 -0
- package/dist/core/scene/nodeMemo.js.map +1 -0
- package/dist/core/scene/poseFeed.js +87 -0
- package/dist/core/scene/poseFeed.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +52 -0
- package/dist/core/scene/poseOverrides.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +54 -0
- package/dist/core/scene/poseSnapshot.js.map +1 -0
- package/dist/core/scene/scene.js +1271 -0
- package/dist/core/scene/scene.js.map +1 -0
- package/dist/core/scene/types.js +6 -0
- package/dist/core/scene/types.js.map +1 -0
- package/dist/core/scene/useScene.js +32 -0
- package/dist/core/scene/useScene.js.map +1 -0
- package/dist/core/selection/chromeState.js +31 -0
- package/dist/core/selection/chromeState.js.map +1 -0
- package/dist/core/selection/selectionTarget.js +6 -0
- package/dist/core/selection/selectionTarget.js.map +1 -0
- package/dist/core/selection/useSelection.js +71 -0
- package/dist/core/selection/useSelection.js.map +1 -0
- package/dist/core/shapeKinds.js +54 -0
- package/dist/core/shapeKinds.js.map +1 -0
- package/dist/core/strokeMarkerShapes.js +139 -0
- package/dist/core/strokeMarkerShapes.js.map +1 -0
- package/dist/core/strokeMarkers.js +28 -0
- package/dist/core/strokeMarkers.js.map +1 -0
- package/dist/core/stylus/stylus.js +39 -0
- package/dist/core/stylus/stylus.js.map +1 -0
- package/dist/core/stylus/usePointerStylus.js +51 -0
- package/dist/core/stylus/usePointerStylus.js.map +1 -0
- package/dist/core/usePaintKinds.js +17 -0
- package/dist/core/usePaintKinds.js.map +1 -0
- package/dist/core/viewport/clampView.js +24 -0
- package/dist/core/viewport/clampView.js.map +1 -0
- package/dist/core/viewport/clientToWorld.js +8 -0
- package/dist/core/viewport/clientToWorld.js.map +1 -0
- package/dist/core/viewport/createVelocityTracker.js +39 -0
- package/dist/core/viewport/createVelocityTracker.js.map +1 -0
- package/dist/core/viewport/fitToBounds.js +18 -0
- package/dist/core/viewport/fitToBounds.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +36 -0
- package/dist/core/viewport/fitViewToBounds.js.map +1 -0
- package/dist/core/viewport/interpolateView.js +34 -0
- package/dist/core/viewport/interpolateView.js.map +1 -0
- package/dist/core/viewport/meanScale.js +8 -0
- package/dist/core/viewport/meanScale.js.map +1 -0
- package/dist/core/viewport/parallax.js +111 -0
- package/dist/core/viewport/parallax.js.map +1 -0
- package/dist/core/viewport/pxExtent.js +42 -0
- package/dist/core/viewport/pxExtent.js.map +1 -0
- package/dist/core/viewport/sceneNodeClientRect.js +18 -0
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
- package/dist/core/viewport/screenSlop.js +27 -0
- package/dist/core/viewport/screenSlop.js.map +1 -0
- package/dist/core/viewport/useAutoCenter.js +32 -0
- package/dist/core/viewport/useAutoCenter.js.map +1 -0
- package/dist/core/viewport/useCanvasSize.js +29 -0
- package/dist/core/viewport/useCanvasSize.js.map +1 -0
- package/dist/core/viewport/useDecayLoop.js +63 -0
- package/dist/core/viewport/useDecayLoop.js.map +1 -0
- package/dist/core/viewport/useVelocityTracker.js +10 -0
- package/dist/core/viewport/useVelocityTracker.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +63 -0
- package/dist/core/viewport/useViewAnimation.js.map +1 -0
- package/dist/core/viewport/view.js +37 -0
- package/dist/core/viewport/view.js.map +1 -0
- package/dist/core/viewport/viewTransform.js +11 -0
- package/dist/core/viewport/viewTransform.js.map +1 -0
- package/dist/core/viewport/viewportWorldRect.js +13 -0
- package/dist/core/viewport/viewportWorldRect.js.map +1 -0
- package/dist/core/viewport/wheelHandler.js +30 -0
- package/dist/core/viewport/wheelHandler.js.map +1 -0
- package/dist/core/viewport/zoomAt.js +22 -0
- package/dist/core/viewport/zoomAt.js.map +1 -0
- package/dist/core/viewport/zoomBounds.js +20 -0
- package/dist/core/viewport/zoomBounds.js.map +1 -0
- package/dist/{pointSnapToGrid-7mCcm6qG.d.ts → cornerHandles-CDcZOV8h.d.ts} +54 -71
- package/dist/debug/createDebugOverlayLayer.js +358 -0
- package/dist/debug/createDebugOverlayLayer.js.map +1 -0
- package/dist/debug/createDebugSink.js +83 -0
- package/dist/debug/createDebugSink.js.map +1 -0
- package/dist/debug/defaultTheme.js +31 -0
- package/dist/debug/defaultTheme.js.map +1 -0
- package/dist/debug/flag.js +41 -0
- package/dist/debug/flag.js.map +1 -0
- package/dist/debug/frameStats.js +16 -0
- package/dist/debug/frameStats.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +32 -0
- package/dist/debug/parseDebugFlags.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
- package/dist/features/chrome-caps/conditions.js +36 -0
- package/dist/features/chrome-caps/conditions.js.map +1 -0
- package/dist/features/chrome-caps/defaults.js +26 -0
- package/dist/features/chrome-caps/defaults.js.map +1 -0
- package/dist/features/chrome-caps/index.js +7 -0
- package/dist/features/chrome-caps/resolve.js +23 -0
- package/dist/features/chrome-caps/resolve.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +27 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
- package/dist/features/cursor/paintedCursorLayer.js +60 -0
- package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
- package/dist/features/focus/gateLayer.js +14 -0
- package/dist/features/focus/gateLayer.js.map +1 -0
- package/dist/features/focus/useCanvasFocus.js +29 -0
- package/dist/features/focus/useCanvasFocus.js.map +1 -0
- package/dist/features/groups/children.js +23 -0
- package/dist/features/groups/children.js.map +1 -0
- package/dist/features/groups/composePose.js +67 -0
- package/dist/features/groups/composePose.js.map +1 -0
- package/dist/features/groups/nestedHit.js +40 -0
- package/dist/features/groups/nestedHit.js.map +1 -0
- package/dist/features/groups/unionOfChildren.js +15 -0
- package/dist/features/groups/unionOfChildren.js.map +1 -0
- package/dist/features/images/imageCache.js +94 -0
- package/dist/features/images/imageCache.js.map +1 -0
- package/dist/features/ingestion/contentHandlers.js +37 -0
- package/dist/features/ingestion/contentHandlers.js.map +1 -0
- package/dist/features/ingestion/imageHandler.js +45 -0
- package/dist/features/ingestion/imageHandler.js.map +1 -0
- package/dist/features/ingestion/index.js +8 -0
- package/dist/features/ingestion/openFilePicker.js +15 -0
- package/dist/features/ingestion/openFilePicker.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +26 -0
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +58 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +39 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
- package/dist/features/longPress/longPressFeedback.js +96 -0
- package/dist/features/longPress/longPressFeedback.js.map +1 -0
- package/dist/features/meshPaint/bake.js +79 -0
- package/dist/features/meshPaint/bake.js.map +1 -0
- package/dist/features/meshPaint/bakeCache.js +59 -0
- package/dist/features/meshPaint/bakeCache.js.map +1 -0
- package/dist/features/meshPaint/handles.js +86 -0
- package/dist/features/meshPaint/handles.js.map +1 -0
- package/dist/features/meshPaint/lazyKind.js +1298 -0
- package/dist/features/meshPaint/lazyKind.js.map +1 -0
- package/dist/features/meshPaint/meshPaint.js +236 -0
- package/dist/features/meshPaint/meshPaint.js.map +1 -0
- package/dist/features/meshPaint/meshShader.js +6 -0
- package/dist/features/meshPaint/meshShader.js.map +1 -0
- package/dist/features/meshPaint/register.js +7 -0
- package/dist/features/meshPaint/register.js.map +1 -0
- package/dist/features/meshPaint/surface.js +110 -0
- package/dist/features/meshPaint/surface.js.map +1 -0
- package/dist/features/minimap/actions.js +53 -0
- package/dist/features/minimap/actions.js.map +1 -0
- package/dist/features/minimap/createMinimapContribution.js +96 -0
- package/dist/features/minimap/createMinimapContribution.js.map +1 -0
- package/dist/features/minimap/layers.js +103 -0
- package/dist/features/minimap/layers.js.map +1 -0
- package/dist/features/modes/modeLayers.js +113 -0
- package/dist/features/modes/modeLayers.js.map +1 -0
- package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
- package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
- package/dist/features/parallax/createParallaxLayer.js +26 -0
- package/dist/features/parallax/createParallaxLayer.js.map +1 -0
- package/dist/features/parallax/createParallaxPlane.js +26 -0
- package/dist/features/parallax/createParallaxPlane.js.map +1 -0
- package/dist/features/paths/anchorEdits.js +156 -0
- package/dist/features/paths/anchorEdits.js.map +1 -0
- package/dist/features/paths/anchors.js +154 -0
- package/dist/features/paths/anchors.js.map +1 -0
- package/dist/features/paths/booleans.js +2 -0
- package/dist/features/paths/index.js +15 -0
- package/dist/features/paths/markerCommands.js +116 -0
- package/dist/features/paths/markerCommands.js.map +1 -0
- package/dist/features/paths/markerSites.js +59 -0
- package/dist/features/paths/markerSites.js.map +1 -0
- package/dist/features/paths/markers.js +95 -0
- package/dist/features/paths/markers.js.map +1 -0
- package/dist/features/paths/nearestAnchor.js +36 -0
- package/dist/features/paths/nearestAnchor.js.map +1 -0
- package/dist/features/paths/originProjection.js +16 -0
- package/dist/features/paths/originProjection.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
- package/dist/features/paths/pathInWorld.js +41 -0
- package/dist/features/paths/pathInWorld.js.map +1 -0
- package/dist/features/paths/pathLayer.js +44 -0
- package/dist/features/paths/pathLayer.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +220 -0
- package/dist/features/paths/penPreviewLayer.js.map +1 -0
- package/dist/features/paths/poseDescriptor.js +44 -0
- package/dist/features/paths/poseDescriptor.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +230 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -0
- package/dist/features/patterns/index.js +23 -0
- package/dist/features/patterns/index.js.map +1 -0
- package/dist/features/patterns/patterns-builtin.js +38 -0
- package/dist/features/patterns/patterns-builtin.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +57 -0
- package/dist/features/patterns/resolveSpec.js.map +1 -0
- package/dist/features/patterns/tileGeometry.js +158 -0
- package/dist/features/patterns/tileGeometry.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +45 -0
- package/dist/features/pointer/PointerContext.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +70 -0
- package/dist/features/poseRun/usePoseRun.js.map +1 -0
- package/dist/features/selection/SelectionContext.js +46 -0
- package/dist/features/selection/SelectionContext.js.map +1 -0
- package/dist/features/selection/overlay.js +442 -0
- package/dist/features/selection/overlay.js.map +1 -0
- package/dist/features/simulation/createSimulation.js +61 -0
- package/dist/features/simulation/createSimulation.js.map +1 -0
- package/dist/features/simulation/types.js +6 -0
- package/dist/features/simulation/types.js.map +1 -0
- package/dist/features/simulation/useSimulation.js +74 -0
- package/dist/features/simulation/useSimulation.js.map +1 -0
- package/dist/features/text/domRuns.js +258 -0
- package/dist/features/text/domRuns.js.map +1 -0
- package/dist/features/text/fitTextPose.js +38 -0
- package/dist/features/text/fitTextPose.js.map +1 -0
- package/dist/features/text/hitTest.js +45 -0
- package/dist/features/text/hitTest.js.map +1 -0
- package/dist/features/text/renderLabel.js +14 -0
- package/dist/features/text/renderLabel.js.map +1 -0
- package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
- package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
- package/dist/features/text/runs/flagRange.js +53 -0
- package/dist/features/text/runs/flagRange.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +135 -0
- package/dist/features/text/runs/rangeStyle.js.map +1 -0
- package/dist/features/text/textCommand.js +59 -0
- package/dist/features/text/textCommand.js.map +1 -0
- package/dist/features/text/textLayer.js +35 -0
- package/dist/features/text/textLayer.js.map +1 -0
- package/dist/features/text/textToPath.js +181 -0
- package/dist/features/text/textToPath.js.map +1 -0
- package/dist/features/text/useSceneTextEdit.js +138 -0
- package/dist/features/text/useSceneTextEdit.js.map +1 -0
- package/dist/features/text/useTextEdit.js +465 -0
- package/dist/features/text/useTextEdit.js.map +1 -0
- package/dist/features/tiling/createTiledLayer.js +63 -0
- package/dist/features/tiling/createTiledLayer.js.map +1 -0
- package/dist/features/tiling/tiledProject.js +14 -0
- package/dist/features/tiling/tiledProject.js.map +1 -0
- package/dist/features/viewports/viewResolver.js +59 -0
- package/dist/features/viewports/viewResolver.js.map +1 -0
- package/dist/features/viewports/viewportLayer.js +58 -0
- package/dist/features/viewports/viewportLayer.js.map +1 -0
- package/dist/icons/ArrowIcon.js +23 -0
- package/dist/icons/ArrowIcon.js.map +1 -0
- package/dist/icons/EllipseIcon.js +21 -0
- package/dist/icons/EllipseIcon.js.map +1 -0
- package/dist/icons/EyedropperIcon.js +49 -0
- package/dist/icons/EyedropperIcon.js.map +1 -0
- package/dist/icons/HandIcon.js +59 -0
- package/dist/icons/HandIcon.js.map +1 -0
- package/dist/icons/ImageIcon.js +34 -0
- package/dist/icons/ImageIcon.js.map +1 -0
- package/dist/icons/LassoIcon.js +22 -0
- package/dist/icons/LassoIcon.js.map +1 -0
- package/dist/icons/LineIcon.js +22 -0
- package/dist/icons/LineIcon.js.map +1 -0
- package/dist/icons/PenIcon.js +36 -0
- package/dist/icons/PenIcon.js.map +1 -0
- package/dist/icons/PencilIcon.js +25 -0
- package/dist/icons/PencilIcon.js.map +1 -0
- package/dist/icons/PolygonIcon.js +19 -0
- package/dist/icons/PolygonIcon.js.map +1 -0
- package/dist/icons/RectIcon.js +37 -0
- package/dist/icons/RectIcon.js.map +1 -0
- package/dist/icons/SelectIcon.js +20 -0
- package/dist/icons/SelectIcon.js.map +1 -0
- package/dist/icons/StarIcon.js +19 -0
- package/dist/icons/StarIcon.js.map +1 -0
- package/dist/icons/TextIcon.js +19 -0
- package/dist/icons/TextIcon.js.map +1 -0
- package/dist/icons/UnknownIcon.js +33 -0
- package/dist/icons/UnknownIcon.js.map +1 -0
- package/dist/icons/_base.js +12 -0
- package/dist/icons/_base.js.map +1 -0
- package/dist/index.css +2 -86
- package/dist/index.d.ts +2349 -2609
- package/dist/index.js +312 -13
- package/dist/input/keyState.js +76 -0
- package/dist/input/keyState.js.map +1 -0
- package/dist/input/useKeyState.js +22 -0
- package/dist/input/useKeyState.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js +32 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -0
- package/dist/interactions/actions/align/align.js +81 -0
- package/dist/interactions/actions/align/align.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +120 -0
- package/dist/interactions/actions/booleans/booleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +20 -0
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
- package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
- package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
- package/dist/interactions/actions/defaults/align.js +71 -0
- package/dist/interactions/actions/defaults/align.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js +75 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/booleans.js +52 -0
- package/dist/interactions/actions/defaults/booleans.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
- package/dist/interactions/actions/defaults/clearSelection.js +19 -0
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/clipboard.js +78 -0
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
- package/dist/interactions/actions/defaults/clone.js +96 -0
- package/dist/interactions/actions/defaults/clone.js.map +1 -0
- package/dist/interactions/actions/defaults/createOutlines.js +47 -0
- package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
- package/dist/interactions/actions/defaults/delete.js +61 -0
- package/dist/interactions/actions/defaults/delete.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +66 -0
- package/dist/interactions/actions/defaults/distribute.js.map +1 -0
- package/dist/interactions/actions/defaults/duplicate.js +83 -0
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
- package/dist/interactions/actions/defaults/editAnchors.js +100 -0
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/escape.js +26 -0
- package/dist/interactions/actions/defaults/escape.js.map +1 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/flip.js +119 -0
- package/dist/interactions/actions/defaults/flip.js.map +1 -0
- package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
- package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
- package/dist/interactions/actions/defaults/group.js +131 -0
- package/dist/interactions/actions/defaults/group.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/ingest.js +58 -0
- package/dist/interactions/actions/defaults/ingest.js.map +1 -0
- package/dist/interactions/actions/defaults/insert.js +288 -0
- package/dist/interactions/actions/defaults/insert.js.map +1 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
- package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/move.js +656 -0
- package/dist/interactions/actions/defaults/move.js.map +1 -0
- package/dist/interactions/actions/defaults/nudge.js +110 -0
- package/dist/interactions/actions/defaults/nudge.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +143 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -0
- package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/resize.js +332 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +181 -0
- package/dist/interactions/actions/defaults/rotate.js.map +1 -0
- package/dist/interactions/actions/defaults/selectAll.js +27 -0
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +27 -0
- package/dist/interactions/actions/defaults/setFill.js.map +1 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/setStroke.js +36 -0
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/slice.js +39 -0
- package/dist/interactions/actions/defaults/slice.js.map +1 -0
- package/dist/interactions/actions/defaults/sliceOps.js +60 -0
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
- package/dist/interactions/actions/defaults/toolActivate.js +35 -0
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
- package/dist/interactions/actions/defaults/undoRedo.js +51 -0
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +42 -0
- package/dist/interactions/actions/distribute/distribute.js.map +1 -0
- package/dist/interactions/actions/distribute/plan.js +29 -0
- package/dist/interactions/actions/distribute/plan.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +43 -0
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +35 -0
- package/dist/interactions/actions/flip/helpers.js.map +1 -0
- package/dist/interactions/actions/geometryProjection.js +18 -0
- package/dist/interactions/actions/geometryProjection.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +44 -0
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +37 -0
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +84 -0
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +168 -0
- package/dist/interactions/actions/planeInput.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +9 -0
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
- package/dist/interactions/actions/poseFrame.js +38 -0
- package/dist/interactions/actions/poseFrame.js.map +1 -0
- package/dist/interactions/actions/previewOverrides.js +25 -0
- package/dist/interactions/actions/previewOverrides.js.map +1 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +32 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/index.js +8 -0
- package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
- package/dist/interactions/actions/resize/cornerHandles.js +72 -0
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +60 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -0
- package/dist/interactions/actions/resolvePreviews.js +61 -0
- package/dist/interactions/actions/resolvePreviews.js.map +1 -0
- package/dist/interactions/actions/rotate/geometry.js +46 -0
- package/dist/interactions/actions/rotate/geometry.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +27 -0
- package/dist/interactions/actions/rotate/handle.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js +42 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +142 -0
- package/dist/interactions/actions/useStandardActions.js.map +1 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
- package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
- package/dist/interactions/gestures/shared/originProjection.js +42 -0
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
- package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
- package/dist/interactions/gestures/shared/snap.js +24 -0
- package/dist/interactions/gestures/shared/snap.js.map +1 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
- package/dist/layout/arrivals.js +36 -0
- package/dist/layout/arrivals.js.map +1 -0
- package/dist/{math-MCQcf_gc.d.ts → math-CUMxmZzn.d.ts} +8 -116
- package/dist/math.d.ts +4 -5
- package/dist/math.js +6 -4
- package/dist/mesh.d.ts +268 -0
- package/dist/mesh.js +7 -0
- package/dist/move.d.ts +7 -48
- package/dist/move.js +3 -142
- package/dist/originProjection-BSn4xiEy.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
- package/dist/registerProgram-ateHDGjw.d.ts +193 -0
- package/dist/renderer/DrawCommand.js +6 -0
- package/dist/renderer/DrawCommand.js.map +1 -0
- package/dist/renderer/WeaselRenderer.js +328 -0
- package/dist/renderer/WeaselRenderer.js.map +1 -0
- package/dist/renderer/cache/GLImageCache.js +64 -0
- package/dist/renderer/cache/GLImageCache.js.map +1 -0
- package/dist/renderer/cache/GLMeshCache.js +102 -0
- package/dist/renderer/cache/GLMeshCache.js.map +1 -0
- package/dist/renderer/cache/GLTextureCache.js +51 -0
- package/dist/renderer/cache/GLTextureCache.js.map +1 -0
- package/dist/renderer/cache/GradientRampAtlas.js +82 -0
- package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
- package/dist/renderer/cache/cache.js +13 -0
- package/dist/renderer/cache/cache.js.map +1 -0
- package/dist/renderer/cache/markerCommandCache.js +59 -0
- package/dist/renderer/cache/markerCommandCache.js.map +1 -0
- package/dist/renderer/cache/outlineMeshCache.js +15 -0
- package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
- package/dist/renderer/cache/strokeMeshCache.js +44 -0
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
- package/dist/renderer/cullDrawCommands.js +89 -0
- package/dist/renderer/cullDrawCommands.js.map +1 -0
- package/dist/renderer/draw.js +1109 -0
- package/dist/renderer/draw.js.map +1 -0
- package/dist/renderer/drawBatch.js +168 -0
- package/dist/renderer/drawBatch.js.map +1 -0
- package/dist/renderer/effects/EffectTargets.js +45 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -0
- package/dist/renderer/effects/builtins.js +31 -0
- package/dist/renderer/effects/builtins.js.map +1 -0
- package/dist/renderer/effects/composite.js +9 -0
- package/dist/renderer/effects/composite.js.map +1 -0
- package/dist/renderer/effects/effectPrelude.js +10 -0
- package/dist/renderer/effects/effectPrelude.js.map +1 -0
- package/dist/renderer/effects/types.js +10 -0
- package/dist/renderer/effects/types.js.map +1 -0
- package/dist/renderer/index.js +19 -0
- package/dist/renderer/math/color.js +341 -0
- package/dist/renderer/math/color.js.map +1 -0
- package/dist/renderer/math/mat3.js +71 -0
- package/dist/renderer/math/mat3.js.map +1 -0
- package/dist/renderer/math/patternSpace.js +22 -0
- package/dist/renderer/math/patternSpace.js.map +1 -0
- package/dist/renderer/math/viewToMat3.js +19 -0
- package/dist/renderer/math/viewToMat3.js.map +1 -0
- package/dist/renderer/paintResources.js +18 -0
- package/dist/renderer/paintResources.js.map +1 -0
- package/dist/renderer/paintScratch.js +37 -0
- package/dist/renderer/paintScratch.js.map +1 -0
- package/dist/renderer/shaders/ShaderProgram.js +74 -0
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
- package/dist/renderer/shaders/batchFill.js +118 -0
- package/dist/renderer/shaders/batchFill.js.map +1 -0
- package/dist/renderer/shaders/customPrelude.js +34 -0
- package/dist/renderer/shaders/customPrelude.js.map +1 -0
- package/dist/renderer/shaders/extractUniformNames.js +184 -0
- package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
- package/dist/renderer/shaders/glyphPaint.js +61 -0
- package/dist/renderer/shaders/glyphPaint.js.map +1 -0
- package/dist/renderer/shaders/gradFill.js +30 -0
- package/dist/renderer/shaders/gradFill.js.map +1 -0
- package/dist/renderer/shaders/imageFill.js +14 -0
- package/dist/renderer/shaders/imageFill.js.map +1 -0
- package/dist/renderer/shaders/pathFill.js +13 -0
- package/dist/renderer/shaders/pathFill.js.map +1 -0
- package/dist/renderer/shaders/patternFill.js +24 -0
- package/dist/renderer/shaders/patternFill.js.map +1 -0
- package/dist/renderer/shaders/registerProgram.js +18 -0
- package/dist/renderer/shaders/registerProgram.js.map +1 -0
- package/dist/renderer/spriteSheet.js +14 -0
- package/dist/renderer/spriteSheet.js.map +1 -0
- package/dist/renderer/state/GroupState.js +77 -0
- package/dist/renderer/state/GroupState.js.map +1 -0
- package/dist/renderer/syntheticItalic.js +6 -0
- package/dist/renderer/syntheticItalic.js.map +1 -0
- package/dist/renderer/textures/registerTexture.js +14 -0
- package/dist/renderer/textures/registerTexture.js.map +1 -0
- package/dist/renderer.d.ts +18 -20
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.d.ts +1 -1
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/test-hook/createTestHook.js +39 -0
- package/dist/test-hook/createTestHook.js.map +1 -0
- package/dist/test-hook/install.js +12 -0
- package/dist/test-hook/install.js.map +1 -0
- package/dist/test-seams-fYf6m5pu.d.ts +356 -0
- package/dist/test-seams.d.ts +6 -0
- package/dist/test-seams.js +3 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
- package/dist/tools/builtin/hand/useHandTool.js +31 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
- package/dist/tools/builtin/image/useImageTool.js +41 -0
- package/dist/tools/builtin/image/useImageTool.js.map +1 -0
- package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/builtin/line/useLineTool.js +33 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +414 -0
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
- package/dist/tools/builtin/pickTopMostHit.js +45 -0
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/builtin/rect/useRectTool.js +32 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +109 -0
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
- package/dist/tools/builtin/select/useSelectTool.js +162 -0
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
- package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +263 -0
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
- package/dist/tools/builtin/star/useStarTool.js +82 -0
- package/dist/tools/builtin/star/useStarTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +177 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -0
- package/dist/tools/overlayBinding.js +8 -0
- package/dist/tools/overlayBinding.js.map +1 -0
- package/dist/tools/prefs.js +47 -0
- package/dist/tools/prefs.js.map +1 -0
- package/dist/tools/useKeybindings.js +66 -0
- package/dist/tools/useKeybindings.js.map +1 -0
- package/dist/{types-CxC8P6W0.d.ts → types-CA54-mAZ.d.ts} +188 -17
- package/dist/{types-D_74YlWs.d.ts → types-DSjd6W3n.d.ts} +35 -12
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -18
- package/dist/chunk-44EWMJV2.js +0 -128
- package/dist/chunk-44EWMJV2.js.map +0 -1
- package/dist/chunk-4RJP2N2L.js +0 -143
- package/dist/chunk-4RJP2N2L.js.map +0 -1
- package/dist/chunk-BJN5ZRIJ.js +0 -167
- package/dist/chunk-BJN5ZRIJ.js.map +0 -1
- package/dist/chunk-D4AAWR64.js +0 -28
- package/dist/chunk-D4AAWR64.js.map +0 -1
- package/dist/chunk-DOBSZOPR.js +0 -29
- package/dist/chunk-DOBSZOPR.js.map +0 -1
- package/dist/chunk-H6N2JSZ3.js +0 -248
- package/dist/chunk-H6N2JSZ3.js.map +0 -1
- package/dist/chunk-HPFJUUTF.js +0 -167
- package/dist/chunk-HPFJUUTF.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-MZAIDI6D.js +0 -32492
- package/dist/chunk-MZAIDI6D.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-RMR4QMM6.js +0 -250
- package/dist/chunk-RMR4QMM6.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-BXdz8GF2.d.ts +0 -158
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -37
- package/dist/insert.js +0 -81
- package/dist/insert.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/move.js.map +0 -1
- package/dist/options-CzjxFoYZ.d.ts +0 -67
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -86
- package/dist/renderer.css.map +0 -1
- package/dist/renderer.js.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/routing.js.map +0 -1
- package/dist/types-D2tTKEU0.d.ts +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapBackOrDelete.js","names":["SNAPSHOTS","scratchKey","INDEXES","snapBackOrDelete","args","proj","AUTO_ORIGIN_PROJECTION","r2","radius","snapshots","indexes","nodes","ctx","id","obj","n","setScratch","o0","o1","dx","dy","onFreeRelease","getScratch","index","createDeleteOp","deleteLabel"],"sources":["../../../../../src/interactions/actions/move/behaviors/snapBackOrDelete.ts"],"sourcesContent":["import { createDeleteOp } from 'core/ops/delete';\nimport type { Op } from 'core/ops/types';\nimport type { MoveBehavior } from '../../../gestures/types';\nimport {\n AUTO_ORIGIN_PROJECTION,\n type OriginProjection,\n} from '../../../gestures/shared/originProjection';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\nconst SNAPSHOTS = scratchKey<Map<string, { id: string }>>('snapBackOrDelete.snapshots');\nconst INDEXES = scratchKey<Map<string, number>>('snapBackOrDelete.indexes');\n\n/**\n * Move behavior for a drag that is only meaningful near where it started:\n * release inside `radius` and the node returns to its original pose; release\n * outside it and the node either springs back anyway or is deleted, per\n * `onFreeRelease`. A deletion is recorded as an undoable op with paint order\n * preserved.\n */\nexport function snapBackOrDelete<TPose extends { x: number; y: number }>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n}): MoveBehavior<TPose>;\n/** As above, for a `TPose` that is not a rect: `origin` tells the behavior how\n * to read and write the pose's origin. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin: OriginProjection<TPose>;\n}): MoveBehavior<TPose>;\n/** Snap back to the origin pose, or delete, depending on where the drag is\n * released. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin?: OriginProjection<TPose>;\n}): MoveBehavior<TPose> {\n const { radius, onFreeRelease, deleteLabel = 'Delete' } = args;\n const proj: OriginProjection<TPose> =\n args.origin ?? (AUTO_ORIGIN_PROJECTION as unknown as OriginProjection<TPose>);\n const r2 = radius * radius;\n\n return {\n onStart(ctx) {\n // Snapshot the dragged objects + their z-indexes at gesture start so\n // delete can undo with paint order intact.\n const snapshots = new Map<string, { id: string }>();\n const indexes = new Map<string, number>();\n const nodes = ctx.adapter.getNodes();\n for (const id of ctx.draggedIds) {\n const obj = ctx.adapter.getNode(id) ?? { id };\n snapshots.set(id, obj);\n indexes.set(id, nodes.findIndex((n) => n.id === id));\n }\n setScratch(ctx.scratch, SNAPSHOTS, snapshots);\n setScratch(ctx.scratch, INDEXES, indexes);\n },\n\n onEnd(ctx) {\n if (ctx.snap) return;\n const id = ctx.draggedIds[0];\n const o0 = proj.getOrigin(ctx.origin.get(id)!);\n const o1 = proj.getOrigin(ctx.current.get(id)!);\n const dx = o1.x - o0.x;\n const dy = o1.y - o0.y;\n const within = dx * dx + dy * dy <= r2;\n if (within) {\n return null;\n }\n if (onFreeRelease === 'delete') {\n const snapshots = getScratch(ctx.scratch, SNAPSHOTS);\n const indexes = getScratch(ctx.scratch, INDEXES);\n const obj = snapshots?.get(id) ?? { id };\n const index = indexes?.get(id) ?? -1;\n const ops: Op[] = [createDeleteOp({ node: obj, label: deleteLabel, index })];\n return ops;\n }\n // `'snap-back'` — abort, same as a release inside the radius. Returning\n // `undefined` would defer to the default translate and leave the node\n // where it was dropped, which is the one thing this policy rules out.\n return null;\n },\n };\n}\n"],"mappings":";;;;AASA,IAAMA,IAAYC,EAAwC,4BAA4B,GAChFC,IAAUD,EAAgC,0BAA0B;AAwB1E,SAAgBE,EAAwB,GAKhB;CACtB,IAAM,EAAE,WAAQ,kBAAe,iBAAc,aAAaC,GACpDC,IACJD,EAAK,UAAWE,GACZC,IAAKC,IAASA;CAEpB,OAAO;EACL,QAAQ,GAAK;GAGX,IAAMC,oBAAY,IAAI,IAA4B,GAC5CC,oBAAU,IAAI,IAAoB,GAClCC,IAAQC,EAAI,QAAQ,SAAS;GACnC,KAAK,IAAMC,KAAMD,EAAI,YAAY;IAC/B,IAAME,IAAMF,EAAI,QAAQ,QAAQC,CAAE,KAAK,EAAE,MAAG;IAE5C,AADAJ,EAAU,IAAII,GAAIC,CAAG,GACrBJ,EAAQ,IAAIG,GAAIF,EAAM,WAAW,MAAMI,EAAE,OAAOF,CAAE,CAAC;GACrD;GAEA,AADAG,EAAWJ,EAAI,SAASZ,GAAWS,CAAS,GAC5CO,EAAWJ,EAAI,SAASV,GAASQ,CAAO;EAC1C;EAEA,MAAM,GAAK;GACT,IAAIE,EAAI,MAAM;GACd,IAAMC,IAAKD,EAAI,WAAW,IACpBK,IAAKZ,EAAK,UAAUO,EAAI,OAAO,IAAIC,CAAE,CAAE,GACvCK,IAAKb,EAAK,UAAUO,EAAI,QAAQ,IAAIC,CAAE,CAAE,GACxCM,IAAKD,EAAG,IAAID,EAAG,GACfG,IAAKF,EAAG,IAAID,EAAG;GAErB,IADeE,IAAKA,IAAKC,IAAKA,KAAMb,GAElC,OAAO;GAET,IAAIc,MAAkB,UAAU;IAC9B,IAAMZ,IAAYa,EAAWV,EAAI,SAASZ,CAAS,GAC7CU,IAAUY,EAAWV,EAAI,SAASV,CAAO,GACzCY,IAAML,GAAW,IAAII,CAAE,KAAK,EAAE,MAAG,GACjCU,IAAQb,GAAS,IAAIG,CAAE,KAAK;IAElC,OAAO,CADYW,EAAe;KAAE,MAAMV;KAAK,OAAOW;KAAa;IAAM,CAAC,CACnE;GACT;GAIA,OAAO;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createTransformOp as e } from "../../../../core/ops/transform.js";
|
|
2
|
+
import { createReparentOp as t } from "../../../../core/ops/reparent.js";
|
|
3
|
+
import { getScratch as n, scratchKey as r, setScratch as i } from "@weasel-js/routing";
|
|
4
|
+
//#region src/interactions/actions/move/behaviors/snapToContainer.ts
|
|
5
|
+
var a = r("snapToContainer");
|
|
6
|
+
function o(e) {
|
|
7
|
+
let t = n(e.scratch, a);
|
|
8
|
+
return t || (t = {
|
|
9
|
+
pendingTargetId: null,
|
|
10
|
+
pendingTimer: null,
|
|
11
|
+
committedSnap: null
|
|
12
|
+
}, i(e.scratch, a, t)), t;
|
|
13
|
+
}
|
|
14
|
+
function s(e) {
|
|
15
|
+
e.pendingTimer !== null && (clearTimeout(e.pendingTimer), e.pendingTimer = null), e.pendingTargetId = null;
|
|
16
|
+
}
|
|
17
|
+
function c(n) {
|
|
18
|
+
let { dwellMs: r, findTarget: i, isInstant: a, moveLabel: c = "Move", reparentLabel: l = "Move and reparent" } = n;
|
|
19
|
+
return {
|
|
20
|
+
onMove(e, t) {
|
|
21
|
+
let n = o(e), c = i(e.draggedIds[0], e.pointer.worldX, e.pointer.worldY);
|
|
22
|
+
if (n.committedSnap) {
|
|
23
|
+
if (c && c.parentId === n.committedSnap.parentId) return {
|
|
24
|
+
pose: n.committedSnap.slotPose,
|
|
25
|
+
snap: n.committedSnap
|
|
26
|
+
};
|
|
27
|
+
n.committedSnap = null;
|
|
28
|
+
}
|
|
29
|
+
if (!c) {
|
|
30
|
+
s(n);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (a?.(c)) return s(n), n.committedSnap = c, {
|
|
34
|
+
pose: c.slotPose,
|
|
35
|
+
snap: c
|
|
36
|
+
};
|
|
37
|
+
n.pendingTargetId !== c.parentId && (s(n), n.pendingTargetId = c.parentId, n.pendingTimer = setTimeout(() => {
|
|
38
|
+
n.committedSnap = c, n.pendingTimer = null;
|
|
39
|
+
}, r));
|
|
40
|
+
},
|
|
41
|
+
onCancel(e) {
|
|
42
|
+
s(o(e));
|
|
43
|
+
},
|
|
44
|
+
onEnd(n) {
|
|
45
|
+
let r = o(n);
|
|
46
|
+
s(r);
|
|
47
|
+
let i = r.committedSnap ?? n.snap;
|
|
48
|
+
if (!i) return;
|
|
49
|
+
let a = n.draggedIds[0], u = n.adapter.getParent?.(a) ?? null, d = n.origin.get(a), f = [e({
|
|
50
|
+
id: a,
|
|
51
|
+
from: d,
|
|
52
|
+
to: i.slotPose,
|
|
53
|
+
label: c
|
|
54
|
+
})];
|
|
55
|
+
return u !== i.parentId && f.push(t({
|
|
56
|
+
id: a,
|
|
57
|
+
fromParentId: u,
|
|
58
|
+
toParentId: i.parentId,
|
|
59
|
+
label: l
|
|
60
|
+
})), f;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { c as snapToContainer };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=snapToContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapToContainer.js","names":["STATE","scratchKey","getState","s","getScratch","ctx","setScratch","clearTimer","snapToContainer","args","target","findTarget","isInstant","dwellMs","snap","draggedId","oldParent","fromPose","ops","createTransformOp","moveLabel","createReparentOp","reparentLabel"],"sources":["../../../../../src/interactions/actions/move/behaviors/snapToContainer.ts"],"sourcesContent":["import { createTransformOp } from 'core/ops/transform';\nimport { createReparentOp } from 'core/ops/reparent';\nimport type { Op } from 'core/ops/types';\nimport type { SnapTarget } from 'core/adapters/types';\nimport type { MoveBehavior, GestureContext } from '../../../gestures/types';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\ninterface SnapState<TPose> {\n pendingTargetId: string | null;\n pendingTimer: ReturnType<typeof setTimeout> | null;\n committedSnap: SnapTarget<TPose> | null;\n}\n\n// The slot is generic over TPose; we keep the unknown-pose key at module\n// scope and project it through `as` at the read site (each consumer call\n// of `snapToContainer<TPose>` is the only writer of its own SnapState\n// instance, so the cast is safe at runtime).\nconst STATE = scratchKey<SnapState<unknown>>('snapToContainer');\n\nfunction getState<TPose>(ctx: GestureContext<TPose>): SnapState<TPose> {\n let s = getScratch(ctx.scratch, STATE) as SnapState<TPose> | undefined;\n if (!s) {\n s = { pendingTargetId: null, pendingTimer: null, committedSnap: null };\n setScratch(ctx.scratch, STATE, s as SnapState<unknown>);\n }\n return s;\n}\n\nfunction clearTimer<TPose>(s: SnapState<TPose>) {\n if (s.pendingTimer !== null) {\n clearTimeout(s.pendingTimer);\n s.pendingTimer = null;\n }\n s.pendingTargetId = null;\n}\n\n/**\n * Move behavior that drops the dragged node into a container it hovers over\n * for `dwellMs`, reparenting it and taking the pose the container's layout\n * assigns.\n *\n * The dwell is what keeps a drag that merely passes over a container from\n * being captured by it.\n */\nexport function snapToContainer<TPose>(args: {\n dwellMs: number;\n findTarget: (\n draggedId: string,\n worldX: number,\n worldY: number,\n ) => SnapTarget<TPose> | null;\n isInstant?: (target: SnapTarget<TPose>) => boolean;\n moveLabel?: string;\n reparentLabel?: string;\n}): MoveBehavior<TPose> {\n const { dwellMs, findTarget, isInstant, moveLabel = 'Move', reparentLabel = 'Move and reparent' } = args;\n\n return {\n onMove(ctx, _proposed) {\n const s = getState<TPose>(ctx);\n const target = findTarget(ctx.draggedIds[0], ctx.pointer.worldX, ctx.pointer.worldY);\n\n if (s.committedSnap) {\n if (target && target.parentId === s.committedSnap.parentId) {\n return { pose: s.committedSnap.slotPose, snap: s.committedSnap };\n }\n s.committedSnap = null;\n }\n\n if (!target) {\n clearTimer(s);\n return;\n }\n\n if (isInstant?.(target)) {\n clearTimer(s);\n s.committedSnap = target;\n return { pose: target.slotPose, snap: target };\n }\n\n if (s.pendingTargetId === target.parentId) {\n return;\n }\n clearTimer(s);\n s.pendingTargetId = target.parentId;\n s.pendingTimer = setTimeout(() => {\n s.committedSnap = target;\n s.pendingTimer = null;\n }, dwellMs);\n return;\n },\n\n onCancel(ctx) { clearTimer(getState<TPose>(ctx)); },\n\n onEnd(ctx) {\n const s = getState<TPose>(ctx);\n clearTimer(s);\n const snap = s.committedSnap ?? ctx.snap;\n if (!snap) return;\n const draggedId = ctx.draggedIds[0];\n const oldParent = ctx.adapter.getParent?.(draggedId) ?? null;\n const fromPose = ctx.origin.get(draggedId)!;\n const ops: Op[] = [\n createTransformOp<TPose>({\n id: draggedId,\n from: fromPose,\n to: snap.slotPose,\n label: moveLabel,\n }),\n ];\n if (oldParent !== snap.parentId) {\n ops.push(createReparentOp({\n id: draggedId,\n fromParentId: oldParent,\n toParentId: snap.parentId,\n label: reparentLabel,\n }));\n }\n return ops;\n },\n };\n}\n"],"mappings":";;;;AAiBA,IAAMA,IAAQC,EAA+B,iBAAiB;AAE9D,SAASC,EAAgB,GAA8C;CACrE,IAAIC,IAAIC,EAAWC,EAAI,SAASL,CAAK;CAKrC,OAJKG,MACH,IAAI;EAAE,iBAAiB;EAAM,cAAc;EAAM,eAAe;CAAK,GACrEG,EAAWD,EAAI,SAASL,GAAOG,CAAuB,IAEjDA;AACT;AAEA,SAASI,EAAkB,GAAqB;CAK9C,AAJIJ,EAAE,iBAAiB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,OAAOM;GACT,CAAC,CACH;GASA,OARIJ,MAAcF,EAAK,YACrBI,EAAI,KAAKG,EAAiB;IACxB,IAAIN;IACJ,cAAcC;IACd,YAAYF,EAAK;IACjB,OAAOQ;GACT,CAAC,CAAC,GAEGJ;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { documentPose as e } from "../../../core/scene/effectivePose.js";
|
|
2
|
+
import { asNodeId as t } from "../../../core/scene/types.js";
|
|
3
|
+
import { fnFieldsOfNode as n } from "../../../core/scene/nodeFnFields.js";
|
|
4
|
+
//#region src/interactions/actions/move/gestureAdapter.ts
|
|
5
|
+
function r(r) {
|
|
6
|
+
return {
|
|
7
|
+
getNode: (e) => r.get(t(e)),
|
|
8
|
+
getNodes: () => [...r.renderOrderNodes()],
|
|
9
|
+
getPose: (n) => e(r, r.get(t(n))),
|
|
10
|
+
getParent: (e) => r.get(t(e))?.parent ?? null,
|
|
11
|
+
setPose: (e, n) => r.setPose(t(e), n),
|
|
12
|
+
setParent: (e, n) => r.move(t(e), n === null ? null : t(n)),
|
|
13
|
+
setData: (e, n) => r.update(t(e), { data: n }),
|
|
14
|
+
removeNode: (e) => r.remove(t(e)),
|
|
15
|
+
insertNode: (e, t) => r.add({
|
|
16
|
+
kind: e.kind,
|
|
17
|
+
layer: e.layer,
|
|
18
|
+
pose: e.pose,
|
|
19
|
+
data: e.data,
|
|
20
|
+
id: e.id,
|
|
21
|
+
...t === void 0 ? {} : { index: t },
|
|
22
|
+
...e.parent === null ? {} : { parent: e.parent },
|
|
23
|
+
...e.dependsOn === void 0 ? {} : { dependsOn: e.dependsOn },
|
|
24
|
+
...n(e)
|
|
25
|
+
}),
|
|
26
|
+
getChildren: (e) => e === null ? [...r.roots] : [...r.childrenOf(t(e))],
|
|
27
|
+
setChildOrder: (e, n) => {
|
|
28
|
+
r.batch("Reorder", () => {
|
|
29
|
+
for (let i = 0; i < n.length; i++) (e === null ? r.roots : r.childrenOf(t(e)))[i] !== n[i] && r.reorder(t(n[i]), i);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { r as moveGestureAdapter };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=gestureAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestureAdapter.js","names":["moveGestureAdapter","scene","asNodeId","id","documentPose","pose","parentId","node","index","fnFieldsOfNode","ids"],"sources":["../../../../src/interactions/actions/move/gestureAdapter.ts"],"sourcesContent":["/**\n * Minimal scene-backed adapter for the move behavior pipeline.\n *\n * Lives in `interactions/` rather than reusing `canvas/sceneAdapter.ts` so the\n * move action does not import from `canvas/` (that back-edge would create an\n * `interactions → canvas → interactions` cycle). Carries exactly the methods\n * the move behaviors call (`getParent` / `getNodes` / `getNode`) plus the\n * mutators the committed ops apply through (`setPose` / `setParent` /\n * `setData` / `removeNode` / `insertNode` — `setData` carries the\n * geometryProjection seam's data-sync op) and the sibling-order seam\n * (`getChildren` / `setChildOrder`) those ops read to restore a node's slot.\n */\nimport { documentPose } from 'core/scene/effectivePose';\nimport { fnFieldsOfNode } from 'core/scene/nodeFnFields';\nimport type { Node, Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { MoveAdapter } from 'core/adapters/types';\n\nexport type MoveGestureAdapter<TPose> = MoveAdapter<Node<unknown, string, TPose>, TPose> & {\n /** Required override — this adapter always provides parent lookup. */\n getParent(id: string): string | null;\n setParent(id: string, parentId: string | null): void;\n setData(id: string, data: unknown): void;\n removeNode(id: string): void;\n insertNode(node: Node<unknown, string, TPose>, index?: number): void;\n getChildren(parentId: string | null): string[];\n setChildOrder(parentId: string | null, ids: string[]): void;\n};\n\nexport function moveGestureAdapter<TPose>(\n scene: Scene<unknown, string, TPose>,\n): MoveGestureAdapter<TPose> {\n return {\n getNode: (id) => scene.get(asNodeId(id)),\n getNodes: () => {\n return [...scene.renderOrderNodes()] as Node<unknown, string, TPose>[];\n },\n getPose: (id) => documentPose(scene, scene.get(asNodeId(id))!),\n getParent: (id) => scene.get(asNodeId(id))?.parent ?? null,\n setPose: (id, pose) => scene.setPose(asNodeId(id), pose),\n setParent: (id, parentId) =>\n scene.move(asNodeId(id), parentId === null ? null : asNodeId(parentId)),\n setData: (id, data) => scene.update(asNodeId(id), { data } as never),\n removeNode: (id) => scene.remove(asNodeId(id)),\n insertNode: (node, index) =>\n scene.add({\n kind: node.kind,\n layer: node.layer,\n pose: node.pose,\n data: node.data,\n id: node.id,\n ...(index !== undefined ? { index } : {}),\n ...(node.parent !== null ? { parent: node.parent } : {}),\n ...(node.dependsOn !== undefined ? { dependsOn: node.dependsOn } : {}),\n ...fnFieldsOfNode(node),\n }),\n getChildren: (parentId) =>\n parentId === null ? [...scene.roots] : [...scene.childrenOf(asNodeId(parentId))],\n setChildOrder: (parentId, ids) => {\n scene.batch('Reorder', () => {\n for (let i = 0; i < ids.length; i++) {\n const current = parentId === null ? scene.roots : scene.childrenOf(asNodeId(parentId));\n if (current[i] === ids[i]) continue;\n scene.reorder(asNodeId(ids[i]), i);\n }\n });\n },\n };\n}\n"],"mappings":";;;;AA6BA,SAAgBA,EACd,GAC2B;CAC3B,OAAO;EACL,UAAU,MAAOC,EAAM,IAAIC,EAASC,CAAE,CAAC;EACvC,gBACS,CAAC,GAAGF,EAAM,iBAAiB,CAAC;EAErC,UAAU,MAAOG,EAAaH,GAAOA,EAAM,IAAIC,EAASC,CAAE,CAAC,CAAE;EAC7D,YAAY,MAAOF,EAAM,IAAIC,EAASC,CAAE,CAAC,CAAC,EAAE,UAAU;EACtD,UAAU,GAAI,MAASF,EAAM,QAAQC,EAASC,CAAE,GAAGE,CAAI;EACvD,YAAY,GAAI,MACdJ,EAAM,KAAKC,EAASC,CAAE,GAAGG,MAAa,OAAO,OAAOJ,EAASI,CAAQ,CAAC;EACxE,UAAU,GAAI,MAASL,EAAM,OAAOC,EAASC,CAAE,GAAG,EAAE,QAAK,CAAU;EACnE,aAAa,MAAOF,EAAM,OAAOC,EAASC,CAAE,CAAC;EAC7C,aAAa,GAAM,MACjBF,EAAM,IAAI;GACR,MAAMM,EAAK;GACX,OAAOA,EAAK;GACZ,MAAMA,EAAK;GACX,MAAMA,EAAK;GACX,IAAIA,EAAK;GACT,GAAIC,MAAU,KAAA,IAAwB,CAAC,IAAb,EAAE,SAAM;GAClC,GAAID,EAAK,WAAW,OAAiC,CAAC,IAA3B,EAAE,QAAQA,EAAK,OAAO;GACjD,GAAIA,EAAK,cAAc,KAAA,IAA4C,CAAC,IAAjC,EAAE,WAAWA,EAAK,UAAU;GAC/D,GAAGE,EAAeF,CAAI;EACxB,CAAC;EACH,cAAc,MACZD,MAAa,OAAO,CAAC,GAAGL,EAAM,KAAK,IAAI,CAAC,GAAGA,EAAM,WAAWC,EAASI,CAAQ,CAAC,CAAC;EACjF,gBAAgB,GAAU,MAAQ;GAChC,EAAM,MAAM,iBAAiB;IAC3B,KAAK,IAAI,IAAI,GAAG,IAAII,EAAI,QAAQ,KAE9B,CADgBJ,MAAa,OAAOL,EAAM,QAAQA,EAAM,WAAWC,EAASI,CAAQ,CAAC,EAAA,CACzE,OAAOI,EAAI,MACvBT,EAAM,QAAQC,EAASQ,EAAI,EAAE,GAAG,CAAC;GAErC,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { locateChild as e } from "../../../core/ops/slot.js";
|
|
2
|
+
import { unionBounds as t } from "../../../core/geometry/unionBounds.js";
|
|
3
|
+
import { createDeleteOp as n } from "../../../core/ops/delete.js";
|
|
4
|
+
import { createInsertOp as r } from "../../../core/ops/create.js";
|
|
5
|
+
import { dispatchApplyBatch as i } from "../../../core/applyOps.js";
|
|
6
|
+
import { createSetSelectionOp as a } from "../../../core/ops/select.js";
|
|
7
|
+
import { TextOutlinesError as o, textToPathsByPaint as s } from "../../../features/text/textToPath.js";
|
|
8
|
+
import { boundsOfPath as c } from "@weasel-js/geom";
|
|
9
|
+
//#region src/interactions/actions/outlines/createOutlines.ts
|
|
10
|
+
function l(t) {
|
|
11
|
+
let c = [...t.getSelection()], l = [];
|
|
12
|
+
try {
|
|
13
|
+
for (let e of c) {
|
|
14
|
+
let n = t.getTextSource(e);
|
|
15
|
+
if (!n) continue;
|
|
16
|
+
let r = s(n.data, n.pose);
|
|
17
|
+
r.length > 0 && l.push({
|
|
18
|
+
id: e,
|
|
19
|
+
paths: r
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {
|
|
23
|
+
if (e instanceof o) return {
|
|
24
|
+
kind: "failed",
|
|
25
|
+
reason: "text-outlines",
|
|
26
|
+
error: e
|
|
27
|
+
};
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
if (l.length === 0) return {
|
|
31
|
+
kind: "noop",
|
|
32
|
+
reason: "no-text"
|
|
33
|
+
};
|
|
34
|
+
let f = [], p = /* @__PURE__ */ new Map(), m = [...l.map((n) => ({
|
|
35
|
+
...n,
|
|
36
|
+
at: e(t, n.id)
|
|
37
|
+
}))].sort((e, t) => (t.at?.index ?? -1) - (e.at?.index ?? -1));
|
|
38
|
+
for (let { id: e, paths: i, at: a } of m) {
|
|
39
|
+
let o = t.getNode?.(e) ?? { id: e }, s = a?.index ?? -1, c = a?.parentId ?? t.getParent?.(e) ?? null, l = (e, t) => r(s >= 0 ? {
|
|
40
|
+
node: e,
|
|
41
|
+
index: s + t
|
|
42
|
+
} : { node: e });
|
|
43
|
+
f.push(n({
|
|
44
|
+
node: o,
|
|
45
|
+
index: s
|
|
46
|
+
}));
|
|
47
|
+
let m = i.length > 1 ? t.createContainerNode?.(e, {
|
|
48
|
+
parent: c,
|
|
49
|
+
bounds: d(i)
|
|
50
|
+
}) : void 0;
|
|
51
|
+
if (m) {
|
|
52
|
+
f.push(l(m, 0));
|
|
53
|
+
for (let n of i) f.push(r({ node: t.createPathNode(n.path, e, u(n, m.id)) }));
|
|
54
|
+
p.set(e, [m.id]);
|
|
55
|
+
} else {
|
|
56
|
+
let n = i.map((n) => t.createPathNode(n.path, e, u(n, c)));
|
|
57
|
+
n.forEach((e, t) => f.push(l(e, t))), p.set(e, n.map((e) => e.id));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return f.push(a({
|
|
61
|
+
from: c,
|
|
62
|
+
to: c.flatMap((e) => p.get(e) ?? [e])
|
|
63
|
+
})), i(t, f, "Create Outlines"), {
|
|
64
|
+
kind: "applied",
|
|
65
|
+
resultIds: l.flatMap((e) => p.get(e.id))
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function u(e, t) {
|
|
69
|
+
return e.stroke === void 0 ? {
|
|
70
|
+
fill: e.fill,
|
|
71
|
+
parent: t
|
|
72
|
+
} : {
|
|
73
|
+
fill: e.fill,
|
|
74
|
+
stroke: e.stroke,
|
|
75
|
+
parent: t
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function d(e) {
|
|
79
|
+
return t(e.map((e) => c(e.path)));
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { l as applyCreateOutlines };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=createOutlines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOutlines.js","names":["applyCreateOutlines","sel","adapter","converted","id","text","paths","textToPathsByPaint","err","TextOutlinesError","ops","replaced","order","c","locateChild","b","a","node","index","at","parent","place","createInsertOp","created","i","createDeleteOp","container","envelope","p","specOf","n","createSetSelectionOp","dispatchApplyBatch","unionBounds","boundsOfPath"],"sources":["../../../../src/interactions/actions/outlines/createOutlines.ts"],"sourcesContent":["/**\n * Create Outlines: replace each selected text node with path nodes carrying\n * its glyph outlines, giving up editability for geometry — the destructive\n * conversion every vector editor has. One path per paint the text wears; one\n * undoable batch; the replacement takes the text node's slot, so stacking\n * order is unchanged.\n */\nimport { boundsOfPath, type PolygonPath, type Rect } from '@weasel-js/geom';\nimport type { FillStyle, Stroke } from '@weasel-js/paint';\nimport { createInsertOp } from 'core/ops/create';\nimport { createDeleteOp } from 'core/ops/delete';\nimport { createSetSelectionOp } from 'core/ops/select';\nimport { locateChild } from 'core/ops/slot';\nimport { unionBounds } from 'core/geometry/unionBounds';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId } from 'core/scene/types';\nimport { dispatchApplyBatch } from 'core/applyOps';\nimport {\n textToPathsByPaint, TextOutlinesError, type TextNodeSource, type TextPaintPath,\n} from 'features/text/textToPath';\n\n/** What a path minted by Create Outlines must carry — see\n * {@link CreateOutlinesAdapter.createPathNode}. */\nexport interface OutlinePathSpec {\n /** The fill these glyphs wear, resolved: their run's, else the node's,\n * else the default text fill. `null` is no fill. */\n fill: FillStyle | null;\n /** The stroke they wear, resolved the same way; absent for none. */\n stroke?: Stroke;\n /** The parent the path goes under: the text's own, or the container\n * minted to hold a multi-paint text's paths. */\n parent: string | null;\n}\n\n/** What `applyCreateOutlines` reads and writes through. */\nexport interface CreateOutlinesAdapter {\n getSelection(): readonly NodeId[] | readonly string[];\n /** The text node behind `id`, or `undefined` for anything else. */\n getTextSource(id: NodeId): TextNodeSource | undefined;\n /**\n * Mint one path node of text node `sourceId`'s outlines. `path` is in world\n * space. The node must wear `spec`'s fill and stroke — a text whose runs\n * differ in paint gets one path per paint — and sit under `spec.parent`.\n * The kit places it; only the consumer knows its data shape.\n */\n createPathNode(path: PolygonPath, sourceId: NodeId, spec: OutlinePathSpec): { id: string };\n /**\n * Mint the container that holds a multi-paint text's paths, under `parent`.\n * `bounds` is the world envelope of the paths. The kit puts the container in\n * the text's slot and the paths inside it, in the text's order. Without\n * this, the paths are laid flat in that slot instead.\n */\n createContainerNode?(sourceId: NodeId, spec: { parent: string | null; bounds: Rect }): { id: string };\n /** Full node for `id`, so undo restores the text node whole. Without it the\n * delete captures an `{ id }` stub. */\n getNode?(id: string): { id: string } | undefined | null;\n /** Parent and sibling order — the reorder contract. With both, each path is\n * inserted at its text node's index; without, where `insertNode` defaults. */\n getParent?(id: string): string | null;\n getChildren?(parentId: string | null): readonly string[];\n applyOps?(ops: Op[], label?: string): void;\n setSelection?(ids: NodeId[]): void;\n insertNode?(node: { id: string }, index?: number): void;\n removeNode?(id: string): void;\n}\n\n/** Outcome of {@link applyCreateOutlines}. */\nexport type CreateOutlinesResult =\n /** `resultIds` are what replaced the text nodes at their level — a path,\n * a container, or a run of flat paths each — which is also what is now\n * selected in the text nodes' place. */\n | { kind: 'applied'; resultIds: string[] }\n /** Nothing selected is text with ink. */\n | { kind: 'noop'; reason: 'no-text' }\n /** Some selected text has no outline geometry; nothing was changed. */\n | { kind: 'failed'; reason: 'text-outlines'; error: TextOutlinesError };\n\n/**\n * Convert every text node in the selection to outlines, as one batch labeled\n * \"Create Outlines\". Other selected nodes are left alone and stay selected.\n * All or nothing: if any text node's face cannot supply outlines the scene is\n * untouched and the error comes back in the result.\n */\nexport function applyCreateOutlines(adapter: CreateOutlinesAdapter): CreateOutlinesResult {\n const sel = [...adapter.getSelection()] as NodeId[];\n const converted: { id: NodeId; paths: TextPaintPath[] }[] = [];\n try {\n for (const id of sel) {\n const text = adapter.getTextSource(id);\n if (!text) continue;\n const paths = textToPathsByPaint(text.data, text.pose);\n if (paths.length > 0) converted.push({ id, paths });\n }\n } catch (err) {\n if (err instanceof TextOutlinesError) return { kind: 'failed', reason: 'text-outlines', error: err };\n throw err;\n }\n if (converted.length === 0) return { kind: 'noop', reason: 'no-text' };\n\n const ops: Op[] = [];\n const replaced = new Map<NodeId, string[]>();\n // Replacements in the same parent are inserted top slot first, so an\n // earlier one widening the sibling list cannot shift a later one's index.\n const located = converted.map((c) => ({ ...c, at: locateChild(adapter, c.id) }));\n const order = [...located].sort((a, b) => (b.at?.index ?? -1) - (a.at?.index ?? -1));\n for (const { id, paths, at } of order) {\n const node = adapter.getNode?.(id) ?? { id };\n const index = at?.index ?? -1;\n const parent = at?.parentId ?? adapter.getParent?.(id) ?? null;\n const place = (created: { id: string }, i: number) =>\n createInsertOp(index >= 0 ? { node: created, index: index + i } : { node: created });\n ops.push(createDeleteOp({ node, index }));\n\n const container = paths.length > 1\n ? adapter.createContainerNode?.(id, { parent, bounds: envelope(paths) })\n : undefined;\n if (container) {\n ops.push(place(container, 0));\n for (const p of paths) {\n ops.push(createInsertOp({ node: adapter.createPathNode(p.path, id, specOf(p, container.id)) }));\n }\n replaced.set(id, [container.id]);\n } else {\n const created = paths.map((p) => adapter.createPathNode(p.path, id, specOf(p, parent)));\n created.forEach((n, i) => ops.push(place(n, i)));\n replaced.set(id, created.map((n) => n.id));\n }\n }\n ops.push(createSetSelectionOp({\n from: sel,\n to: sel.flatMap((id) => (replaced.get(id) ?? [id]) as NodeId[]),\n }));\n dispatchApplyBatch(adapter, ops, 'Create Outlines');\n return { kind: 'applied', resultIds: converted.flatMap((c) => replaced.get(c.id)!) };\n}\n\nfunction specOf(p: TextPaintPath, parent: string | null): OutlinePathSpec {\n return p.stroke !== undefined ? { fill: p.fill, stroke: p.stroke, parent } : { fill: p.fill, parent };\n}\n\nfunction envelope(paths: readonly TextPaintPath[]): Rect {\n return unionBounds(paths.map((p) => boundsOfPath(p.path)))!;\n}\n"],"mappings":";;;;;;;;;AAmFA,SAAgBA,EAAoB,GAAsD;CACxF,IAAMC,IAAM,CAAC,GAAGC,EAAQ,aAAa,CAAC,GAChCC,IAAsD,CAAC;CAC7D,IAAI;EACF,KAAK,IAAMC,KAAMH,GAAK;GACpB,IAAMI,IAAOH,EAAQ,cAAcE,CAAE;GACrC,IAAI,CAACC,GAAM;GACX,IAAMC,IAAQC,EAAmBF,EAAK,MAAMA,EAAK,IAAI;GACrD,AAAIC,EAAM,SAAS,KAAGH,EAAU,KAAK;IAAE;IAAI;GAAM,CAAC;EACpD;CACF,SAASK,GAAK;EACZ,IAAIA,aAAeC,GAAmB,OAAO;GAAE,MAAM;GAAU,QAAQ;GAAiB,OAAOD;EAAI;EACnG,MAAMA;CACR;CACA,IAAIL,EAAU,WAAW,GAAG,OAAO;EAA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N,CAAC,CAAC,CAAC,GAC/Cb,EAAS,IAAIP,GAAImB,EAAQ,KAAK,MAAMO,EAAE,EAAE,CAAC;EAC3C;CACF;CAMA,OALApB,EAAI,KAAKqB,EAAqB;EAC5B,MAAM9B;EACN,IAAIA,EAAI,SAAS,MAAQU,EAAS,IAAIP,CAAE,KAAK,CAACA,CAAE,CAAc;CAChE,CAAC,CAAC,GACF4B,EAAmB9B,GAASQ,GAAK,iBAAiB,GAC3C;EAAE,MAAM;EAAW,WAAWP,EAAU,SAAS,MAAMQ,EAAS,IAAIE,EAAE,EAAE,CAAE;CAAE;AACrF;AAEA,SAASgB,EAAO,GAAkB,GAAwC;CACxE,OAAOD,EAAE,WAAW,KAAA,IAAyD;EAAE,MAAMA,EAAE;EAAM;CAAO,IAApE;EAAE,MAAMA,EAAE;EAAM,QAAQA,EAAE;EAAQ;CAAO;AAC3E;AAEA,SAASD,EAAS,GAAuC;CACvD,OAAOM,EAAY3B,EAAM,KAAK,MAAM4B,EAAaN,EAAE,IAAI,CAAC,CAAC;AAC3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useDepSource as e } from "@weasel-js/routing/react";
|
|
2
|
+
//#region src/interactions/actions/outlines/useCreateOutlinesAdapter.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
e("createOutlinesAdapter", () => t);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as useCreateOutlinesAdapter };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=useCreateOutlinesAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateOutlinesAdapter.js","names":["useCreateOutlinesAdapter","adapter"],"sources":["../../../../src/interactions/actions/outlines/useCreateOutlinesAdapter.ts"],"sourcesContent":["import { useDepSource } from '@weasel-js/routing/react';\nimport type { CreateOutlinesAdapter } from './createOutlines';\n\n/** Publish a Create Outlines adapter so the built-in `createOutlines` action\n * can run. Silently does nothing outside a `<DepRegistryProvider>`. */\nexport function useCreateOutlinesAdapter(adapter: CreateOutlinesAdapter): void {\n useDepSource('createOutlinesAdapter', () => adapter);\n}\n"],"mappings":";;AAKA,SAAgBA,EAAyB,GAAsC;CAC7E,EAAa,+BAA+BC,CAAO;AACrD"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { deriveParallaxView as e, fromPlane as t, planeMap as n, rectFromPlane as r, toPlane as i } from "../../core/viewport/parallax.js";
|
|
2
|
+
import { asNodeId as a } from "../../core/scene/types.js";
|
|
3
|
+
//#region src/interactions/actions/planeInput.ts
|
|
4
|
+
var o = (e, t) => t ? e.scene?.get(a(t))?.layer : void 0, s = (e, t) => {
|
|
5
|
+
let n = e.selection;
|
|
6
|
+
for (let r of [...t?.targetIds ?? [], ...n?.get() ?? []]) {
|
|
7
|
+
let t = o(e, r);
|
|
8
|
+
if (t !== void 0) return t;
|
|
9
|
+
}
|
|
10
|
+
}, c = (e) => e.insert?.layer?.(), l = (e) => o(e, e.editAnchors?.editingId);
|
|
11
|
+
function u(e, t) {
|
|
12
|
+
let n = e.invoker;
|
|
13
|
+
if (!n) return e;
|
|
14
|
+
let r = e.requires ?? [], a = [.../* @__PURE__ */ new Set([
|
|
15
|
+
...r,
|
|
16
|
+
"scene",
|
|
17
|
+
"selection",
|
|
18
|
+
"view"
|
|
19
|
+
])];
|
|
20
|
+
return n.timing === "immediate" ? {
|
|
21
|
+
...e,
|
|
22
|
+
requires: a,
|
|
23
|
+
invoker: {
|
|
24
|
+
timing: "immediate",
|
|
25
|
+
run(e, a) {
|
|
26
|
+
let o = d(e, t(e), r, null);
|
|
27
|
+
if (o === null) return n.run(e, a);
|
|
28
|
+
let s = a?.worldX, c = a?.worldY, l = typeof s == "number" && typeof c == "number" ? i(o.map(), {
|
|
29
|
+
x: s,
|
|
30
|
+
y: c
|
|
31
|
+
}) : null;
|
|
32
|
+
n.run(o.deps, l ? {
|
|
33
|
+
...a,
|
|
34
|
+
worldX: l.x,
|
|
35
|
+
worldY: l.y
|
|
36
|
+
} : a);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} : {
|
|
40
|
+
...e,
|
|
41
|
+
requires: a,
|
|
42
|
+
invoker: {
|
|
43
|
+
timing: "ongoing",
|
|
44
|
+
start(e, i) {
|
|
45
|
+
let a = d(e.deps, t(e.deps, e.drag?.affordance), r, e.drag?.start ?? null);
|
|
46
|
+
return a === null ? n.start(e, i) : p(n.start(a.carry(e), i), a);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function d(r, a, o, s) {
|
|
52
|
+
let c = r.scene, l = r.view;
|
|
53
|
+
if (a === void 0 || !c || !l) return null;
|
|
54
|
+
let u = () => c.layers.find((e) => e.id === a)?.parallax;
|
|
55
|
+
if (u() === void 0) return null;
|
|
56
|
+
let d = {
|
|
57
|
+
scale: {
|
|
58
|
+
x: 1,
|
|
59
|
+
y: 1
|
|
60
|
+
},
|
|
61
|
+
offset: {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: 0
|
|
64
|
+
}
|
|
65
|
+
}, p = () => {
|
|
66
|
+
let e = u();
|
|
67
|
+
return e ? n(l.get(), e) : d;
|
|
68
|
+
}, m = Object.defineProperties(Object.create(l), {
|
|
69
|
+
get: { value: () => {
|
|
70
|
+
let t = u(), n = l.get();
|
|
71
|
+
return t ? e(n, t) : n;
|
|
72
|
+
} },
|
|
73
|
+
plane: { value: p }
|
|
74
|
+
}), h = Object.create(r), g = (e, t) => Object.defineProperty(h, e, {
|
|
75
|
+
value: t,
|
|
76
|
+
enumerable: !0
|
|
77
|
+
});
|
|
78
|
+
g("view", m);
|
|
79
|
+
let _ = o.includes("nodeAtPoint") ? r.nodeAtPoint : void 0;
|
|
80
|
+
_ && g("nodeAtPoint", ((e, n) => _(t(p(), e), n)));
|
|
81
|
+
let v = o.includes("snap") ? r.snap : void 0;
|
|
82
|
+
v && g("snap", { point: (e) => i(p(), v.point(t(p(), e))) });
|
|
83
|
+
let y = s ? i(p(), s) : null, b = f();
|
|
84
|
+
return {
|
|
85
|
+
map: p,
|
|
86
|
+
deps: h,
|
|
87
|
+
carry(e) {
|
|
88
|
+
let t = p(), n = {
|
|
89
|
+
...e,
|
|
90
|
+
world: i(t, e.world)
|
|
91
|
+
};
|
|
92
|
+
if (e.drag) {
|
|
93
|
+
let r = y ?? i(t, e.drag.start), a = i(t, e.drag.current), o = e.drag.affordance;
|
|
94
|
+
n.drag = {
|
|
95
|
+
...e.drag,
|
|
96
|
+
start: r,
|
|
97
|
+
current: a,
|
|
98
|
+
delta: {
|
|
99
|
+
x: a.x - r.x,
|
|
100
|
+
y: a.y - r.y
|
|
101
|
+
},
|
|
102
|
+
...e.drag.points ? { points: b(e.drag.points, t) } : {},
|
|
103
|
+
...o?.fixedPoint ? { affordance: {
|
|
104
|
+
...o,
|
|
105
|
+
fixedPoint: i(t, o.fixedPoint)
|
|
106
|
+
} } : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return e.deps && (n.deps = h), n;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function f() {
|
|
114
|
+
let e = null, t = null, n = [];
|
|
115
|
+
return (r, a) => {
|
|
116
|
+
let o = t !== null && t.scale.x === a.scale.x && t.scale.y === a.scale.y && t.offset.x === a.offset.x && t.offset.y === a.offset.y;
|
|
117
|
+
(r !== e || !o || r.length < n.length) && (e = r, n = []), t = a;
|
|
118
|
+
for (let e = n.length; e < r.length; e++) n.push({
|
|
119
|
+
...r[e],
|
|
120
|
+
...i(a, r[e])
|
|
121
|
+
});
|
|
122
|
+
return n.slice();
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function p(e, t) {
|
|
126
|
+
let n = { ...e };
|
|
127
|
+
return e.onMove && (n.onMove = (n) => e.onMove(t.carry(n))), e.onEnd && (n.onEnd = (n, r) => e.onEnd(t.carry(n), r)), e.overlay && (n.overlay = () => {
|
|
128
|
+
let n = e.overlay();
|
|
129
|
+
return n && m(n, t.map());
|
|
130
|
+
}), n;
|
|
131
|
+
}
|
|
132
|
+
function m(e, n) {
|
|
133
|
+
let i = (e) => t(n, e);
|
|
134
|
+
switch (e.kind) {
|
|
135
|
+
case "marquee": return {
|
|
136
|
+
...e,
|
|
137
|
+
start: i(e.start),
|
|
138
|
+
current: i(e.current)
|
|
139
|
+
};
|
|
140
|
+
case "lasso": return {
|
|
141
|
+
...e,
|
|
142
|
+
vertices: e.vertices.map(i),
|
|
143
|
+
current: i(e.current)
|
|
144
|
+
};
|
|
145
|
+
case "polyline": return {
|
|
146
|
+
...e,
|
|
147
|
+
points: e.points.map(i)
|
|
148
|
+
};
|
|
149
|
+
case "insertPreview": return {
|
|
150
|
+
...e,
|
|
151
|
+
bounds: r(n, e.bounds),
|
|
152
|
+
extras: h(e.extras, n),
|
|
153
|
+
...e.anchorPoint ? { anchorPoint: i(e.anchorPoint) } : {}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function h(e, n) {
|
|
158
|
+
if (typeof e != "object" || !e) return e;
|
|
159
|
+
let r = e, i = (e) => t(n, e), a = (e) => typeof e == "number" ? e / ((n.scale.x + n.scale.y) / 2) : e, o = { ...r };
|
|
160
|
+
return r.a && r.b && (o.a = i(r.a), o.b = i(r.b)), r.center && (o.center = i(r.center)), "radius" in r && (o.radius = a(r.radius)), "outerRadius" in r && (o.outerRadius = a(r.outerRadius)), Array.isArray(r.samples) && (o.samples = r.samples.map((e) => ({
|
|
161
|
+
...e,
|
|
162
|
+
...i(e)
|
|
163
|
+
}))), o;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { l as editingLayer, u as inPlane, c as insertLayer, s as selectionLayer };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=planeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeInput.js","names":["layerOfNode","id","deps","asNodeId","selectionLayer","selection","affordance","layer","insertLayer","editingLayer","inPlane","inner","action","declared","requires","plane","livePlane","layerOf","params","wx","\"worldX\"","wy","\"worldY\"","at","toPlane","ctx","opts","planeHandle","scene","bag","viewApi","parallax","l","IDENTITY","map","p","planeMap","planeView","camera","deriveParallaxView","override","name","nodeAtPoint","fromPlane","exclude","snap","start0","pressedAt","trail","trailCarrier","m","out","c","start","current","aff","src","lastMap","same","points","i","handle","reason","ov","overlayFromPlane","pt","rectFromPlane","insertExtrasFromPlane","extras","e","r","v","\"a\"","\"b\"","\"center\"","\"radius\"","\"outerRadius\"","\"samples\"","s"],"sources":["../../../src/interactions/actions/planeInput.ts"],"sourcesContent":["/**\n * Editing a node on a parallax plane.\n *\n * The dispatcher hands every action the camera's world. A node on a layer\n * carrying `parallax` stores its pose in its plane's world, which the camera's\n * reaches through a `PlaneMap` that changes with the camera. An editing action\n * pairs the pointer with the pose it edits, so the two have to be in one world.\n *\n * `inPlane` is that one place: it wraps an action so its input is carried into\n * the plane of the layer it edits before the action reads it — pointer, drag,\n * trail, affordance pivot, and the camera it converts screen pixels through —\n * and so the chrome it publishes back comes out in the camera's world. A dep\n * that answers in world points (`nodeAtPoint`, `snap`) is the surface's, so it\n * keeps speaking the camera's world and the seam converts at its boundary.\n * The action sees the plane only as `view.plane()`, which it hands its snap\n * behaviors so they can bring the camera's guides and grid into the plane.\n *\n * The map is read afresh on every call: a camera panning under a held drag, or\n * a plane whose factors are being animated, moves the node with the pointer.\n */\nimport type {\n Action, ActionDeps, AffordanceHit, BindingOpts, DragSample, InvocationCtx, OngoingHandle,\n OngoingOverlay,\n} from '@weasel-js/routing';\nimport type { Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport {\n deriveParallaxView, fromPlane, planeMap, rectFromPlane, toPlane,\n type ParallaxOpts, type PlaneMap,\n} from 'core/viewport/parallax';\nimport type { View } from 'core/viewport/view';\nimport type { EditAnchorsDep, InsertDep, NodeAtPointDep, SnapDep, ViewApi } from './depSchema';\n\ntype Point = { x: number; y: number };\n\n/** Which scene layer an invocation edits, read once as it starts, from its\n * deps and — for a drag — the affordance it grabbed. `undefined` means none:\n * the action runs in the camera's world. */\nexport type EditedLayerOf = (deps: ActionDeps, affordance?: AffordanceHit) => string | undefined;\n\nconst layerOfNode = (deps: ActionDeps, id: string | null | undefined): string | undefined =>\n (id ? (deps.scene as Scene<unknown, string, unknown> | undefined)?.get(asNodeId(id))?.layer : undefined);\n\n/** The layer of the node a selection edit acts on: the affordance's target\n * when the drag grabbed one, the first selected node otherwise. A selection\n * spanning planes is edited in that one node's plane. */\nexport const selectionLayer: EditedLayerOf = (deps, affordance) => {\n const selection = deps.selection as SelectionApi | undefined;\n for (const id of [...(affordance?.targetIds ?? []), ...(selection?.get() ?? [])]) {\n const layer = layerOfNode(deps, id);\n if (layer !== undefined) return layer;\n }\n return undefined;\n};\n\n/** The layer the `insert` dep will put a new node on. */\nexport const insertLayer: EditedLayerOf = (deps) =>\n (deps.insert as InsertDep | undefined)?.layer?.();\n\n/** The layer of the path in anchor-edit mode. */\nexport const editingLayer: EditedLayerOf = (deps) =>\n layerOfNode(deps, (deps.editAnchors as EditAnchorsDep | undefined)?.editingId);\n\n/** `action`, with its input carried into the plane of the layer `layerOf`\n * names. An action on a layer with no `parallax`, or invoked with no scene or\n * view to read the plane from, runs exactly as it would unwrapped.\n *\n * An ongoing action's drag is carried as a whole. An immediate one's world\n * point is `params.worldX` / `params.worldY`, the dispatcher's convention for\n * a click; it is carried when present. */\nexport function inPlane<A extends Action>(action: A, layerOf: EditedLayerOf): A {\n const inner = action.invoker;\n if (!inner) return action;\n const declared = action.requires ?? [];\n const requires = [...new Set([...declared, 'scene', 'selection', 'view'])];\n if (inner.timing === 'immediate') {\n return {\n ...action,\n requires,\n invoker: {\n timing: 'immediate',\n run(deps: ActionDeps, params?: Record<string, unknown>): void {\n const plane = livePlane(deps, layerOf(deps), declared, null);\n if (plane === null) return inner.run(deps, params);\n const wx = params?.['worldX'];\n const wy = params?.['worldY'];\n const at = typeof wx === 'number' && typeof wy === 'number'\n ? toPlane(plane.map(), { x: wx, y: wy })\n : null;\n inner.run(plane.deps, at ? { ...params, worldX: at.x, worldY: at.y } : params);\n },\n },\n } as A;\n }\n return {\n ...action,\n requires,\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const plane = livePlane(\n ctx.deps, layerOf(ctx.deps, ctx.drag?.affordance), declared, ctx.drag?.start ?? null,\n );\n if (plane === null) return inner.start(ctx, opts);\n return planeHandle(inner.start(plane.carry(ctx), opts), plane);\n },\n },\n } as A;\n}\n\ninterface LivePlane {\n map(): PlaneMap;\n /** The invocation's deps, speaking the plane's world. */\n deps: ActionDeps;\n /** `ctx` in the plane's world. */\n carry(ctx: InvocationCtx): InvocationCtx;\n}\n\nfunction livePlane(\n bag: ActionDeps,\n layer: string | undefined,\n /** What the wrapped action declared. The dispatcher's dev deps bag throws\n * on any other read, so the seam converts only the deps it can see. */\n declared: readonly string[],\n /** The drag's press point in the camera's world, when there is a drag. */\n pressedAt: Point | null,\n): LivePlane | null {\n const scene = bag.scene as Scene<unknown, string, unknown> | undefined;\n const viewApi = bag.view as ViewApi | undefined;\n if (layer === undefined || !scene || !viewApi) return null;\n const parallax = (): ParallaxOpts | undefined => scene.layers.find((l) => l.id === layer)?.parallax;\n if (parallax() === undefined) return null;\n\n const IDENTITY: PlaneMap = { scale: { x: 1, y: 1 }, offset: { x: 0, y: 0 } };\n const map = (): PlaneMap => {\n const p = parallax();\n return p ? planeMap(viewApi.get(), p) : IDENTITY;\n };\n\n // A screen-pixel tolerance, and anything else an action reads off the\n // camera, has to be read at the plane's scale.\n const planeView = Object.defineProperties(Object.create(viewApi), {\n get: {\n value: (): View => {\n const p = parallax();\n const camera = viewApi.get();\n return p ? deriveParallaxView(camera, p) : camera;\n },\n },\n plane: { value: map },\n }) as ViewApi;\n\n // Over the dispatcher's bag rather than a copy of it, so every other read\n // still goes through whatever checks the bag makes.\n const deps = Object.create(bag) as typeof bag;\n const override = (name: string, value: unknown) =>\n Object.defineProperty(deps, name, { value, enumerable: true });\n override('view', planeView);\n const nodeAtPoint = declared.includes('nodeAtPoint')\n ? bag.nodeAtPoint as NodeAtPointDep | undefined\n : undefined;\n if (nodeAtPoint) {\n override('nodeAtPoint', ((p, exclude) => nodeAtPoint(fromPlane(map(), p), exclude)) as NodeAtPointDep);\n }\n const snap = declared.includes('snap') ? bag.snap as SnapDep | undefined : undefined;\n if (snap) {\n override('snap', { point: (p: Point) => toPlane(map(), snap.point(fromPlane(map(), p))) } as SnapDep);\n }\n\n // The drag's origin, fixed in the plane at the moment it was pressed: where\n // the pointer went down on the node is where the node was grabbed, whatever\n // the camera does after.\n const start0 = pressedAt ? toPlane(map(), pressedAt) : null;\n const trail = trailCarrier();\n\n return {\n map,\n deps,\n carry(c) {\n const m = map();\n const out: InvocationCtx = { ...c, world: toPlane(m, c.world) };\n if (c.drag) {\n const start = start0 ?? toPlane(m, c.drag.start);\n const current = toPlane(m, c.drag.current);\n const aff = c.drag.affordance;\n out.drag = {\n ...c.drag,\n start,\n current,\n delta: { x: current.x - start.x, y: current.y - start.y },\n ...(c.drag.points ? { points: trail(c.drag.points, m) } : {}),\n ...(aff?.fixedPoint ? { affordance: { ...aff, fixedPoint: toPlane(m, aff.fixedPoint) } } : {}),\n };\n }\n // The dispatcher hands `onMove` no deps; only `start` has any to carry.\n if (c.deps) out.deps = deps;\n return out;\n },\n };\n}\n\n/** The drag trail in the plane. The dispatcher grows its trail in place, so\n * only the samples added since the last call are mapped — unless the map\n * moved, when every sample is. */\nfunction trailCarrier(): (points: DragSample[], m: PlaneMap) => DragSample[] {\n let src: DragSample[] | null = null;\n let lastMap: PlaneMap | null = null;\n let out: DragSample[] = [];\n return (points, m) => {\n const same = lastMap !== null\n && lastMap.scale.x === m.scale.x && lastMap.scale.y === m.scale.y\n && lastMap.offset.x === m.offset.x && lastMap.offset.y === m.offset.y;\n if (points !== src || !same || points.length < out.length) {\n src = points;\n out = [];\n }\n lastMap = m;\n for (let i = out.length; i < points.length; i++) {\n out.push({ ...points[i], ...toPlane(m, points[i]) });\n }\n // A copy, so a snapshot taken on `onEnd` is not the live accumulator.\n return out.slice();\n };\n}\n\nfunction planeHandle(handle: OngoingHandle, plane: LivePlane): OngoingHandle {\n const out: OngoingHandle = { ...handle };\n if (handle.onMove) out.onMove = (c) => handle.onMove!(plane.carry(c));\n if (handle.onEnd) out.onEnd = (c, reason) => handle.onEnd!(plane.carry(c), reason);\n if (handle.overlay) {\n out.overlay = () => {\n const ov = handle.overlay!();\n return ov ? overlayFromPlane(ov, plane.map()) : ov;\n };\n }\n return out;\n}\n\n/** An overlay drawn in the plane, in the camera's world: what every painter\n * reads an overlay as. */\nfunction overlayFromPlane(ov: OngoingOverlay, m: PlaneMap): OngoingOverlay {\n const pt = (p: Point) => fromPlane(m, p);\n switch (ov.kind) {\n case 'marquee':\n return { ...ov, start: pt(ov.start), current: pt(ov.current) };\n case 'lasso':\n return { ...ov, vertices: ov.vertices.map(pt), current: pt(ov.current) };\n case 'polyline':\n return { ...ov, points: ov.points.map(pt) };\n case 'insertPreview':\n return {\n ...ov,\n bounds: rectFromPlane(m, ov.bounds),\n extras: insertExtrasFromPlane(ov.extras, m),\n ...(ov.anchorPoint ? { anchorPoint: pt(ov.anchorPoint) } : {}),\n };\n }\n}\n\n/** The geometry the kit's insert kinds carry in `extras`, in the camera's\n * world. A consumer kind's extras are opaque, and pass through. */\nfunction insertExtrasFromPlane(extras: unknown, m: PlaneMap): unknown {\n if (extras === null || typeof extras !== 'object') return extras;\n const e = extras as Record<string, unknown>;\n const pt = (p: unknown) => fromPlane(m, p as Point);\n // Radial kinds inscribe in a square, so one scale carries a radius.\n const r = (v: unknown) => (typeof v === 'number' ? v / ((m.scale.x + m.scale.y) / 2) : v);\n const out: Record<string, unknown> = { ...e };\n if (e['a'] && e['b']) { out['a'] = pt(e['a']); out['b'] = pt(e['b']); }\n if (e['center']) out['center'] = pt(e['center']);\n if ('radius' in e) out['radius'] = r(e['radius']);\n if ('outerRadius' in e) out['outerRadius'] = r(e['outerRadius']);\n if (Array.isArray(e['samples'])) {\n out['samples'] = (e['samples'] as DragSample[]).map((s) => ({ ...s, ...pt(s) }));\n }\n return out;\n}\n"],"mappings":";;;AAyCA,IAAMA,KAAe,GAAkB,MACpCC,IAAMC,EAAK,OAAuD,IAAIC,EAASF,CAAE,CAAC,CAAC,EAAE,QAAQ,KAAA,GAKnFG,KAAiC,GAAM,MAAe;CACjE,IAAMC,IAAYH,EAAK;CACvB,KAAK,IAAMD,KAAM,CAAC,GAAIK,GAAY,aAAa,CAAC,GAAI,GAAID,GAAW,IAAI,KAAK,CAAC,CAAE,GAAG;EAChF,IAAME,IAAQP,EAAYE,GAAMD,CAAE;EAClC,IAAIM,MAAU,KAAA,GAAW,OAAOA;CAClC;AAEF,GAGaC,KAA8B,MACxCN,EAAK,QAAkC,QAAQ,GAGrCO,KAA+B,MAC1CT,EAAYE,GAAOA,EAAK,aAA4C,SAAS;AAS/E,SAAgBQ,EAA0B,GAAW,GAA2B;CAC9E,IAAMC,IAAQC,EAAO;CACrB,IAAI,CAACD,GAAO,OAAOC;CACnB,IAAMC,IAAWD,EAAO,YAAY,CAAC,GAC/BE,IAAW,CAAC,mBAAG,IAAI,IAAI;EAAC,GAAGD;EAAU;EAAS;EAAa;CAAM,CAAC,CAAC;CAoBzE,OAnBIF,EAAM,WAAW,cACZ;EACL,GAAGC;EACH;EACA,SAAS;GACP,QAAQ;GACR,IAAI,GAAkB,GAAwC;IAC5D,IAAMG,IAAQC,EAAUd,GAAMe,EAAQf,CAAI,GAAGW,GAAU,IAAI;IAC3D,IAAIE,MAAU,MAAM,OAAOJ,EAAM,IAAIT,GAAMgB,CAAM;IACjD,IAAMC,IAAKD,GAASE,QACdC,IAAKH,GAASI,QACdC,IAAK,OAAOJ,KAAO,YAAY,OAAOE,KAAO,WAC/CG,EAAQT,EAAM,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
|
|
1
|
+
import { AUTO_POSE_DESCRIPTOR as e } from "./resize/autoPoseDescriptor.js";
|
|
2
|
+
//#region src/interactions/actions/poseDescriptorDep.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
return t ?? e;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as poseDescriptorOf };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=poseDescriptorDep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poseDescriptorDep.js","names":["poseDescriptorOf","dep","AUTO_POSE_DESCRIPTOR"],"sources":["../../../src/interactions/actions/poseDescriptorDep.ts"],"sourcesContent":["import type { PoseDescriptor } from './resize/geometry';\nimport { AUTO_POSE_DESCRIPTOR } from './resize/autoPoseDescriptor';\n\n/** The `poseDescriptor` dep's value, or the auto descriptor when unsourced. */\nexport function poseDescriptorOf(dep: unknown): PoseDescriptor<unknown> {\n return (dep as PoseDescriptor<unknown> | undefined) ?? AUTO_POSE_DESCRIPTOR;\n}\n"],"mappings":";;AAIA,SAAgBA,EAAiB,GAAuC;CACtE,OAAQC,KAA+CC;AACzD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IDENTITY_POSE_COMPOSITION as e, composeWorldPose as t, frameAtOrAbove as n, rebaseLocalPose as r } from "../../core/scene/composeFrame.js";
|
|
2
|
+
import { definesFrame as i, effectivePose as a } from "../../core/scene/effectivePose.js";
|
|
3
|
+
//#region src/interactions/actions/poseFrame.ts
|
|
4
|
+
function o(e, i) {
|
|
5
|
+
return {
|
|
6
|
+
pc: i,
|
|
7
|
+
world: (n) => t(e, n, i.compose),
|
|
8
|
+
parentWorld: (r) => {
|
|
9
|
+
let a = n(e, e.getParent(r));
|
|
10
|
+
return a === null ? null : t(e, a, i.compose);
|
|
11
|
+
},
|
|
12
|
+
local: (t, n) => r(e, n, e.getParent(t), i.compose, i.decompose),
|
|
13
|
+
localUnder: (t, n) => r(e, n, t, i.compose, i.decompose)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function s(t, n) {
|
|
17
|
+
let r = n ?? e, s = t;
|
|
18
|
+
return o({
|
|
19
|
+
getPose: (e) => {
|
|
20
|
+
let n = t.get(e);
|
|
21
|
+
return n === void 0 ? {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
width: 0,
|
|
25
|
+
height: 0
|
|
26
|
+
} : a(s, n);
|
|
27
|
+
},
|
|
28
|
+
getParent: (e) => t.get(e)?.parent ?? null,
|
|
29
|
+
definesFrame: (e) => {
|
|
30
|
+
let n = t.get(e);
|
|
31
|
+
return n === void 0 || i(n);
|
|
32
|
+
}
|
|
33
|
+
}, r);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { o as poseFrame, s as scenePoseFrame };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=poseFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poseFrame.js","names":["poseFrame","composeWorldPose","adapter","id","pc","frame","frameAtOrAbove","rebaseLocalPose","worldPose","parentId","scenePoseFrame","poseComposition","IDENTITY_POSE_COMPOSITION","source","scene","node","effectivePose","definesFrame"],"sources":["../../../src/interactions/actions/poseFrame.ts"],"sourcesContent":["/**\n * World reads and local writes, paired, for the default actions.\n *\n * A container's pose defines a frame, so a node's stored pose is expressed in\n * its parent's. The geometry an action reasons about — a rotate pivot, an\n * alignment edge, a distribute span, a flip axis — is world; every pose it\n * writes back through `setPose` or a pose op is local. An action that reads\n * world and writes world looks right for one gesture and drifts on the next,\n * because the stored pose is then read in the parent's frame again.\n *\n * Under `IDENTITY_POSE_COMPOSITION` — the default, and what every consumer\n * ships today — local and world are the same value and all of this is an\n * identity. `features/groups/frameFixture.ts` is the scene where they differ.\n */\nimport { definesFrame, effectivePose, type PoseSource } from 'core/scene/effectivePose';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport {\n composeWorldPose,\n frameAtOrAbove,\n rebaseLocalPose,\n IDENTITY_POSE_COMPOSITION,\n type PoseAdapter,\n type PoseComposition,\n} from 'features/groups/composePose';\n\n/** The two directions an action needs, over one composition strategy. */\nexport interface PoseFrame<TPose> {\n /** The strategy in force. `closure` says what it can express exactly. */\n readonly pc: PoseComposition<TPose>;\n /** `id`'s pose in world coordinates, honoring an in-flight gesture override. */\n world(id: NodeId): TPose;\n /** World pose of the frame `id` is stored in, or `null` for the root frame. */\n parentWorld(id: NodeId): TPose | null;\n /** `worldPose` expressed in `id`'s own parent frame — what `setPose` stores. */\n local(id: NodeId, worldPose: TPose): TPose;\n /** `worldPose` expressed under `parentId`'s frame. For a node about to be\n * reparented, whose current parent is not the frame it will be stored in. */\n localUnder(parentId: NodeId | null, worldPose: TPose): TPose;\n}\n\n/** Pair the two directions over an arbitrary pose adapter. */\nexport function poseFrame<TPose>(\n adapter: PoseAdapter<TPose>,\n pc: PoseComposition<TPose>,\n): PoseFrame<TPose> {\n return {\n pc,\n world: (id) => composeWorldPose(adapter, id as string, pc.compose),\n parentWorld: (id) => {\n const frame = frameAtOrAbove(adapter, adapter.getParent(id as string));\n return frame === null ? null : composeWorldPose(adapter, frame, pc.compose);\n },\n local: (id, worldPose) =>\n rebaseLocalPose(adapter, worldPose, adapter.getParent(id as string), pc.compose, pc.decompose),\n localUnder: (parentId, worldPose) =>\n rebaseLocalPose(adapter, worldPose, parentId as string | null, pc.compose, pc.decompose),\n };\n}\n\n/** The `poseFrame` a scene-backed action works in. `poseComposition` is the\n * dep as it arrives — absent means IDENTITY, where every method is a no-op. */\nexport function scenePoseFrame(\n scene: Scene<unknown, string, unknown>,\n poseComposition: unknown,\n): PoseFrame<unknown> {\n const pc =\n (poseComposition as PoseComposition<unknown> | undefined) ?? IDENTITY_POSE_COMPOSITION;\n const source = scene as unknown as PoseSource<unknown>;\n const adapter: PoseAdapter<unknown> = {\n getPose: (id) => {\n const node = scene.get(id as NodeId);\n return node === undefined ? { x: 0, y: 0, width: 0, height: 0 } : effectivePose(source, node);\n },\n getParent: (id) => scene.get(id as NodeId)?.parent ?? null,\n definesFrame: (id) => {\n const node = scene.get(id as NodeId);\n return node === undefined || definesFrame(node);\n },\n };\n return poseFrame(adapter, pc);\n}\n"],"mappings":";;;AAyCA,SAAgBA,EACd,GACA,GACkB;CAClB,OAAO;EACL;EACA,QAAQ,MAAOC,EAAiBC,GAASC,GAAcC,EAAG,OAAO;EACjE,cAAc,MAAO;GACnB,IAAMC,IAAQC,EAAeJ,GAASA,EAAQ,UAAUC,CAAY,CAAC;GACrE,OAAOE,MAAU,OAAO,OAAOJ,EAAiBC,GAASG,GAAOD,EAAG,OAAO;EAC5E;EACA,QAAQ,GAAI,MACVG,EAAgBL,GAASM,GAAWN,EAAQ,UAAUC,CAAY,GAAGC,EAAG,SAASA,EAAG,SAAS;EAC/F,aAAa,GAAU,MACrBG,EAAgBL,GAASM,GAAWC,GAA2BL,EAAG,SAASA,EAAG,SAAS;CAC3F;AACF;AAIA,SAAgBM,EACd,GACA,GACoB;CACpB,IAAMN,IACHO,KAA4DC,GACzDC,IAASC;CAYf,OAAOd,EAAU;EAVf,UAAU,MAAO;GACf,IAAMe,IAAOD,EAAM,IAAIX,CAAY;GACnC,OAAOY,MAAS,KAAA,IAAY;IAAE,GAAG;IAAG,GAAG;IAAG,OAAO;IAAG,QAAQ;GAAE,IAAIC,EAAcH,GAAQE,CAAI;EAC9F;EACA,YAAY,MAAOD,EAAM,IAAIX,CAAY,CAAC,EAAE,UAAU;EACtD,eAAe,MAAO;GACpB,IAAMY,IAAOD,EAAM,IAAIX,CAAY;GACnC,OAAOY,MAAS,KAAA,KAAaE,EAAaF,CAAI;EAChD;CAEe,GAASX,CAAE;AAC9B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/interactions/actions/previewOverrides.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let { overrides: t } = e.scene;
|
|
4
|
+
for (let [n, r] of e.previews) {
|
|
5
|
+
let i = e.overrideEntries.get(n);
|
|
6
|
+
if (i) {
|
|
7
|
+
i.pose = r;
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
let a = { pose: r };
|
|
11
|
+
e.overrideEntries.set(n, a), t.set(n, a);
|
|
12
|
+
}
|
|
13
|
+
for (let n of e.overrideEntries.keys()) e.previews.has(n) || (e.overrideEntries.delete(n), t.clear(n));
|
|
14
|
+
t.commit();
|
|
15
|
+
}
|
|
16
|
+
function t(e) {
|
|
17
|
+
if (e.overrideEntries.size !== 0) {
|
|
18
|
+
for (let t of e.overrideEntries.keys()) e.scene.overrides.clear(t);
|
|
19
|
+
e.overrideEntries.clear(), e.scene.overrides.commit();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { t as dropPreviewOverrides, e as syncPreviewOverrides };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=previewOverrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewOverrides.js","names":["syncPreviewOverrides","state","id","pose","existing","entry","overrides","dropPreviewOverrides"],"sources":["../../../src/interactions/actions/previewOverrides.ts"],"sourcesContent":["/**\n * Publishing an in-flight gesture's poses where the *scene* can see them.\n *\n * An ongoing action keeps its per-frame poses in its own scratch and exposes\n * them as `previewIds` / `previewPose`. That surface is enough to paint a\n * ghost and to size selection chrome, but it is invisible to anything that\n * asks the scene where a node is — `sceneDepLookup`, which resolves a derived\n * node's geometry, and the pick source, which decides what the pointer can\n * grab. A node deriving its path from a dragged one therefore stayed anchored\n * to the pre-drag position and jumped on drop.\n *\n * These publish the same frame into the scene's ephemeral override table, the\n * one channel both of those already read. Nothing here reaches `executeAndLog`,\n * so a drag still commits as exactly one undo entry.\n */\nimport type { NodeId, Scene } from 'core/scene/types';\n\n/** The scratch fields these operate on. Actions carry more; this is the part\n * that has to agree across them. */\nexport interface PreviewOverrideState {\n scene: Scene<unknown, string, unknown>;\n /** This frame's poses, keyed by node id — the action's own buffer. */\n previews: Map<NodeId, unknown>;\n /** The entry published per id, held by reference so a frame mutates it in\n * place. Initialize to an empty map in the action's scratch. */\n overrideEntries: Map<NodeId, { pose: unknown }>;\n}\n\n/**\n * Publish `previews` as scene overrides. Call once per frame, after every\n * pass that can add to `previews` (a layout reflow, a cascade).\n *\n * Entries are set once and mutated in place, then published with a single\n * `commit()` — `PoseOverrides.set` notifies subscribers per call, so setting\n * every id every frame would fan out one repaint per node.\n */\nexport function syncPreviewOverrides(state: PreviewOverrideState): void {\n const { overrides } = state.scene;\n for (const [id, pose] of state.previews) {\n const existing = state.overrideEntries.get(id);\n if (existing) {\n existing.pose = pose;\n continue;\n }\n const entry = { pose };\n state.overrideEntries.set(id, entry);\n overrides.set(id, entry);\n }\n // An id can leave the preview set mid-gesture — a cascade child whose\n // container stopped being the drag root, a layout sibling that stopped\n // reflowing. Left published, it would pin that node to a stale frame.\n for (const id of state.overrideEntries.keys()) {\n if (state.previews.has(id)) continue;\n state.overrideEntries.delete(id);\n overrides.clear(id);\n }\n overrides.commit();\n}\n\n/**\n * Drop everything this gesture published. Call on both ends — on commit the\n * document poses take over, on cancel the untouched originals do.\n *\n * On commit, call it *after* the ops land: dropping first leaves a window in\n * which the scene answers with the pre-gesture pose.\n */\nexport function dropPreviewOverrides(state: PreviewOverrideState): void {\n if (state.overrideEntries.size === 0) return;\n for (const id of state.overrideEntries.keys()) state.scene.overrides.clear(id);\n state.overrideEntries.clear();\n state.scene.overrides.commit();\n}\n"],"mappings":";AAoCA,SAAgBA,EAAqB,GAAmC;CACtE,IAAM,EAAE,iBAAcC,EAAM;CAC5B,KAAK,IAAM,CAACC,GAAIC,MAASF,EAAM,UAAU;EACvC,IAAMG,IAAWH,EAAM,gBAAgB,IAAIC,CAAE;EAC7C,IAAIE,GAAU;GACZ,EAAS,OAAOD;GAChB;EACF;EACA,IAAME,IAAQ,EAAE,QAAK;EAErB,AADAJ,EAAM,gBAAgB,IAAIC,GAAIG,CAAK,GACnCC,EAAU,IAAIJ,GAAIG,CAAK;CACzB;CAIA,KAAK,IAAMH,KAAMD,EAAM,gBAAgB,KAAK,GAC1C,AAAIA,EAAM,SAAS,IAAIC,CAAE,MACzBD,EAAM,gBAAgB,OAAOC,CAAE,GAC/BI,EAAU,MAAMJ,CAAE;CAEpB,EAAU,OAAO;AACnB;AASA,SAAgBK,EAAqB,GAAmC;CACtE,IAAIN,EAAM,gBAAgB,SAAS,GACnC;OAAK,IAAMC,KAAMD,EAAM,gBAAgB,KAAK,GAAG,EAAM,MAAM,UAAU,MAAMC,CAAE;EAE7E,AADAD,EAAM,gBAAgB,MAAM,GAC5BA,EAAM,MAAM,UAAU,OAAO;CAFgD;AAG/E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RECT_POSE_DESCRIPTOR as e } from "../../../core/geometry/poseDescriptor.js";
|
|
2
|
+
import { pathPoseDescriptor as t } from "../../../features/paths/poseDescriptor.js";
|
|
3
|
+
//#region src/interactions/actions/resize/autoPoseDescriptor.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
return !!e && typeof e == "object" && "kind" in e && (e.kind === "polygon" || e.kind === "rect");
|
|
6
|
+
}
|
|
7
|
+
function r(e) {
|
|
8
|
+
if (!e || typeof e != "object") return !1;
|
|
9
|
+
let t = e;
|
|
10
|
+
return typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number";
|
|
11
|
+
}
|
|
12
|
+
var i = {
|
|
13
|
+
getBounds: (r) => n(r) ? t.getBounds(r) : e.getBounds(r),
|
|
14
|
+
remapBounds: (r, i, a) => n(r) ? t.remapBounds(r, i, a) : e.remapBounds(r, i, a),
|
|
15
|
+
fromBounds: (r, i) => n(i) ? t.fromBounds(r, i) : e.fromBounds(r, i),
|
|
16
|
+
translate: (r, i, a) => n(r) ? t.translate(r, i, a) : e.translate(r, i, a),
|
|
17
|
+
intersectsRect: (r, i) => n(r) ? t.intersectsRect(r, i) : e.intersectsRect(r, i),
|
|
18
|
+
getRotation: (e) => {
|
|
19
|
+
if (n(e)) return 0;
|
|
20
|
+
let t = e.rotation;
|
|
21
|
+
return typeof t == "number" ? t : 0;
|
|
22
|
+
},
|
|
23
|
+
supportsRotation: (e) => !n(e),
|
|
24
|
+
withRotation: (e, t) => n(e) ? e : {
|
|
25
|
+
...e,
|
|
26
|
+
rotation: t
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as AUTO_POSE_DESCRIPTOR, n as isPathLike, r as isRectPose };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=autoPoseDescriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoPoseDescriptor.js","names":["isPathLike","p","isRectPose","r","AUTO_POSE_DESCRIPTOR","pathPoseDescriptor","RECT_POSE_DESCRIPTOR","src","dst","template","b","dx","dy","rect"],"sources":["../../../../src/interactions/actions/resize/autoPoseDescriptor.ts"],"sourcesContent":["import type { Path } from '@weasel-js/geom';\nimport { pathPoseDescriptor } from 'features/paths/poseDescriptor';\nimport { RECT_POSE_DESCRIPTOR, type PoseDescriptor } from './geometry';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\n/** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for\n * callers that need to fork between `pathPoseDescriptor` and\n * `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire\n * `poseDescriptor` explicitly. */\nexport function isPathLike(p: unknown): p is Path {\n return !!p && typeof p === 'object' && 'kind' in p\n && ((p as { kind: unknown }).kind === 'polygon' || (p as { kind: unknown }).kind === 'rect');\n}\n\n/** True for a pose with numeric top-level `x`/`y`/`width`/`height` — the only\n * shape the rect descriptor and the kit's built-in painters can read. */\nexport function isRectPose(p: unknown): p is { x: number; y: number; width: number; height: number; rotation?: number } {\n if (!p || typeof p !== 'object') return false;\n const r = p as Record<string, unknown>;\n return typeof r.x === 'number' && typeof r.y === 'number'\n && typeof r.width === 'number' && typeof r.height === 'number';\n}\n\n/** Per-call dispatch: if the pose looks like a Path, route to\n * `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing\n * demos with Path TPose to wire `poseDescriptor={pathPoseDescriptor}`\n * explicitly. `getRotation` surfaces a `pose.rotation` field on non-Path poses\n * so demos using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to\n * wire `poseDescriptor={ROTATED_POSE_DESCRIPTOR}` just to get rotated\n * selection chrome and rotation-aware corner hit-tests. */\nexport const AUTO_POSE_DESCRIPTOR: PoseDescriptor<unknown> = {\n getBounds: (p) => isPathLike(p)\n ? pathPoseDescriptor.getBounds(p)\n : RECT_POSE_DESCRIPTOR.getBounds(p as { x: number; y: number; width: number; height: number }),\n remapBounds: (p, src, dst) => isPathLike(p)\n ? pathPoseDescriptor.remapBounds(p, src, dst)\n : RECT_POSE_DESCRIPTOR.remapBounds(p as { x: number; y: number; width: number; height: number }, src, dst),\n fromBounds: (b, template) => isPathLike(template)\n ? pathPoseDescriptor.fromBounds(b, template)\n : RECT_POSE_DESCRIPTOR.fromBounds(b, template as Bounds),\n translate: (p, dx, dy) => isPathLike(p)\n ? pathPoseDescriptor.translate!(p, dx, dy)\n : RECT_POSE_DESCRIPTOR.translate!(p as { x: number; y: number; width: number; height: number }, dx, dy),\n intersectsRect: (p, rect) => isPathLike(p)\n ? pathPoseDescriptor.intersectsRect!(p, rect)\n : RECT_POSE_DESCRIPTOR.intersectsRect!(p as { x: number; y: number; width: number; height: number }, rect),\n getRotation: (p) => {\n if (isPathLike(p)) return 0;\n const r = (p as { rotation?: unknown }).rotation;\n return typeof r === 'number' ? r : 0;\n },\n // Path-shaped poses can't carry rotation (see `pathPoseDescriptor`).\n // Everything else flows through `wrapWithPoseRotation`'s x/y/w/h gate at\n // paint time, so report `true` and let the wrapper no-op for poses\n // missing AABB fields.\n supportsRotation: (p) => !isPathLike(p),\n withRotation: (p, rotation) => isPathLike(p) ? p : { ...(p as object), rotation },\n};\n"],"mappings":";;;AASA,SAAgBA,EAAW,GAAuB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