@weasel-js/core 1.7.0 → 1.7.2
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 +794 -0
- package/README.md +14 -8
- 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-vCdt55xm.d.ts} +2 -2
- package/dist/{builtins-DLn2lCr_.d.ts → builtins-C-gRyVRx.d.ts} +742 -513
- 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 +102 -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 +93 -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-Dp2IxLGb.d.ts → cornerHandles-BCrDp_mH.d.ts} +3 -13
- 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 +39 -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.d.ts +1960 -1891
- 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 +107 -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 +760 -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 +335 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +184 -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 +181 -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 +31 -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-Drrw4ewZ.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 -49
- package/dist/move.js +3 -142
- package/dist/originProjection-DEklpDc_.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
- 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 +11 -21
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/style.css +2 -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-D-9QWBy5.d.ts → types-A37hYkeR.d.ts} +185 -15
- package/dist/{types-qYpyTAiZ.d.ts → types-B_9g6hMM.d.ts} +32 -6
- 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 -19
- package/dist/chunk-3TY6FHAF.js +0 -170
- package/dist/chunk-3TY6FHAF.js.map +0 -1
- package/dist/chunk-DGWNNKGD.js +0 -248
- package/dist/chunk-DGWNNKGD.js.map +0 -1
- package/dist/chunk-G4ZGQMY7.js +0 -33372
- package/dist/chunk-G4ZGQMY7.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-LU4IJ52W.js +0 -111
- package/dist/chunk-LU4IJ52W.js.map +0 -1
- package/dist/chunk-M24CLARN.js +0 -28
- package/dist/chunk-M24CLARN.js.map +0 -1
- package/dist/chunk-NE27EOLP.js +0 -146
- package/dist/chunk-NE27EOLP.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-UPZY4ART.js +0 -29
- package/dist/chunk-UPZY4ART.js.map +0 -1
- package/dist/chunk-WPNA6L5O.js +0 -250
- package/dist/chunk-WPNA6L5O.js.map +0 -1
- package/dist/chunk-XMAWPGTK.js +0 -128
- package/dist/chunk-XMAWPGTK.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-CY5UKlZh.d.ts +0 -98
- package/dist/index.css +0 -62
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -36
- 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/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -62
- 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
package/README.md
CHANGED
|
@@ -24,6 +24,13 @@ npm install @weasel-js/core react
|
|
|
24
24
|
|
|
25
25
|
`react` is a peer dependency (>=18).
|
|
26
26
|
|
|
27
|
+
The canvas's debug overlays (`cursorCoordsHud`, `pickHud`, `modalityHud`) are
|
|
28
|
+
styled by core's stylesheet. Import it once if you turn any of them on:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import '@weasel-js/core/style.css';
|
|
32
|
+
```
|
|
33
|
+
|
|
27
34
|
## How it fits together
|
|
28
35
|
|
|
29
36
|
`useScene` holds the scene: a tree of leaf and container nodes, each carrying your data and a pose. Every change to it is an **op**, which is what makes it undoable. `<SceneCanvas>` renders a scene and routes input to it.
|
|
@@ -47,11 +54,11 @@ A bare `<SceneCanvas>` only renders. It keeps a selection that nothing sets from
|
|
|
47
54
|
Interactions are **actions** — descriptors registered into an actions registry — reached by **gesture bindings**. A tool is a list of `{ spec, actionId }` pairs and nothing more; the kit's own select, shape and viewport tools are built that way.
|
|
48
55
|
|
|
49
56
|
```tsx
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
} from '@weasel-js/core';
|
|
57
|
+
import { SceneCanvas, BUILTIN_TOOL_IDS, useScene, useSelection, type RectPose } from '@weasel-js/core';
|
|
58
|
+
import { createGridLayer, gridSnapStrategy } from '@weasel-js/guides';
|
|
53
59
|
|
|
54
60
|
const W = 800, H = 600;
|
|
61
|
+
const grid = createGridLayer({ spacing: 20, bounds: () => ({ x: 0, y: 0, width: W, height: H }) });
|
|
55
62
|
|
|
56
63
|
export function Editor() {
|
|
57
64
|
const scene = useScene({ systemLayers: [{ id: 'default' }], initial: [] });
|
|
@@ -66,13 +73,10 @@ export function Editor() {
|
|
|
66
73
|
height={H}
|
|
67
74
|
scene={scene}
|
|
68
75
|
selection={selection}
|
|
69
|
-
selectionMode="multi"
|
|
70
76
|
features={['draw']}
|
|
71
77
|
defaultTools={BUILTIN_TOOL_IDS}
|
|
72
78
|
selectTool={{ snap: gridSnapStrategy<RectPose>(20) }}
|
|
73
|
-
layers={{
|
|
74
|
-
grid: { spacing: 20, bounds: () => ({ x: 0, y: 0, width: W, height: H }) },
|
|
75
|
-
}}
|
|
79
|
+
layers={{ grid: { layer: grid } }}
|
|
76
80
|
/>
|
|
77
81
|
);
|
|
78
82
|
}
|
|
@@ -168,7 +172,7 @@ Core's main entry carries the everyday surface. A few narrower ones have their o
|
|
|
168
172
|
| Import | Holds |
|
|
169
173
|
|---|---|
|
|
170
174
|
| `@weasel-js/core/renderer` | the renderer, `registerProgram`, `registerTexture`, draw commands |
|
|
171
|
-
| `@weasel-js/core/move`, `/resize`, `/
|
|
175
|
+
| `@weasel-js/core/move`, `/resize`, `/clone`, `/clipboard` | helpers for building on those actions, e.g. `snapBackOrDelete`, `clampMinSize` |
|
|
172
176
|
| `@weasel-js/core/patterns-builtin` | the built-in fill patterns |
|
|
173
177
|
| `@weasel-js/core/routing` | route grammar and introspection: parsing, the route registry, conflict checks |
|
|
174
178
|
|
|
@@ -182,6 +186,7 @@ Every package is published under `@weasel-js` and released together at one versi
|
|
|
182
186
|
| `geom` | pure 2D geometry — affine, box, curve, polyline; polygon booleans under `./booleans` |
|
|
183
187
|
| `gestures` | the gesture taxonomy, route grammars and matchers; no React, no DOM |
|
|
184
188
|
| `history` | undo/redo with scoped sub-histories; no React, no DOM |
|
|
189
|
+
| `react` | generic React hooks the other packages share: `useLatest`, `useStableByContent` |
|
|
185
190
|
| `paint` | fills, strokes, gradients and dashes as plain data |
|
|
186
191
|
| `text` | styled runs, kerned layout, wrapping and measurement |
|
|
187
192
|
| `bidi` | the Unicode Bidirectional Algorithm (UAX #9) |
|
|
@@ -189,6 +194,7 @@ Every package is published under `@weasel-js` and released together at one versi
|
|
|
189
194
|
| `svg` | SVG import and export |
|
|
190
195
|
| `modes` | app-level modality: capability tags, mode definitions, a mode registry |
|
|
191
196
|
| `diagram` | node-link diagrams: ports on any node's perimeter, flowchart-style bodies |
|
|
197
|
+
| `guides` | placement aids: grids, guide lines, alignment and snapping to them, container layout strategies |
|
|
192
198
|
| `hud` | WebGL-rendered widgets composited into a canvas |
|
|
193
199
|
| `cursor` | tool cursors as authored glyphs, baked to CSS or painted when too large |
|
|
194
200
|
| `loupe` | a magnifier model: where it's aimed, how far it magnifies, what's under it |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PointerContextProvider as e } from "./features/pointer/PointerContext.js";
|
|
2
|
+
import { SelectionContextProvider as t, SelectionContextProviderIfRoot as n } from "./features/selection/SelectionContext.js";
|
|
3
|
+
import { PointerProviderIfRoot as r } from "./canvas/SceneCanvas/PointerProviderIfRoot.js";
|
|
4
|
+
import { ActionsProviderIfRoot as i } from "./canvas/SceneCanvas/ActionsProviderIfRoot.js";
|
|
5
|
+
import { DepRegistryProviderIfRoot as a } from "./canvas/SceneCanvas/DepRegistryProviderIfRoot.js";
|
|
6
|
+
import { ActionsProvider as o, ActiveToolContextProvider as s, ActiveToolContextProviderIfRoot as c, DepRegistryProvider as l } from "@weasel-js/routing/react";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/WeaselProvider.tsx
|
|
9
|
+
function d({ children: d, isolate: f = !1 }) {
|
|
10
|
+
return /* @__PURE__ */ u(f ? l : a, { children: /* @__PURE__ */ u(f ? o : i, { children: /* @__PURE__ */ u(f ? s : c, { children: /* @__PURE__ */ u(f ? t : n, { children: /* @__PURE__ */ u(f ? e : r, { children: d }) }) }) }) });
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { d as WeaselProvider };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=WeaselProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeaselProvider.js","names":["WeaselProvider","isolate","DepRegistryProvider","DepRegistryProviderIfRoot","ActionsProvider","ActionsProviderIfRoot","ActiveToolContextProvider","ActiveToolContextProviderIfRoot","SelectionContextProvider","SelectionContextProviderIfRoot","PointerContextProvider","PointerProviderIfRoot"],"sources":["../src/WeaselProvider.tsx"],"sourcesContent":["/**\n * `<WeaselProvider>` — top-level convenience that mounts all five kit-root\n * contexts in a single wrap. By default each underlying provider uses its\n * `IfRoot` variant, so `<WeaselProvider>` is safely nestable: when a parent\n * `<WeaselProvider>` (or any of the individual providers) is already in\n * scope, the inner one renders its children unwrapped and defers to the\n * parent registry. `isolate` opts out of that.\n *\n * Use this at the harness / app root above any `useTools(...)` call so the\n * resulting `ToolsApi` is bound to the same `ActiveToolContext` the\n * surrounding `<SceneCanvas>` reads — otherwise keybinding-driven tool\n * switches update local state in the outer `useTools` but the dispatcher\n * (which reads the context) sees a stale active tool.\n *\n * Provider nesting order matches the order `<SceneCanvas>` mounts them\n * internally so swapping a manual SceneCanvas-wrapping setup for\n * `<WeaselProvider>` doesn't change effect ordering.\n */\nimport type { ComponentType, ReactNode } from 'react';\nimport { DepRegistryProviderIfRoot } from './canvas/SceneCanvas/DepRegistryProviderIfRoot';\nimport { ActionsProviderIfRoot } from './canvas/SceneCanvas/ActionsProviderIfRoot';\nimport { PointerProviderIfRoot } from './canvas/SceneCanvas/PointerProviderIfRoot';\nimport { ActiveToolContextProvider, ActiveToolContextProviderIfRoot } from '@weasel-js/routing/react';\nimport {\n SelectionContextProvider,\n SelectionContextProviderIfRoot,\n} from './features/selection/SelectionContext';\nimport { DepRegistryProvider } from '@weasel-js/routing/react';\nimport { ActionsProvider } from '@weasel-js/routing/react';\nimport { PointerContextProvider } from './features/pointer/PointerContext';\n\ntype Wrapper = ComponentType<{ children: ReactNode }>;\n\n/** Props for {@link WeaselProvider}. */\nexport interface WeaselProviderProps {\n children: ReactNode;\n /**\n * Mount every provider unconditionally rather than deferring to one already\n * in scope.\n *\n * An actions registry holds one dispatcher, so a second `<SceneCanvas>`\n * joining a scope displaces the first and takes its input away. Two canvases\n * on one page each want their own scope; wrap each in an isolated provider.\n * The cost is that they share nothing — a toolbar outside both can drive\n * neither.\n */\n isolate?: boolean;\n}\n\n/**\n * Mounts every kit-wide provider at once — deps, actions, active tool,\n * selection and pointer — each only if one is not already in scope, or\n * unconditionally under `isolate`.\n *\n * `<SceneCanvas>` does this for itself, so this is for the case where kit\n * state has to be shared by things outside a canvas: a toolbar, a property\n * panel, or two canvases that should agree on the selection.\n */\nexport function WeaselProvider({ children, isolate = false }: WeaselProviderProps) {\n const Deps: Wrapper = isolate ? DepRegistryProvider : DepRegistryProviderIfRoot;\n const Actions: Wrapper = isolate ? ActionsProvider : ActionsProviderIfRoot;\n const ActiveTool: Wrapper = isolate\n ? ActiveToolContextProvider\n : ActiveToolContextProviderIfRoot;\n const Selection: Wrapper = isolate\n ? SelectionContextProvider\n : SelectionContextProviderIfRoot;\n const Pointer: Wrapper = isolate ? PointerContextProvider : PointerProviderIfRoot;\n return (\n <Deps>\n <Actions>\n <ActiveTool>\n <Selection>\n <Pointer>\n {children}\n </Pointer>\n </Selection>\n </ActiveTool>\n </Actions>\n </Deps>\n );\n}\n"],"mappings":";;;;;;;;AA0DA,SAAgBA,EAAe,EAAE,aAAU,aAAU,MAA8B;CAUjF,OACE,kBAVoBC,IAAUC,IAAsBC,GAUpD,EAAA,UACE,kBAVqBF,IAAUG,IAAkBC,GAUjD,EAAA,UACE,kBAVsBJ,IACxBK,IACAC,GAQE,EAAA,UACE,kBARmBN,IACvBO,IACAC,GAMI,EAAA,UACE,kBANeR,IAAUS,IAAyBC,GAMlD,EACG,YACM,CAAA,EACA,CAAA,EACD,CAAA,EACL,CAAA,EACL,CAAA;AAEV"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { viewToTransform as e } from "../core/viewport/view.js";
|
|
2
|
+
import { worldToScreen as t } from "../core/viewport/viewTransform.js";
|
|
3
|
+
import { pxExtent as n } from "../core/viewport/pxExtent.js";
|
|
4
|
+
import { angleOf as r, annulusSemiAxes as i, hitAffordanceRegions as a, localToWorld as o, pointRegionAnchor as s, pointRegionFrame as c, pointRegionScreenQuad as l, transformOf as u } from "./hitAffordanceRegions.js";
|
|
5
|
+
import { PATH_L as d, PATH_M as f, PATH_Z as p } from "@weasel-js/geom";
|
|
6
|
+
//#region src/affordances/composeAffordanceLayer.ts
|
|
7
|
+
function m(t, n, r) {
|
|
8
|
+
return {
|
|
9
|
+
id: t,
|
|
10
|
+
label: n,
|
|
11
|
+
space: "screen",
|
|
12
|
+
draw: (t, n, i) => {
|
|
13
|
+
let a = h(t), o = g(t), s = _(t), c = [], l = e(n);
|
|
14
|
+
for (let e of r) if (!s || s(e.id)) {
|
|
15
|
+
for (let t of e.regions(a)) {
|
|
16
|
+
let r = u(a, t.targetId);
|
|
17
|
+
t.paint && y(t, r, n, a, l, c), o && v(o, e.id, t, r, n);
|
|
18
|
+
}
|
|
19
|
+
if (e.decorate) for (let t of e.decorate(a, n)) c.push(t);
|
|
20
|
+
}
|
|
21
|
+
return c;
|
|
22
|
+
},
|
|
23
|
+
hitTest: (e, t, n, i, o, s) => {
|
|
24
|
+
let c = h(n);
|
|
25
|
+
if (!c) return null;
|
|
26
|
+
let l = a(r, e, t, c, i, s ?? _(n) ?? void 0);
|
|
27
|
+
if (!l) return null;
|
|
28
|
+
let { cursor: u, strength: d, claimedKinds: f } = l.region;
|
|
29
|
+
return {
|
|
30
|
+
...l.binding,
|
|
31
|
+
...u === void 0 ? {} : { cursor: u },
|
|
32
|
+
...d === void 0 ? {} : { strength: d },
|
|
33
|
+
...f === void 0 ? {} : { claimedKinds: f }
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function h(e) {
|
|
39
|
+
let t = e;
|
|
40
|
+
return typeof t?.getChromeState == "function" ? t.getChromeState() : e;
|
|
41
|
+
}
|
|
42
|
+
function g(e) {
|
|
43
|
+
let t = e;
|
|
44
|
+
return typeof t?.getDebug == "function" ? t.getDebug() : null;
|
|
45
|
+
}
|
|
46
|
+
function _(e) {
|
|
47
|
+
let t = e;
|
|
48
|
+
return typeof t?.getIsVisible == "function" ? t.getIsVisible() : null;
|
|
49
|
+
}
|
|
50
|
+
function v(e, t, n, a, s) {
|
|
51
|
+
if (n.shape.kind === "point") {
|
|
52
|
+
let r = c(n.shape, a, s), i = l(n.shape, a, s, (e, t) => [e, t]);
|
|
53
|
+
e.recordHitbox(t, "handle", {
|
|
54
|
+
kind: "polygon",
|
|
55
|
+
points: i.map((e) => ({
|
|
56
|
+
x: r.x + (e.x - r.x) / s.scale.x,
|
|
57
|
+
y: r.y + (e.y - r.y) / s.scale.y
|
|
58
|
+
}))
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (n.shape.kind === "annulus") {
|
|
63
|
+
let c = n.shape, { rx: l, ry: u } = i(c, s, r(a)), d = [
|
|
64
|
+
o(a, c.cx + l, c.cy),
|
|
65
|
+
o(a, c.cx - l, c.cy),
|
|
66
|
+
o(a, c.cx, c.cy + u),
|
|
67
|
+
o(a, c.cx, c.cy - u)
|
|
68
|
+
], f = Math.min(...d.map((e) => e.x)), p = Math.min(...d.map((e) => e.y)), m = Math.max(...d.map((e) => e.x)), h = Math.max(...d.map((e) => e.y));
|
|
69
|
+
e.recordHitbox(t, "handle", {
|
|
70
|
+
kind: "rect",
|
|
71
|
+
x: f,
|
|
72
|
+
y: p,
|
|
73
|
+
width: m - f,
|
|
74
|
+
height: h - p,
|
|
75
|
+
...a.identity ? {} : { rotation: Math.atan2(a.sin, a.cos) }
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let u = n.shape, d = o(a, u.x + u.width / 2, u.y + u.height / 2);
|
|
80
|
+
e.recordHitbox(t, "handle", {
|
|
81
|
+
kind: "rect",
|
|
82
|
+
x: d.x - u.width / 2,
|
|
83
|
+
y: d.y - u.height / 2,
|
|
84
|
+
width: u.width,
|
|
85
|
+
height: u.height,
|
|
86
|
+
...a.identity ? {} : { rotation: Math.atan2(a.sin, a.cos) }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function y(e, a, o, s, l, u) {
|
|
90
|
+
let m = e.paint;
|
|
91
|
+
if (m.kind === "square") {
|
|
92
|
+
if (e.shape.kind !== "point") return;
|
|
93
|
+
let n = c(e.shape, a, o), [r, i] = t(n.x, n.y, l), s = m.sizePx / 2, h = m.fill ? { fill: m.fill } : {}, g = m.stroke ? { stroke: m.stroke } : {};
|
|
94
|
+
if (n.angle === 0) {
|
|
95
|
+
u.push({
|
|
96
|
+
kind: "path",
|
|
97
|
+
path: {
|
|
98
|
+
kind: "rect",
|
|
99
|
+
x: r - s,
|
|
100
|
+
y: i - s,
|
|
101
|
+
width: m.sizePx,
|
|
102
|
+
height: m.sizePx
|
|
103
|
+
},
|
|
104
|
+
...h,
|
|
105
|
+
...g
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
let _ = Math.cos(n.angle) * s, v = Math.sin(n.angle) * s, y = /* @__PURE__ */ new Float32Array(8);
|
|
110
|
+
[
|
|
111
|
+
[-1, -1],
|
|
112
|
+
[1, -1],
|
|
113
|
+
[1, 1],
|
|
114
|
+
[-1, 1]
|
|
115
|
+
].forEach(([e, t], n) => {
|
|
116
|
+
y[n * 2] = r + _ * e - v * t, y[n * 2 + 1] = i + v * e + _ * t;
|
|
117
|
+
}), u.push({
|
|
118
|
+
kind: "path",
|
|
119
|
+
path: {
|
|
120
|
+
kind: "polygon",
|
|
121
|
+
commands: new Uint8Array([
|
|
122
|
+
f,
|
|
123
|
+
d,
|
|
124
|
+
d,
|
|
125
|
+
d,
|
|
126
|
+
p
|
|
127
|
+
]),
|
|
128
|
+
coords: y,
|
|
129
|
+
fillRule: "nonzero"
|
|
130
|
+
},
|
|
131
|
+
...h,
|
|
132
|
+
...g
|
|
133
|
+
});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (m.kind === "annulus") {
|
|
137
|
+
if (e.shape.kind !== "annulus") return;
|
|
138
|
+
let t = e.shape, s = n(m.insetPx ?? 0, o.scale, r(a)), c = b(t, i(t, o, r(a)), s, a, l, m.fill, m.stroke);
|
|
139
|
+
c && u.push(c);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (m.kind === "custom") {
|
|
143
|
+
let t = {
|
|
144
|
+
world: x(e, a, o),
|
|
145
|
+
local: e.shape,
|
|
146
|
+
view: o,
|
|
147
|
+
state: s
|
|
148
|
+
};
|
|
149
|
+
for (let e of m.draw(t)) u.push(e);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function b(e, n, r, i, a, s, c) {
|
|
154
|
+
let l = n.rx - r.x, u = n.ry - r.y;
|
|
155
|
+
if (l <= 0 || u <= 0) return null;
|
|
156
|
+
let m = e.cx, h = e.cy, g = e.innerWidth / 2 + r.x, _ = e.innerHeight / 2 + r.y, v = _ < u, y = g < l;
|
|
157
|
+
if (!v && !y) return null;
|
|
158
|
+
let b = v ? l * Math.sqrt(1 - (_ / u) ** 2) : 0, x = y ? u * Math.sqrt(1 - (g / l) ** 2) : 0, S = [], C = [];
|
|
159
|
+
function w(e, t) {
|
|
160
|
+
S.push(f), C.push({
|
|
161
|
+
x: m + l * Math.cos(e),
|
|
162
|
+
y: h + u * Math.sin(e)
|
|
163
|
+
});
|
|
164
|
+
for (let n = 1; n <= 24; n++) {
|
|
165
|
+
let r = e + (t - e) * (n / 24);
|
|
166
|
+
S.push(d), C.push({
|
|
167
|
+
x: m + l * Math.cos(r),
|
|
168
|
+
y: h + u * Math.sin(r)
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
S.push(p);
|
|
172
|
+
}
|
|
173
|
+
v && (w(Math.atan2(-_ / u, b / l), Math.atan2(-_ / u, -b / l)), w(Math.atan2(_ / u, b / l), Math.atan2(_ / u, -b / l))), y && (w(Math.atan2(-x / u, g / l), Math.atan2(x / u, g / l)), w(Math.atan2(-x / u, -g / l), Math.atan2(x / u, -g / l) - 2 * Math.PI));
|
|
174
|
+
let T = new Float32Array(C.length * 2);
|
|
175
|
+
for (let e = 0; e < C.length; e++) {
|
|
176
|
+
let n = o(i, C[e].x, C[e].y), [r, s] = t(n.x, n.y, a);
|
|
177
|
+
T[e * 2] = r, T[e * 2 + 1] = s;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
kind: "path",
|
|
181
|
+
path: {
|
|
182
|
+
kind: "polygon",
|
|
183
|
+
commands: new Uint8Array(S),
|
|
184
|
+
coords: T,
|
|
185
|
+
fillRule: "nonzero"
|
|
186
|
+
},
|
|
187
|
+
...s ? { fill: s } : {},
|
|
188
|
+
...c ? { stroke: c } : {}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function x(e, t, n) {
|
|
192
|
+
if (e.shape.kind === "point") {
|
|
193
|
+
let r = s(e.shape, t, n);
|
|
194
|
+
return {
|
|
195
|
+
x: r.x,
|
|
196
|
+
y: r.y
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (e.shape.kind === "annulus") {
|
|
200
|
+
let a = e.shape, { rx: s, ry: c } = i(a, n, r(t)), l = [
|
|
201
|
+
o(t, a.cx + s, a.cy),
|
|
202
|
+
o(t, a.cx - s, a.cy),
|
|
203
|
+
o(t, a.cx, a.cy + c),
|
|
204
|
+
o(t, a.cx, a.cy - c)
|
|
205
|
+
], u = Math.min(...l.map((e) => e.x)), d = Math.min(...l.map((e) => e.y)), f = Math.max(...l.map((e) => e.x)), p = Math.max(...l.map((e) => e.y));
|
|
206
|
+
return {
|
|
207
|
+
x: u,
|
|
208
|
+
y: d,
|
|
209
|
+
width: f - u,
|
|
210
|
+
height: p - d
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
let a = e.shape, c = o(t, a.x, a.y), l = o(t, a.x + a.width, a.y), u = o(t, a.x, a.y + a.height), d = o(t, a.x + a.width, a.y + a.height), f = Math.min(c.x, l.x, u.x, d.x), p = Math.min(c.y, l.y, u.y, d.y), m = Math.max(c.x, l.x, u.x, d.x), h = Math.max(c.y, l.y, u.y, d.y);
|
|
214
|
+
return {
|
|
215
|
+
x: f,
|
|
216
|
+
y: p,
|
|
217
|
+
width: m - f,
|
|
218
|
+
height: h - p
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { m as composeAffordanceLayer };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=composeAffordanceLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAffordanceLayer.js","names":["composeAffordanceLayer","state","asChromeState","data","debug","asDebugSink","isVisible","asIsVisible","out","t","viewToTransform","view","a","affordances","region","xf","transformOf","paintRegion","recordRegionHitbox","cmd","hit","hitAffordanceRegions","wx","wy","cursor","strength","claimedKinds","maybe","f","pointRegionFrame","quad","pointRegionScreenQuad","x","y","affordanceId","q","s","annulusSemiAxes","angleOf","pts","localToWorld","rx","ry","minX","p","minY","maxX","maxY","r","w","paint","sx","sy","worldToScreen","viewT","half","fill","stroke","c","sn","coords","u","v","i","PATH_M","PATH_L","PATH_Z","insetLocal","pxExtent","annulusCommand","ctx","worldOf","semiAxes","cx","shape","cy","rectHW","rectHH","haveTopBottom","haveLeftRight","xT","yR","cmds","localPts","appendPetal","t0","t1","pointRegionAnchor","b"],"sources":["../../src/affordances/composeAffordanceLayer.ts"],"sourcesContent":["import type { RenderLayer } from 'core/layers/render';\nimport type { DrawCommand } from '../renderer';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { pxExtent } from 'core/viewport/pxExtent';\nimport type { DebugSink } from '../debug/types';\nimport type { FillStyle, Stroke } from '@weasel-js/paint';\nimport { PATH_M, PATH_L, PATH_Z } from '@weasel-js/geom';\nimport {\n angleOf,\n annulusSemiAxes,\n hitAffordanceRegions,\n localToWorld,\n pointRegionAnchor,\n pointRegionFrame,\n pointRegionScreenQuad,\n transformOf,\n type TargetTransform,\n} from './hitAffordanceRegions';\nimport type {\n Affordance,\n AffordanceRegion,\n CustomPaintContext,\n LayerHit,\n} from './types';\n\n/**\n * @experimental\n * Bundle a list of Affordances into a single RenderLayer.\n *\n * Each affordance declares interactive regions in target-local coordinates;\n * this layer composes each target's bounds transform (rotation around the\n * AABB center, when present) once per region for both paint and hit-test.\n *\n * FillStyle order matches array order (first → last = bottom → top). Hit-test\n * walks regions in reverse (top → bottom) and returns the first non-null\n * binding.\n *\n * `decorate(state, view)` runs *after* a given affordance's regions for\n * paint only — useful for leader lines and other purely-visual chrome that\n * don't fit the region model.\n */\nexport function composeAffordanceLayer(\n id: string,\n label: string,\n affordances: readonly Affordance[],\n): RenderLayer<ChromeState> & {\n hitTest(\n wx: number,\n wy: number,\n state: unknown,\n view: View,\n dims: { width: number; height: number },\n isVisible?: (id: string) => boolean,\n ): LayerHit | null;\n} {\n return {\n id,\n label,\n space: 'screen',\n draw: (data, view, _dims): DrawCommand[] => {\n const state = asChromeState(data);\n const debug = asDebugSink(data);\n const isVisible = asIsVisible(data);\n const out: DrawCommand[] = [];\n const t = viewToTransform(view);\n for (const a of affordances) {\n if (isVisible && !isVisible(a.id)) continue;\n for (const region of a.regions(state)) {\n const xf = transformOf(state, region.targetId);\n if (region.paint) paintRegion(region, xf, view, state, t, out);\n if (debug) recordRegionHitbox(debug, a.id, region, xf, view);\n }\n if (a.decorate) {\n for (const cmd of a.decorate(state, view)) out.push(cmd);\n }\n }\n return out;\n },\n // The walk itself lives in `hitAffordanceRegions` so this layer and\n // `buildAffordanceAt` share one implementation rather than two that can\n // drift. This wrapper lifts the region's declared cursor and claim onto\n // the binding, the way `buildAffordanceAt` lifts them onto `AffordanceHit`.\n hitTest: (wx, wy, data, view, _dims, isVisible): LayerHit | null => {\n const state = asChromeState(data);\n if (!state) return null;\n const hit = hitAffordanceRegions(\n affordances, wx, wy, state, view, isVisible ?? asIsVisible(data) ?? undefined,\n );\n if (!hit) return null;\n const { cursor, strength, claimedKinds } = hit.region;\n return {\n ...hit.binding,\n ...(cursor !== undefined ? { cursor } : {}),\n ...(strength !== undefined ? { strength } : {}),\n ...(claimedKinds !== undefined ? { claimedKinds } : {}),\n };\n },\n };\n}\n\n// ─── Data unwrappers ────────────────────────────────────────────────────────\n\n// `draw` is called by Canvas with `CanvasHelpers` and by tests with a bare\n// `ChromeState`. Tests stay terse this way, and production gets the live\n// debug sink via the same channel.\nfunction asChromeState(data: unknown): ChromeState {\n const maybe = data as { getChromeState?: () => ChromeState };\n if (typeof maybe?.getChromeState === 'function') return maybe.getChromeState();\n return data as ChromeState;\n}\n\nfunction asDebugSink(data: unknown): DebugSink | null {\n const maybe = data as { getDebug?: () => DebugSink | null };\n if (typeof maybe?.getDebug === 'function') return maybe.getDebug();\n return null;\n}\n\n/** Pull a chrome-caps visibility predicate off the data envelope when\n * present. When absent (legacy callers / tests passing bare state),\n * every affordance renders — preserves pre-chrome-caps behavior. */\nfunction asIsVisible(data: unknown): ((id: string) => boolean) | null {\n const maybe = data as { getIsVisible?: () => (id: string) => boolean };\n if (typeof maybe?.getIsVisible === 'function') return maybe.getIsVisible();\n return null;\n}\n\nfunction recordRegionHitbox(\n debug: DebugSink,\n affordanceId: string,\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n): void {\n if (region.shape.kind === 'point') {\n // The hit square is a square on *screen* — turned with the target when the\n // region asks — so in world it is a parallelogram, recorded as one.\n const f = pointRegionFrame(region.shape, xf, view);\n const quad = pointRegionScreenQuad(region.shape, xf, view, (x, y) => [x, y]);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'polygon',\n points: quad.map((q) => ({\n x: f.x + (q.x - f.x) / view.scale.x,\n y: f.y + (q.y - f.y) / view.scale.y,\n })),\n });\n return;\n }\n if (region.shape.kind === 'annulus') {\n // Approximate the annulus visualization as the outer ellipse's AABB.\n // The DebugSink's hitbox primitives don't model ring shapes; the\n // always-visible dev paint (`paint.kind === 'annulus'`) draws the\n // actual ring. Consumers that want a precise debug overlay can match\n // against the affordance id and render the annulus themselves.\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n const pts = [\n localToWorld(xf, s.cx + rx, s.cy),\n localToWorld(xf, s.cx - rx, s.cy),\n localToWorld(xf, s.cx, s.cy + ry),\n localToWorld(xf, s.cx, s.cy - ry),\n ];\n const minX = Math.min(...pts.map((p) => p.x));\n const minY = Math.min(...pts.map((p) => p.y));\n const maxX = Math.max(...pts.map((p) => p.x));\n const maxY = Math.max(...pts.map((p) => p.y));\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY,\n ...(xf.identity ? {} : { rotation: Math.atan2(xf.sin, xf.cos) }),\n });\n return;\n }\n // rect: axis-aligned in local frame; apply target rotation around the\n // AABB pivot when present.\n const r = region.shape;\n const w = localToWorld(xf, r.x + r.width / 2, r.y + r.height / 2);\n debug.recordHitbox(affordanceId, 'handle', {\n kind: 'rect',\n x: w.x - r.width / 2,\n y: w.y - r.height / 2,\n width: r.width,\n height: r.height,\n ...(xf.identity ? {} : { rotation: Math.atan2(xf.sin, xf.cos) }),\n });\n}\n\n// ─── FillStyle ──────────────────────────────────────────────────────────────────\n\nfunction paintRegion(\n region: AffordanceRegion,\n xf: TargetTransform,\n view: View,\n state: ChromeState,\n viewT: ReturnType<typeof viewToTransform>,\n out: DrawCommand[],\n): void {\n const paint = region.paint!;\n if (paint.kind === 'square') {\n if (region.shape.kind !== 'point') {\n // 'square' only makes sense over a point shape. Silently skip — a\n // future paint variant can cover rect outlines.\n return;\n }\n // Same frame the hit-test reads, at the paint's own size.\n const f = pointRegionFrame(region.shape, xf, view);\n const [sx, sy] = worldToScreen(f.x, f.y, viewT);\n const half = paint.sizePx / 2;\n const fill = paint.fill ? { fill: paint.fill } : {};\n const stroke = paint.stroke ? { stroke: paint.stroke } : {};\n if (f.angle === 0) {\n out.push({\n kind: 'path',\n path: { kind: 'rect', x: sx - half, y: sy - half, width: paint.sizePx, height: paint.sizePx },\n ...fill, ...stroke,\n });\n return;\n }\n const c = Math.cos(f.angle) * half, sn = Math.sin(f.angle) * half;\n const coords = new Float32Array(8);\n [[-1, -1], [1, -1], [1, 1], [-1, 1]].forEach(([u, v], i) => {\n coords[i * 2] = sx + c * u - sn * v;\n coords[i * 2 + 1] = sy + sn * u + c * v;\n });\n out.push({\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]), coords, fillRule: 'nonzero' },\n ...fill, ...stroke,\n });\n return;\n }\n if (paint.kind === 'annulus') {\n if (region.shape.kind !== 'annulus') return; // type mismatch — silent skip\n const s = region.shape;\n // Convert the screen-px inset to target-local units so it visually\n // matches at any zoom. `localToWorld` is rotation+translation (no\n // scale), so target-local units equal world units for ring math.\n const insetLocal = pxExtent(paint.insetPx ?? 0, view.scale, angleOf(xf));\n // Same `minBandPx` clamp the hit-test applies, so the ring you can see is\n // the ring you can grab.\n const cmd = annulusCommand(s, annulusSemiAxes(s, view, angleOf(xf)), insetLocal, xf, viewT, paint.fill, paint.stroke);\n if (cmd) out.push(cmd);\n return;\n }\n if (paint.kind === 'custom') {\n const ctx: CustomPaintContext = {\n world: worldOf(region, xf, view),\n local: region.shape,\n view,\n state,\n };\n for (const cmd of paint.draw(ctx)) out.push(cmd);\n return;\n }\n}\n\n/** Build a screen-space DrawCommand for an annulus region: the area\n * inside the (contracted) outer ellipse but outside the (expanded)\n * inner rect. Renders as four disjoint petal subpaths — one per rect\n * edge — so the visible fill is true `ellipse \\ rect`. A naive\n * ellipse + rect even-odd path would also fill the rect's corner\n * triangles where they poke past the contracted ellipse. Returns null\n * when the band collapses on both axes. */\nfunction annulusCommand(\n shape: Extract<AffordanceRegion['shape'], { kind: 'annulus' }>,\n semiAxes: { rx: number; ry: number },\n insetLocal: { x: number; y: number },\n xf: TargetTransform,\n viewT: ReturnType<typeof viewToTransform>,\n fill: FillStyle | undefined,\n stroke: Stroke | undefined,\n): DrawCommand | null {\n const rx = semiAxes.rx - insetLocal.x;\n const ry = semiAxes.ry - insetLocal.y;\n if (rx <= 0 || ry <= 0) return null;\n const cx = shape.cx;\n const cy = shape.cy;\n // Expanded inner rect (still in target-local coords).\n const rectHW = shape.innerWidth / 2 + insetLocal.x;\n const rectHH = shape.innerHeight / 2 + insetLocal.y;\n // Each petal exists only when the corresponding rect edge actually\n // intersects the ellipse interior — otherwise the rect already\n // extends past the ellipse on that axis and there's no band to show.\n const haveTopBottom = rectHH < ry;\n const haveLeftRight = rectHW < rx;\n if (!haveTopBottom && !haveLeftRight) return null;\n const xT = haveTopBottom ? rx * Math.sqrt(1 - (rectHH / ry) ** 2) : 0;\n const yR = haveLeftRight ? ry * Math.sqrt(1 - (rectHW / rx) ** 2) : 0;\n\n // Sampling density per petal arc — line segments are visually clean\n // for the rotate-band band thickness and avoid the cubic-Bézier\n // sub-arc bookkeeping. 24 is smooth at typical zooms.\n const SAMPLES = 24;\n const cmds: number[] = [];\n const localPts: { x: number; y: number }[] = [];\n\n function appendPetal(t0: number, t1: number): void {\n cmds.push(PATH_M);\n localPts.push({ x: cx + rx * Math.cos(t0), y: cy + ry * Math.sin(t0) });\n for (let i = 1; i <= SAMPLES; i++) {\n const t = t0 + (t1 - t0) * (i / SAMPLES);\n cmds.push(PATH_L);\n localPts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });\n }\n // PATH_Z closes back to the move-to point along the rect edge — both\n // endpoints share the rect-edge coord by construction, so the\n // closing segment IS the chord.\n cmds.push(PATH_Z);\n }\n\n if (haveTopBottom) {\n // Top petal: y < cy. Arc from right endpoint over t = -π/2 to left.\n appendPetal(\n Math.atan2(-rectHH / ry, xT / rx), // in (-π/2, 0)\n Math.atan2(-rectHH / ry, -xT / rx), // in (-π, -π/2), decreasing through -π/2\n );\n // Bottom petal: y > cy. Arc through t = +π/2.\n appendPetal(\n Math.atan2(rectHH / ry, xT / rx), // in (0, π/2)\n Math.atan2(rectHH / ry, -xT / rx), // in (π/2, π), increasing through π/2\n );\n }\n if (haveLeftRight) {\n // Right petal: x > cx. Arc through t = 0.\n appendPetal(\n Math.atan2(-yR / ry, rectHW / rx), // in (-π/2, 0)\n Math.atan2(yR / ry, rectHW / rx), // in (0, π/2)\n );\n // Left petal: x < cx. Arc through t = ±π. Shift the end angle by\n // -2π so the parametric trace passes through the leftmost point\n // monotonically instead of crossing the right side.\n appendPetal(\n Math.atan2(-yR / ry, -rectHW / rx), // in (-π, -π/2)\n Math.atan2(yR / ry, -rectHW / rx) - 2 * Math.PI, // in (-3π/2, -π), decreasing through -π\n );\n }\n\n const coords = new Float32Array(localPts.length * 2);\n for (let i = 0; i < localPts.length; i++) {\n const w = localToWorld(xf, localPts[i].x, localPts[i].y);\n const [sx, sy] = worldToScreen(w.x, w.y, viewT);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n }\n return {\n kind: 'path',\n path: { kind: 'polygon', commands: new Uint8Array(cmds), coords, fillRule: 'nonzero' },\n ...(fill ? { fill } : {}),\n ...(stroke ? { stroke } : {}),\n };\n}\n\nfunction worldOf(region: AffordanceRegion, xf: TargetTransform, view: View): CustomPaintContext['world'] {\n if (region.shape.kind === 'point') {\n const w = pointRegionAnchor(region.shape, xf, view);\n return { x: w.x, y: w.y };\n }\n if (region.shape.kind === 'annulus') {\n // Outer ellipse bounding box, in world coords. Map the four cardinal\n // extrema through the target transform and AABB the result. (Rotated\n // ellipses are still ellipses; their AABB needs all four points.)\n const s = region.shape;\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n const pts = [\n localToWorld(xf, s.cx + rx, s.cy),\n localToWorld(xf, s.cx - rx, s.cy),\n localToWorld(xf, s.cx, s.cy + ry),\n localToWorld(xf, s.cx, s.cy - ry),\n ];\n const minX = Math.min(...pts.map((p) => p.x));\n const minY = Math.min(...pts.map((p) => p.y));\n const maxX = Math.max(...pts.map((p) => p.x));\n const maxY = Math.max(...pts.map((p) => p.y));\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n }\n // Rect: map the rect's origin and far corner; width/height under rotation\n // describe the AABB of the rotated rect, which is what custom-paint\n // consumers most often want. Affordances needing exact rotated geometry\n // can read `local` + reapply rotation themselves via `view`/`state`.\n const r = region.shape;\n const a = localToWorld(xf, r.x, r.y);\n const b = localToWorld(xf, r.x + r.width, r.y);\n const c = localToWorld(xf, r.x, r.y + r.height);\n const d = localToWorld(xf, r.x + r.width, r.y + r.height);\n const minX = Math.min(a.x, b.x, c.x, d.x);\n const minY = Math.min(a.y, b.y, c.y, d.y);\n const maxX = Math.max(a.x, b.x, c.x, d.x);\n const maxY = Math.max(a.y, b.y, c.y, d.y);\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n// Hit-testing lives in `hitAffordanceRegions.ts` — see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,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCb,IAAO,KAAK,IAAIjC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCZ,IAAO,KAAK,IAAIlC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC,GAClCX,IAAO,KAAK,IAAInC,EAAE,GAAG4E,EAAE,GAAG9B,EAAE,GAAG,EAAE,CAAC;CACxC,OAAO;EAAE,GAAGf;EAAM,GAAGE;EAAM,OAAOC,IAAOH;EAAM,QAAQI,IAAOF;CAAK;AACrE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { HANDLE_BASE_PX as e } from "../core/device/targets.js";
|
|
2
|
+
import { CORNER_ANCHORS as t, cornerPoint as n, fixedCornerOf as r } from "../interactions/actions/resize/cornerHandles.js";
|
|
3
|
+
import { MULTI_RESIZE_TARGET_ID as i } from "../core/selection/selectionTarget.js";
|
|
4
|
+
import { angleOf as a, localToWorld as o, transformOf as s } from "./hitAffordanceRegions.js";
|
|
5
|
+
//#region src/affordances/cornerResize.ts
|
|
6
|
+
var c = "#d4c4a8", l = "#1a130d";
|
|
7
|
+
function u(i = {}) {
|
|
8
|
+
let { handleHitRadius: u = e, handleSize: f = e, fill: p = c, stroke: m = l } = i, h = {
|
|
9
|
+
kind: "square",
|
|
10
|
+
sizePx: f,
|
|
11
|
+
fill: { color: p },
|
|
12
|
+
stroke: {
|
|
13
|
+
paint: { color: m },
|
|
14
|
+
width: 1
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
id: "selection.resize-handles",
|
|
19
|
+
regions(e) {
|
|
20
|
+
let i = d(e);
|
|
21
|
+
if (!i) return [];
|
|
22
|
+
let c = i.bounds, l = s(e, i.id);
|
|
23
|
+
return t.map((e) => {
|
|
24
|
+
let t = n(c, e), s = r(c, e.anchor), d = o(l, s.x, s.y);
|
|
25
|
+
return {
|
|
26
|
+
id: `corner-${e.tag}`,
|
|
27
|
+
targetId: i.id,
|
|
28
|
+
shape: {
|
|
29
|
+
kind: "point",
|
|
30
|
+
x: t.x,
|
|
31
|
+
y: t.y,
|
|
32
|
+
hitRadiusPx: u,
|
|
33
|
+
turned: !0
|
|
34
|
+
},
|
|
35
|
+
paint: h,
|
|
36
|
+
hitKind: e.kind,
|
|
37
|
+
cursor: {
|
|
38
|
+
glyph: "resize",
|
|
39
|
+
angle: (e.anchor.x === e.anchor.y ? Math.PI / 4 : -Math.PI / 4) + a(l),
|
|
40
|
+
fallback: e.anchor.x === e.anchor.y ? "nwse-resize" : "nesw-resize"
|
|
41
|
+
},
|
|
42
|
+
bind: () => ({ initialScratch: {
|
|
43
|
+
anchor: e.anchor,
|
|
44
|
+
targetId: i.id,
|
|
45
|
+
fixedPoint: d
|
|
46
|
+
} })
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function d(e) {
|
|
53
|
+
if (e.multiActive && e.unionBounds) return {
|
|
54
|
+
id: i,
|
|
55
|
+
bounds: e.unionBounds
|
|
56
|
+
};
|
|
57
|
+
if (e.selection.length === 1) {
|
|
58
|
+
let t = e.selection[0], n = e.boundsOf(t);
|
|
59
|
+
return n ? {
|
|
60
|
+
id: t,
|
|
61
|
+
bounds: n
|
|
62
|
+
} : null;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { u as createCornerResizeAffordance };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=cornerResize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cornerResize.js","names":["DEFAULT_FILL","DEFAULT_STROKE","createCornerResizeAffordance","HANDLE_BASE_PX","opts","paint","handleSize","fill","stroke","target","pickRenderTarget","state","b","xf","transformOf","CORNER_ANCHORS","corner","cornerPoint","c","fixedLocal","fixedCornerOf","fixedPoint","localToWorld","handleHitRadius","angleOf","MULTI_RESIZE_TARGET_ID","id"],"sources":["../../src/affordances/cornerResize.ts"],"sourcesContent":["import type { Affordance, AffordanceBinding, AffordanceRegion, CommonAffordanceScratch } from './types';\nimport type { ChromeState, Bounds } from 'core/selection/chromeState';\nimport type { ResizeAnchor } from 'interactions/gestures/types';\nimport { CORNER_ANCHORS, cornerPoint, fixedCornerOf } from 'interactions/actions/resize/cornerHandles';\nimport { MULTI_RESIZE_TARGET_ID } from 'core/selection/selectionTarget';\nimport { angleOf, localToWorld, transformOf } from './hitAffordanceRegions';\nimport { HANDLE_BASE_PX } from 'core/device/targets';\n\n/** Options for `createCornerResizeAffordance` — the size and appearance of\n * the corner handles. */\nexport interface CornerResizeAffordanceOptions {\n /** Hit radius (screen-px) for the corner handles. Default 8. */\n handleHitRadius?: number;\n /** Visual handle size (screen-px). Default 8. */\n handleSize?: number;\n fill?: string;\n stroke?: string;\n}\n\n/** What a corner-resize hit hands to the resize action: which corner stays\n * put, what is being resized, and the world-space pivot to scale from. */\nexport interface CornerResizeScratch extends CommonAffordanceScratch {\n /** Resize anchor identifying the OPPOSITE corner (the one that stays\n * fixed). Matches the kit's existing ResizeAnchor convention. */\n anchor: ResizeAnchor;\n /** Id of the resize target. In multi-mode this is `MULTI_RESIZE_TARGET_ID`. */\n targetId: string;\n /** The fixed corner in **world** coords, with the target's rotation already\n * applied. `resizeAction` scales from this point, and it has no access to\n * the target transform, so the affordance resolves it here. */\n fixedPoint: { x: number; y: number };\n}\n\nconst DEFAULT_FILL = '#d4c4a8';\nconst DEFAULT_STROKE = '#1a130d';\n\n/**\n * @experimental\n * Corner-handle affordance for resizing the active selection (single\n * member in single-mode; the union AABB in multi-mode).\n *\n * Declares four point regions in the target's local frame; the framework\n * applies the target's bounds rotation for both paint and hit-test. The\n * drag channel returned here is a no-op stub that claims — consuming\n * tools (`useResizeTool`) wrap each region's `bind()` to substitute a\n * drag channel that drives `useResize`.\n */\nexport function createCornerResizeAffordance(\n opts: CornerResizeAffordanceOptions = {},\n): Affordance {\n const {\n handleHitRadius = HANDLE_BASE_PX,\n handleSize = HANDLE_BASE_PX,\n fill = DEFAULT_FILL,\n stroke = DEFAULT_STROKE,\n } = opts;\n\n const paint = {\n kind: 'square' as const,\n sizePx: handleSize,\n fill: { color: fill },\n stroke: { paint: { color: stroke }, width: 1 },\n };\n\n return {\n id: 'selection.resize-handles',\n regions(state: ChromeState): readonly AffordanceRegion[] {\n const target = pickRenderTarget(state);\n if (!target) return [];\n const b = target.bounds;\n // The transform the framework applies to these regions. Needed here too,\n // because `fixedPoint` leaves the local frame — it travels to\n // `resizeAction`, which works in world coords.\n const xf = transformOf(state, target.id);\n return CORNER_ANCHORS.map((c) => {\n const corner = cornerPoint(b, c);\n const fixedLocal = fixedCornerOf(b, c.anchor);\n const fixedPoint = localToWorld(xf, fixedLocal.x, fixedLocal.y);\n return {\n id: `corner-${c.tag}`,\n targetId: target.id,\n shape: { kind: 'point' as const, x: corner.x, y: corner.y, hitRadiusPx: handleHitRadius, turned: true },\n paint,\n hitKind: c.kind,\n // Diagonal by fixed-corner parity: a matched-axis anchor (min-min /\n // max-max fixed) means the dragged corner sits on the ↘ diagonal;\n // mixed axes sit on the ↗ diagonal. The glyph is horizontal at angle\n // 0, so the diagonal is a half-quarter-turn either way, plus the\n // target's own rotation. The keyword is the fallback rather than the\n // answer: CSS has four of them, which cannot express a target\n // rotated to anything but a multiple of 45°.\n cursor: {\n glyph: 'resize',\n angle: (c.anchor.x === c.anchor.y ? Math.PI / 4 : -Math.PI / 4) + angleOf(xf),\n fallback: c.anchor.x === c.anchor.y ? 'nwse-resize' : 'nesw-resize',\n },\n bind: (): AffordanceBinding => ({\n initialScratch: {\n anchor: c.anchor,\n targetId: target.id,\n fixedPoint,\n } satisfies CornerResizeScratch,\n }),\n } satisfies AffordanceRegion;\n });\n },\n };\n}\n\nfunction pickRenderTarget(state: ChromeState): { id: string; bounds: Bounds } | null {\n if (state.multiActive && state.unionBounds) {\n return { id: MULTI_RESIZE_TARGET_ID, bounds: state.unionBounds };\n }\n if (state.selection.length === 1) {\n const id = state.selection[0];\n const b = state.boundsOf(id);\n return b ? { id, bounds: b } : null;\n }\n return null;\n}\n"],"mappings":";;;;;AAiCA,IAAMA,IAAe,WACfC,IAAiB;AAavB,SAAgBC,EACd,IAAsC,CAAC,GAC3B;CACZ,IAAM,EACJ,qBAAkBC,GAClB,gBAAaA,GACb,UAAOH,GACP,YAASC,MACPG,GAEEC,IAAQ;EACZ,MAAM;EACN,QAAQC;EACR,MAAM,EAAE,OAAOC,EAAK;EACpB,QAAQ;GAAE,OAAO,EAAE,OAAOC,EAAO;GAAG,OAAO;EAAE;CAC/C;CAEA,OAAO;EACL,IAAI;EACJ,QAAQ,GAAiD;GACvD,IAAMC,IAASC,EAAiBC,CAAK;GACrC,IAAI,CAACF,GAAQ,OAAO,CAAC;GACrB,IAAMG,IAAIH,EAAO,QAIXI,IAAKC,EAAYH,GAAOF,EAAO,EAAE;GACvC,OAAOM,EAAe,KAAK,MAAM;IAC/B,IAAMC,IAASC,EAAYL,GAAGM,CAAC,GACzBC,IAAaC,EAAcR,GAAGM,EAAE,MAAM,GACtCG,IAAaC,EAAaT,GAAIM,EAAW,GAAGA,EAAW,CAAC;IAC9D,OAAO;KACL,IAAI,UAAUD,EAAE;KAChB,UAAUT,EAAO;KACjB,OAAO;MAAE,MAAM;MAAkB,GAAGO,EAAO;MAAG,GAAGA,EAAO;MAAG,aAAaO;MAAiB,QAAQ;KAAK;KACtG;KACA,SAASL,EAAE;KAQX,QAAQ;MACN,OAAO;MACP,QAAQA,EAAE,OAAO,MAAMA,EAAE,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,KAAK,KAAKM,EAAQX,CAAE;MAC5E,UAAUK,EAAE,OAAO,MAAMA,EAAE,OAAO,IAAI,gBAAgB;KACxD;KACA,aAAgC,EAC9B,gBAAgB;MACd,QAAQA,EAAE;MACV,UAAUT,EAAO;MACjB;KACF,EACF;IACF;GACF,CAAC;EACH;CACF;AACF;AAEA,SAASC,EAAiB,GAA2D;CACnF,IAAIC,EAAM,eAAeA,EAAM,aAC7B,OAAO;EAAE,IAAIc;EAAwB,QAAQd,EAAM;CAAY;CAEjE,IAAIA,EAAM,UAAU,WAAW,GAAG;EAChC,IAAMe,IAAKf,EAAM,UAAU,IACrBC,IAAID,EAAM,SAASe,CAAE;EAC3B,OAAOd,IAAI;GAAE;GAAI,QAAQA;EAAE,IAAI;CACjC;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { poseRotationOf as e } from "../core/geometry/poseRotation.js";
|
|
2
|
+
import { pxExtent as t, scaleDelta as n, screenAngleOf as r, standoff as i } from "../core/viewport/pxExtent.js";
|
|
3
|
+
//#region src/affordances/hitAffordanceRegions.ts
|
|
4
|
+
function a(e, t, n, r, i, a) {
|
|
5
|
+
for (let s = e.length - 1; s >= 0; s--) {
|
|
6
|
+
let l = e[s];
|
|
7
|
+
if (a && !a(l.id)) continue;
|
|
8
|
+
let u = l.regions(r), d = null;
|
|
9
|
+
for (let e = 0; e < u.length; e++) {
|
|
10
|
+
let a = u[e], s = c(r, a.targetId);
|
|
11
|
+
if (!g(a, t, n, s, i)) continue;
|
|
12
|
+
let l = o(a, t, n, s, i);
|
|
13
|
+
(d === null || l <= d.d2) && (d = {
|
|
14
|
+
region: a,
|
|
15
|
+
d2: l
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (d) return {
|
|
19
|
+
affordanceId: l.id,
|
|
20
|
+
regionId: d.region.id,
|
|
21
|
+
region: d.region,
|
|
22
|
+
binding: d.region.bind()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function o(e, t, n, r, i) {
|
|
28
|
+
let a = e.shape, o = a.kind === "point" ? m(a, r, i) : a.kind === "annulus" ? u(r, a.cx, a.cy) : u(r, a.x + a.width / 2, a.y + a.height / 2), s = o.x - t, c = o.y - n;
|
|
29
|
+
return s * s + c * c;
|
|
30
|
+
}
|
|
31
|
+
var s = {
|
|
32
|
+
cx: 0,
|
|
33
|
+
cy: 0,
|
|
34
|
+
cos: 1,
|
|
35
|
+
sin: 0,
|
|
36
|
+
identity: !0
|
|
37
|
+
};
|
|
38
|
+
function c(t, n) {
|
|
39
|
+
if (n === null) return s;
|
|
40
|
+
let r = t.boundsOf(n);
|
|
41
|
+
if (!r) return s;
|
|
42
|
+
let i = e(r);
|
|
43
|
+
return i ? {
|
|
44
|
+
cx: i.cx,
|
|
45
|
+
cy: i.cy,
|
|
46
|
+
cos: Math.cos(i.rotation),
|
|
47
|
+
sin: Math.sin(i.rotation),
|
|
48
|
+
identity: !1
|
|
49
|
+
} : s;
|
|
50
|
+
}
|
|
51
|
+
function l(e) {
|
|
52
|
+
return e.identity ? 0 : Math.atan2(e.sin, e.cos);
|
|
53
|
+
}
|
|
54
|
+
function u(e, t, n) {
|
|
55
|
+
if (e.identity) return {
|
|
56
|
+
x: t,
|
|
57
|
+
y: n
|
|
58
|
+
};
|
|
59
|
+
let r = t - e.cx, i = n - e.cy;
|
|
60
|
+
return {
|
|
61
|
+
x: e.cx + e.cos * r - e.sin * i,
|
|
62
|
+
y: e.cy + e.sin * r + e.cos * i
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function d(e, t, n) {
|
|
66
|
+
if (e.identity) return {
|
|
67
|
+
x: t,
|
|
68
|
+
y: n
|
|
69
|
+
};
|
|
70
|
+
let r = t - e.cx, i = n - e.cy;
|
|
71
|
+
return {
|
|
72
|
+
x: e.cx + e.cos * r + e.sin * i,
|
|
73
|
+
y: e.cy - e.sin * r + e.cos * i
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function f(e, t, n) {
|
|
77
|
+
let i = m(e, t, n), a = e.turned ? r(l(t), n.scale) : 0;
|
|
78
|
+
return {
|
|
79
|
+
x: i.x,
|
|
80
|
+
y: i.y,
|
|
81
|
+
angle: a,
|
|
82
|
+
half: e.hitRadiusPx
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function p(e, t, n, r) {
|
|
86
|
+
let i = f(e, t, n), [a, o] = r(i.x, i.y), s = Math.cos(i.angle) * i.half, c = Math.sin(i.angle) * i.half;
|
|
87
|
+
return [
|
|
88
|
+
[-1, -1],
|
|
89
|
+
[1, -1],
|
|
90
|
+
[1, 1],
|
|
91
|
+
[-1, 1]
|
|
92
|
+
].map(([e, t]) => ({
|
|
93
|
+
x: a + s * e - c * t,
|
|
94
|
+
y: o + c * e + s * t
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
function m(e, t, n) {
|
|
98
|
+
let r = u(t, e.x, e.y);
|
|
99
|
+
if (!e.standoff) return r;
|
|
100
|
+
let a = e.standoff.normal, o = t.identity ? a : {
|
|
101
|
+
x: t.cos * a.x - t.sin * a.y,
|
|
102
|
+
y: t.sin * a.x + t.cos * a.y
|
|
103
|
+
};
|
|
104
|
+
return i(r, o, e.standoff.px, n.scale);
|
|
105
|
+
}
|
|
106
|
+
function h(e, n, r = 0) {
|
|
107
|
+
let i = e.minBandPx ?? 0;
|
|
108
|
+
if (i === 0) return {
|
|
109
|
+
rx: e.rx,
|
|
110
|
+
ry: e.ry
|
|
111
|
+
};
|
|
112
|
+
let a = t(i, n.scale, r);
|
|
113
|
+
return {
|
|
114
|
+
rx: Math.max(e.rx, e.innerWidth / 2 + a.x),
|
|
115
|
+
ry: Math.max(e.ry, e.innerHeight / 2 + a.y)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function g(e, t, r, i, a) {
|
|
119
|
+
let o = d(i, t, r);
|
|
120
|
+
if (e.shape.kind === "point") {
|
|
121
|
+
let o = f(e.shape, i, a), s = n(t - o.x, r - o.y, a.scale), c = Math.cos(o.angle), l = Math.sin(o.angle), u = c * s.x + l * s.y, d = -l * s.x + c * s.y;
|
|
122
|
+
return Math.abs(u) <= o.half && Math.abs(d) <= o.half;
|
|
123
|
+
}
|
|
124
|
+
if (e.shape.kind === "annulus") {
|
|
125
|
+
let t = e.shape;
|
|
126
|
+
if (o.x >= t.innerX && o.x <= t.innerX + t.innerWidth && o.y >= t.innerY && o.y <= t.innerY + t.innerHeight) return !1;
|
|
127
|
+
let { rx: n, ry: r } = h(t, a, l(i));
|
|
128
|
+
if (n <= 0 || r <= 0) return !1;
|
|
129
|
+
let s = (o.x - t.cx) / n, c = (o.y - t.cy) / r;
|
|
130
|
+
return s * s + c * c <= 1;
|
|
131
|
+
}
|
|
132
|
+
let s = e.shape;
|
|
133
|
+
return o.x >= s.x && o.x <= s.x + s.width && o.y >= s.y && o.y <= s.y + s.height;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { l as angleOf, h as annulusSemiAxes, a as hitAffordanceRegions, u as localToWorld, m as pointRegionAnchor, f as pointRegionFrame, p as pointRegionScreenQuad, c as transformOf };
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=hitAffordanceRegions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitAffordanceRegions.js","names":["hitAffordanceRegions","i","affordances","a","isVisible","regions","state","best","j","region","xf","transformOf","hitRegion","wx","wy","view","d2","regionDistance2","s","w","pointRegionAnchor","localToWorld","dx","dy","IDENTITY_XF","targetId","b","r","poseRotationOf","angleOf","lx","ly","worldToLocal","pointRegionFrame","shape","angle","screenAngleOf","pointRegionScreenQuad","f","cx","cy","toScreen","c","sn","u","v","n","wn","standoff","annulusSemiAxes","bandPx","band","pxExtent","rotation","local","d","scaleDelta","rx","ry","ex","ey"],"sources":["../../src/affordances/hitAffordanceRegions.ts"],"sourcesContent":["/**\n * The one affordance hit-test walk.\n *\n * The kit used to hit-test selection chrome two ways: this region walk\n * (reached through `composeAffordanceLayer`'s `RenderLayer.hitTest`) and a\n * hand-written classifier in `canvas/affordanceAt.ts` that re-derived corner\n * positions, the rotate ring, and anchor points from `ChromeState` itself.\n * Both read the same state and answered the same question, so the geometry\n * lived twice and could disagree — and only the hand-written side ran for the\n * kit's own chrome, which is why `AffordanceRegion.cursor` was declared, set,\n * and never consumed.\n *\n * Now there is one walk. `composeAffordanceLayer.hitTest` delegates here, and\n * so does `buildAffordanceAt`, so an affordance's `regions()` is the single\n * source of truth for where its chrome is and what a press on it means.\n */\n\nimport type { View } from 'core/viewport/view';\nimport { pxExtent, scaleDelta, screenAngleOf, standoff } from 'core/viewport/pxExtent';\nimport type { ChromeState, Bounds } from 'core/selection/chromeState';\nimport { poseRotationOf } from 'core/geometry/poseRotation';\nimport type { Affordance, AffordanceBinding, AffordanceRegion } from './types';\n\n/** What the walk found: the region, plus the ids needed to describe it. */\nexport interface AffordanceRegionHit {\n /** `Affordance.id` — also the chrome-caps visibility id. */\n affordanceId: string;\n /** `AffordanceRegion.id`. */\n regionId: string;\n /** The region itself, so callers can read `hitKind` / `cursor`. */\n region: AffordanceRegion;\n /** Result of the region's `bind()`, called exactly once. */\n binding: AffordanceBinding;\n}\n\n/**\n * Walk affordances for a world-space hit, topmost first.\n *\n * **Across affordances**: order mirrors paint. Affordances are drawn first →\n * last (bottom → top), so the walk runs last → first and stops at the first\n * one that claims the point. Layering wins outright — a nearer region on a\n * lower affordance does not beat a farther one on top of it.\n *\n * **Within an affordance**: the *nearest* hit region wins, ties going to the\n * later-declared one. Both hit-testers this replaced took the first region\n * they found instead, in opposite orders, which is only invisible while\n * regions don't overlap. They do: the four corner handles of a selection\n * smaller than the hit radius all contain the same click, and \"first in the\n * table\" silently answered top-left (or bottom-right) no matter which handle\n * the pointer was actually on.\n *\n * `isVisible` (when supplied) gates by the same chrome id used at paint time,\n * so chrome that isn't drawn can't be hit either.\n */\nexport function hitAffordanceRegions(\n affordances: readonly Affordance[],\n wx: number,\n wy: number,\n state: ChromeState,\n view: View,\n isVisible?: (id: string) => boolean,\n): AffordanceRegionHit | null {\n for (let i = affordances.length - 1; i >= 0; i--) {\n const a = affordances[i];\n if (isVisible && !isVisible(a.id)) continue;\n const regions = a.regions(state);\n let best: { region: AffordanceRegion; d2: number } | null = null;\n for (let j = 0; j < regions.length; j++) {\n const region = regions[j];\n const xf = transformOf(state, region.targetId);\n if (!hitRegion(region, wx, wy, xf, view)) continue;\n const d2 = regionDistance2(region, wx, wy, xf, view);\n // `<=` so a later-declared region wins an exact tie, preserving the\n // \"later is on top\" reading of declaration order.\n if (best === null || d2 <= best.d2) best = { region, d2 };\n }\n if (best) {\n return {\n affordanceId: a.id,\n regionId: best.region.id,\n region: best.region,\n binding: best.region.bind(),\n };\n }\n }\n return null;\n}\n\n/** Squared world distance from the point to a region's representative center,\n * used only to rank regions that all already contain the point. */\nfunction regionDistance2(\n region: AffordanceRegion,\n wx: number,\n wy: number,\n xf: TargetTransform,\n view: View,\n): number {\n const s = region.shape;\n const w = s.kind === 'point'\n ? pointRegionAnchor(s, xf, view)\n : s.kind === 'annulus'\n ? localToWorld(xf, s.cx, s.cy)\n : localToWorld(xf, s.x + s.width / 2, s.y + s.height / 2);\n const dx = w.x - wx;\n const dy = w.y - wy;\n return dx * dx + dy * dy;\n}\n\n// ─── Transform helpers ──────────────────────────────────────────────────────\n\n/** Local↔world transform for an affordance target. Translation is the AABB\n * origin; rotation is around the AABB center. `identity` short-circuits the\n * math when the target isn't rotated. */\nexport interface TargetTransform {\n /** Rotation pivot (AABB center) in world coords. */\n cx: number;\n cy: number;\n /** cos(rotation) — 1 when identity. */\n cos: number;\n /** sin(rotation) — 0 when identity. */\n sin: number;\n identity: boolean;\n}\n\nconst IDENTITY_XF: TargetTransform = { cx: 0, cy: 0, cos: 1, sin: 0, identity: true };\n\nexport function transformOf(state: ChromeState, targetId: string | null): TargetTransform {\n if (targetId === null) return IDENTITY_XF;\n const b: Bounds | null = state.boundsOf(targetId);\n if (!b) return IDENTITY_XF;\n // Pivot + angle come from the kit's one rotation convention.\n const r = poseRotationOf(b);\n if (!r) return IDENTITY_XF;\n return {\n cx: r.cx,\n cy: r.cy,\n cos: Math.cos(r.rotation),\n sin: Math.sin(r.rotation),\n identity: false,\n };\n}\n\n/** A target transform's rotation in radians, for cursors baked at an angle. */\nexport function angleOf(xf: TargetTransform): number {\n return xf.identity ? 0 : Math.atan2(xf.sin, xf.cos);\n}\n\n/** local point → world point. */\nexport function localToWorld(xf: TargetTransform, lx: number, ly: number): { x: number; y: number } {\n if (xf.identity) return { x: lx, y: ly };\n const dx = lx - xf.cx;\n const dy = ly - xf.cy;\n return {\n x: xf.cx + xf.cos * dx - xf.sin * dy,\n y: xf.cy + xf.sin * dx + xf.cos * dy,\n };\n}\n\n/** world point → local point. */\nfunction worldToLocal(xf: TargetTransform, wx: number, wy: number): { x: number; y: number } {\n if (xf.identity) return { x: wx, y: wy };\n const dx = wx - xf.cx;\n const dy = wy - xf.cy;\n // Inverse rotation: cos stays, sin negates.\n return {\n x: xf.cx + xf.cos * dx + xf.sin * dy,\n y: xf.cy - xf.sin * dx + xf.cos * dy,\n };\n}\n\n// ─── Shape resolution ───────────────────────────────────────────────────────\n\ntype PointShape = Extract<AffordanceRegion['shape'], { kind: 'point' }>;\n\n/** Where a point region's hit square sits: its center in world coords, its\n * turn on screen, and its screen half-extent. Hit-test, paint, the debug\n * hitbox and the slops overlay all read it from here. */\nexport function pointRegionFrame(\n shape: PointShape,\n xf: TargetTransform,\n view: View,\n): { x: number; y: number; angle: number; half: number } {\n const a = pointRegionAnchor(shape, xf, view);\n const angle = shape.turned ? screenAngleOf(angleOf(xf), view.scale) : 0;\n return { x: a.x, y: a.y, angle, half: shape.hitRadiusPx };\n}\n\n/** A point region's hit square as four screen-space corners, relative to its\n * world center carried to the screen by `toScreen`. */\nexport function pointRegionScreenQuad(\n shape: PointShape,\n xf: TargetTransform,\n view: View,\n toScreen: (x: number, y: number) => [number, number],\n): { x: number; y: number }[] {\n const f = pointRegionFrame(shape, xf, view);\n const [cx, cy] = toScreen(f.x, f.y);\n const c = Math.cos(f.angle) * f.half, sn = Math.sin(f.angle) * f.half;\n return [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([u, v]) => ({\n x: cx + c * u - sn * v,\n y: cy + sn * u + c * v,\n }));\n}\n\n/** A point region's anchor in world coords, its `standoff` applied. */\nexport function pointRegionAnchor(\n shape: PointShape,\n xf: TargetTransform,\n view: View,\n): { x: number; y: number } {\n const a = localToWorld(xf, shape.x, shape.y);\n if (!shape.standoff) return a;\n const n = shape.standoff.normal;\n const wn = xf.identity\n ? n\n : { x: xf.cos * n.x - xf.sin * n.y, y: xf.sin * n.x + xf.cos * n.y };\n return standoff(a, wn, shape.standoff.px, view.scale);\n}\n\n/**\n * An annulus region's effective outer semi-axes, with `minBandPx` applied.\n *\n * The affordance declares the natural ellipse (typically the smallest one\n * containing the inner rect) plus a screen-space floor on band thickness;\n * this is where the floor becomes world units, because this is where the view\n * is known. Paint calls it too, so the visible ring and the hoverable ring\n * are the same ring.\n */\nexport function annulusSemiAxes(\n shape: Extract<AffordanceRegion['shape'], { kind: 'annulus' }>,\n view: View,\n /** The target's rotation, which decides what a screen pixel is along each\n * of its axes. */\n rotation = 0,\n): { rx: number; ry: number } {\n const bandPx = shape.minBandPx ?? 0;\n if (bandPx === 0) return { rx: shape.rx, ry: shape.ry };\n const band = pxExtent(bandPx, view.scale, rotation);\n return {\n rx: Math.max(shape.rx, shape.innerWidth / 2 + band.x),\n ry: Math.max(shape.ry, shape.innerHeight / 2 + band.y),\n };\n}\n\n// ─── Per-shape hit-test ─────────────────────────────────────────────────────\n\nfunction hitRegion(\n region: AffordanceRegion,\n wx: number,\n wy: number,\n xf: TargetTransform,\n view: View,\n): boolean {\n const local = worldToLocal(xf, wx, wy);\n if (region.shape.kind === 'point') {\n // Square hit, not circular: the handle a `point` region paints is a\n // square, and the hit zone should match what the user sees. (The old\n // hand-written classifier used a circle here, which made the corners of\n // an 8px handle unclickable.)\n //\n // Compared in screen space, where that square is axis-aligned. Testing it\n // in the target's local frame instead would tilt it under a rotated\n // target and stretch it under non-uniform zoom.\n const f = pointRegionFrame(region.shape, xf, view);\n const d = scaleDelta(wx - f.x, wy - f.y, view.scale);\n const c = Math.cos(f.angle), sn = Math.sin(f.angle);\n const u = c * d.x + sn * d.y, v = -sn * d.x + c * d.y;\n return Math.abs(u) <= f.half && Math.abs(v) <= f.half;\n }\n if (region.shape.kind === 'annulus') {\n const s = region.shape;\n // Outside the inner-rect cutout?\n const insideInner =\n local.x >= s.innerX && local.x <= s.innerX + s.innerWidth &&\n local.y >= s.innerY && local.y <= s.innerY + s.innerHeight;\n if (insideInner) return false;\n // Inside the outer ellipse? `((x-cx)/rx)² + ((y-cy)/ry)² ≤ 1`.\n const { rx, ry } = annulusSemiAxes(s, view, angleOf(xf));\n if (rx <= 0 || ry <= 0) return false;\n const ex = (local.x - s.cx) / rx;\n const ey = (local.y - s.cy) / ry;\n return ex * ex + ey * ey <= 1;\n }\n // rect: axis-aligned in local frame.\n const r = region.shape;\n return local.x >= r.x && local.x <= r.x + r.width\n && local.y >= r.y && local.y <= r.y + r.height;\n}\n"],"mappings":";;;AAsDA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GAC4B;CAC5B,KAAK,IAAIC,IAAIC,EAAY,SAAS,GAAGD,KAAK,GAAG,KAAK;EAChD,IAAME,IAAID,EAAYD;EACtB,IAAIG,KAAa,CAACA,EAAUD,EAAE,EAAE,GAAG;EACnC,IAAME,IAAUF,EAAE,QAAQG,CAAK,GAC3BC,IAAwD;EAC5D,KAAK,IAAIC,IAAI,GAAGA,IAAIH,EAAQ,QAAQ,KAAK;GACvC,IAAMI,IAASJ,EAAQG,IACjBE,IAAKC,EAAYL,GAAOG,EAAO,QAAQ;GAC7C,IAAI,CAACG,EAAUH,GAAQI,GAAIC,GAAIJ,GAAIK,CAAI,GAAG;GAC1C,IAAMC,IAAKC,EAAgBR,GAAQI,GAAIC,GAAIJ,GAAIK,CAAI;GAGnD,CAAIR,MAAS,QAAQS,KAAMT,EAAK,QAAI,IAAO;IAAE;IAAQ;GAAG;EAC1D;EACA,IAAIA,GACF,OAAO;GACL,cAAcJ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