@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/dist/chunk-L5YNZYEG.js
DELETED
|
@@ -1,648 +0,0 @@
|
|
|
1
|
-
import { forEachSegment, PATH_Z, PATH_Q, elevateQuadraticToCubic, cubicBounds, PATH_C, PATH_L, PATH_M, DEFAULT_FLATTEN_TOLERANCE, flattenQuadratic, flattenCubic, pointSegmentDist2, transformCoords, pathCommandCoordCount, boxToBox } from '@weasel-js/geom';
|
|
2
|
-
export { DEFAULT_FLATTEN_TOLERANCE, PATH_C, PATH_CMD_LENGTHS, PATH_L, PATH_M, PATH_Q, PATH_Z, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, pathCommandCoordCount } from '@weasel-js/geom';
|
|
3
|
-
|
|
4
|
-
// src/core/geometry/path.ts
|
|
5
|
-
function boundsOfPath(path) {
|
|
6
|
-
if (path.kind === "rect") return path;
|
|
7
|
-
const { commands, coords } = path;
|
|
8
|
-
if (commands.length === 0) {
|
|
9
|
-
return { kind: "rect", x: 0, y: 0, width: 0, height: 0 };
|
|
10
|
-
}
|
|
11
|
-
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
12
|
-
let seen = false;
|
|
13
|
-
const include = (x, y) => {
|
|
14
|
-
if (x < minX) minX = x;
|
|
15
|
-
if (x > maxX) maxX = x;
|
|
16
|
-
if (y < minY) minY = y;
|
|
17
|
-
if (y > maxY) maxY = y;
|
|
18
|
-
seen = true;
|
|
19
|
-
};
|
|
20
|
-
forEachSegment(commands, coords, (cmd, ci, px, py) => {
|
|
21
|
-
switch (cmd) {
|
|
22
|
-
case PATH_M:
|
|
23
|
-
case PATH_L: {
|
|
24
|
-
include(coords[ci], coords[ci + 1]);
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
case PATH_C: {
|
|
28
|
-
const [bMinX, bMinY, bMaxX, bMaxY] = cubicBounds(
|
|
29
|
-
px,
|
|
30
|
-
py,
|
|
31
|
-
coords[ci],
|
|
32
|
-
coords[ci + 1],
|
|
33
|
-
coords[ci + 2],
|
|
34
|
-
coords[ci + 3],
|
|
35
|
-
coords[ci + 4],
|
|
36
|
-
coords[ci + 5]
|
|
37
|
-
);
|
|
38
|
-
include(bMinX, bMinY);
|
|
39
|
-
include(bMaxX, bMaxY);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case PATH_Q: {
|
|
43
|
-
const qx2 = coords[ci + 2], qy2 = coords[ci + 3];
|
|
44
|
-
const [c1x, c1y, c2x, c2y] = elevateQuadraticToCubic(px, py, coords[ci], coords[ci + 1], qx2, qy2);
|
|
45
|
-
const [bMinX, bMinY, bMaxX, bMaxY] = cubicBounds(px, py, c1x, c1y, c2x, c2y, qx2, qy2);
|
|
46
|
-
include(bMinX, bMinY);
|
|
47
|
-
include(bMaxX, bMaxY);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case PATH_Z:
|
|
51
|
-
break;
|
|
52
|
-
default:
|
|
53
|
-
throw new Error(`boundsOfPath: unknown command ${cmd}`);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
if (!seen) return { kind: "rect", x: 0, y: 0, width: 0, height: 0 };
|
|
57
|
-
return { kind: "rect", x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
58
|
-
}
|
|
59
|
-
function pointInPath(path, x, y, opts = {}) {
|
|
60
|
-
if (path.kind === "rect") {
|
|
61
|
-
return x >= path.x && x <= path.x + path.width && y >= path.y && y <= path.y + path.height;
|
|
62
|
-
}
|
|
63
|
-
return pointInPolygonPath(path, x, y, opts.tolerance ?? DEFAULT_FLATTEN_TOLERANCE);
|
|
64
|
-
}
|
|
65
|
-
function pointInPolygonPath(path, x, y, tolerance) {
|
|
66
|
-
const { commands, coords, fillRule } = path;
|
|
67
|
-
if (commands.length === 0) return false;
|
|
68
|
-
let crossings = 0;
|
|
69
|
-
let winding = 0;
|
|
70
|
-
let subStartX = 0, subStartY = 0;
|
|
71
|
-
let subVerts = [];
|
|
72
|
-
let subOpen = false;
|
|
73
|
-
const flushSubpath = (closed) => {
|
|
74
|
-
if (closed && subVerts.length >= 4) {
|
|
75
|
-
subVerts.push(subStartX, subStartY);
|
|
76
|
-
for (let i = 0; i < subVerts.length - 2; i += 2) {
|
|
77
|
-
const ax = subVerts[i], ay = subVerts[i + 1];
|
|
78
|
-
const bx = subVerts[i + 2], by = subVerts[i + 3];
|
|
79
|
-
if (segmentCrossesRayRight(x, y, ax, ay, bx, by)) {
|
|
80
|
-
crossings++;
|
|
81
|
-
if (ay <= y && by > y) winding++;
|
|
82
|
-
else if (by <= y && ay > y) winding--;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
subVerts = [];
|
|
87
|
-
subOpen = false;
|
|
88
|
-
};
|
|
89
|
-
forEachSegment(commands, coords, (cmd, ci, curX, curY) => {
|
|
90
|
-
switch (cmd) {
|
|
91
|
-
case PATH_M: {
|
|
92
|
-
if (subOpen) flushSubpath(false);
|
|
93
|
-
subStartX = coords[ci];
|
|
94
|
-
subStartY = coords[ci + 1];
|
|
95
|
-
subVerts.push(subStartX, subStartY);
|
|
96
|
-
subOpen = true;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case PATH_L:
|
|
100
|
-
subVerts.push(coords[ci], coords[ci + 1]);
|
|
101
|
-
break;
|
|
102
|
-
case PATH_C:
|
|
103
|
-
flattenCubic(
|
|
104
|
-
curX,
|
|
105
|
-
curY,
|
|
106
|
-
coords[ci],
|
|
107
|
-
coords[ci + 1],
|
|
108
|
-
coords[ci + 2],
|
|
109
|
-
coords[ci + 3],
|
|
110
|
-
coords[ci + 4],
|
|
111
|
-
coords[ci + 5],
|
|
112
|
-
tolerance,
|
|
113
|
-
subVerts
|
|
114
|
-
);
|
|
115
|
-
break;
|
|
116
|
-
case PATH_Q:
|
|
117
|
-
flattenQuadratic(
|
|
118
|
-
curX,
|
|
119
|
-
curY,
|
|
120
|
-
coords[ci],
|
|
121
|
-
coords[ci + 1],
|
|
122
|
-
coords[ci + 2],
|
|
123
|
-
coords[ci + 3],
|
|
124
|
-
tolerance,
|
|
125
|
-
subVerts
|
|
126
|
-
);
|
|
127
|
-
break;
|
|
128
|
-
case PATH_Z:
|
|
129
|
-
flushSubpath(true);
|
|
130
|
-
break;
|
|
131
|
-
default:
|
|
132
|
-
throw new Error(`pointInPath: unknown command ${cmd}`);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
if (subOpen) flushSubpath(false);
|
|
136
|
-
return fillRule === "evenodd" ? (crossings & 1) === 1 : winding !== 0;
|
|
137
|
-
}
|
|
138
|
-
function segmentCrossesRayRight(x, y, ax, ay, bx, by) {
|
|
139
|
-
if (ay > y === by > y) return false;
|
|
140
|
-
const xCross = ax + (y - ay) / (by - ay) * (bx - ax);
|
|
141
|
-
return x < xCross;
|
|
142
|
-
}
|
|
143
|
-
function strokeHitTest(path, x, y, threshold, opts = {}) {
|
|
144
|
-
const t2 = threshold * threshold;
|
|
145
|
-
if (path.kind === "rect") {
|
|
146
|
-
const { x: rx, y: ry, width: w, height: h } = path;
|
|
147
|
-
return pointSegmentDist2(x, y, rx, ry, rx + w, ry) <= t2 || pointSegmentDist2(x, y, rx + w, ry, rx + w, ry + h) <= t2 || pointSegmentDist2(x, y, rx + w, ry + h, rx, ry + h) <= t2 || pointSegmentDist2(x, y, rx, ry + h, rx, ry) <= t2;
|
|
148
|
-
}
|
|
149
|
-
return polylineWithinThreshold(path, x, y, t2, opts.tolerance ?? DEFAULT_FLATTEN_TOLERANCE);
|
|
150
|
-
}
|
|
151
|
-
function polylineWithinThreshold(path, px, py, t2, tolerance) {
|
|
152
|
-
const { commands, coords } = path;
|
|
153
|
-
if (commands.length === 0) return false;
|
|
154
|
-
let subStartX = 0, subStartY = 0;
|
|
155
|
-
let subVerts = [];
|
|
156
|
-
let subOpen = false;
|
|
157
|
-
const checkSegments = (closed) => {
|
|
158
|
-
if (closed && subVerts.length >= 4) subVerts.push(subStartX, subStartY);
|
|
159
|
-
for (let i = 0; i < subVerts.length - 2; i += 2) {
|
|
160
|
-
if (pointSegmentDist2(px, py, subVerts[i], subVerts[i + 1], subVerts[i + 2], subVerts[i + 3]) <= t2) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
165
|
-
};
|
|
166
|
-
let hit = false;
|
|
167
|
-
forEachSegment(commands, coords, (cmd, ci, curX, curY) => {
|
|
168
|
-
switch (cmd) {
|
|
169
|
-
case PATH_M: {
|
|
170
|
-
if (subOpen) {
|
|
171
|
-
if (checkSegments(false)) {
|
|
172
|
-
hit = true;
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
subVerts = [];
|
|
176
|
-
}
|
|
177
|
-
subStartX = coords[ci];
|
|
178
|
-
subStartY = coords[ci + 1];
|
|
179
|
-
subVerts.push(subStartX, subStartY);
|
|
180
|
-
subOpen = true;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
case PATH_L:
|
|
184
|
-
subVerts.push(coords[ci], coords[ci + 1]);
|
|
185
|
-
break;
|
|
186
|
-
case PATH_C:
|
|
187
|
-
flattenCubic(
|
|
188
|
-
curX,
|
|
189
|
-
curY,
|
|
190
|
-
coords[ci],
|
|
191
|
-
coords[ci + 1],
|
|
192
|
-
coords[ci + 2],
|
|
193
|
-
coords[ci + 3],
|
|
194
|
-
coords[ci + 4],
|
|
195
|
-
coords[ci + 5],
|
|
196
|
-
tolerance,
|
|
197
|
-
subVerts
|
|
198
|
-
);
|
|
199
|
-
break;
|
|
200
|
-
case PATH_Q:
|
|
201
|
-
flattenQuadratic(
|
|
202
|
-
curX,
|
|
203
|
-
curY,
|
|
204
|
-
coords[ci],
|
|
205
|
-
coords[ci + 1],
|
|
206
|
-
coords[ci + 2],
|
|
207
|
-
coords[ci + 3],
|
|
208
|
-
tolerance,
|
|
209
|
-
subVerts
|
|
210
|
-
);
|
|
211
|
-
break;
|
|
212
|
-
case PATH_Z:
|
|
213
|
-
if (checkSegments(true)) {
|
|
214
|
-
hit = true;
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
subVerts = [];
|
|
218
|
-
subOpen = false;
|
|
219
|
-
break;
|
|
220
|
-
default:
|
|
221
|
-
throw new Error(`strokeHitTest: unknown command ${cmd}`);
|
|
222
|
-
}
|
|
223
|
-
return true;
|
|
224
|
-
});
|
|
225
|
-
if (hit) return true;
|
|
226
|
-
if (subOpen && checkSegments(false)) return true;
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// src/features/paths/builder.ts
|
|
231
|
-
var PathBuilder = class _PathBuilder {
|
|
232
|
-
cmds = [];
|
|
233
|
-
xs = [];
|
|
234
|
-
fillRule = "nonzero";
|
|
235
|
-
/** Seed a builder with an existing `PolygonPath`. Useful for extending
|
|
236
|
-
* an in-flight path with another segment (e.g. appending a cubic to
|
|
237
|
-
* the end of a curve in response to a user action) without hand-
|
|
238
|
-
* reaching into the `commands` / `coords` typed arrays.
|
|
239
|
-
*
|
|
240
|
-
* ```ts
|
|
241
|
-
* const next = PathBuilder.fromPath(current).curveTo(...).build();
|
|
242
|
-
* ```
|
|
243
|
-
*/
|
|
244
|
-
static fromPath(path) {
|
|
245
|
-
const b = new _PathBuilder();
|
|
246
|
-
b.cmds = Array.from(path.commands);
|
|
247
|
-
b.xs = Array.from(path.coords);
|
|
248
|
-
b.fillRule = path.fillRule;
|
|
249
|
-
return b;
|
|
250
|
-
}
|
|
251
|
-
setFillRule(rule) {
|
|
252
|
-
this.fillRule = rule;
|
|
253
|
-
return this;
|
|
254
|
-
}
|
|
255
|
-
moveTo(x, y) {
|
|
256
|
-
this.cmds.push(PATH_M);
|
|
257
|
-
this.xs.push(x, y);
|
|
258
|
-
return this;
|
|
259
|
-
}
|
|
260
|
-
lineTo(x, y) {
|
|
261
|
-
this.cmds.push(PATH_L);
|
|
262
|
-
this.xs.push(x, y);
|
|
263
|
-
return this;
|
|
264
|
-
}
|
|
265
|
-
/** Cubic bezier to (x, y) with control points (x1, y1) and (x2, y2). */
|
|
266
|
-
curveTo(x1, y1, x2, y2, x, y) {
|
|
267
|
-
this.cmds.push(PATH_C);
|
|
268
|
-
this.xs.push(x1, y1, x2, y2, x, y);
|
|
269
|
-
return this;
|
|
270
|
-
}
|
|
271
|
-
/** Quadratic bezier to (x, y) with control point (x1, y1). */
|
|
272
|
-
quadTo(x1, y1, x, y) {
|
|
273
|
-
this.cmds.push(PATH_Q);
|
|
274
|
-
this.xs.push(x1, y1, x, y);
|
|
275
|
-
return this;
|
|
276
|
-
}
|
|
277
|
-
close() {
|
|
278
|
-
this.cmds.push(PATH_Z);
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
build() {
|
|
282
|
-
return {
|
|
283
|
-
kind: "polygon",
|
|
284
|
-
commands: new Uint8Array(this.cmds),
|
|
285
|
-
coords: new Float32Array(this.xs),
|
|
286
|
-
fillRule: this.fillRule
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
function rectPath(x, y, width, height) {
|
|
291
|
-
return { kind: "rect", x, y, width, height };
|
|
292
|
-
}
|
|
293
|
-
function polylineFromPoints(points) {
|
|
294
|
-
const b = new PathBuilder();
|
|
295
|
-
const first = points[0];
|
|
296
|
-
if (!first) return rectPath(0, 0, 0, 0);
|
|
297
|
-
b.moveTo(first.x, first.y);
|
|
298
|
-
for (let i = 1; i < points.length; i++) {
|
|
299
|
-
const p = points[i];
|
|
300
|
-
if (p) b.lineTo(p.x, p.y);
|
|
301
|
-
}
|
|
302
|
-
return b.build();
|
|
303
|
-
}
|
|
304
|
-
function polygonFromPoints(points, opts = {}) {
|
|
305
|
-
if (points.length === 0) {
|
|
306
|
-
return {
|
|
307
|
-
kind: "polygon",
|
|
308
|
-
commands: new Uint8Array(),
|
|
309
|
-
coords: new Float32Array(),
|
|
310
|
-
fillRule: opts.fillRule ?? "nonzero"
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
const b = new PathBuilder();
|
|
314
|
-
if (opts.fillRule) b.setFillRule(opts.fillRule);
|
|
315
|
-
b.moveTo(points[0].x, points[0].y);
|
|
316
|
-
for (let i = 1; i < points.length; i++) b.lineTo(points[i].x, points[i].y);
|
|
317
|
-
b.close();
|
|
318
|
-
return b.build();
|
|
319
|
-
}
|
|
320
|
-
var ELLIPSE_KAPPA = 0.5522847498307936;
|
|
321
|
-
function ellipsePath(bounds) {
|
|
322
|
-
const cx = bounds.x + bounds.width / 2;
|
|
323
|
-
const cy = bounds.y + bounds.height / 2;
|
|
324
|
-
const rx = bounds.width / 2;
|
|
325
|
-
const ry = bounds.height / 2;
|
|
326
|
-
const ox = rx * ELLIPSE_KAPPA;
|
|
327
|
-
const oy = ry * ELLIPSE_KAPPA;
|
|
328
|
-
const b = new PathBuilder();
|
|
329
|
-
b.moveTo(cx + rx, cy);
|
|
330
|
-
b.curveTo(cx + rx, cy + oy, cx + ox, cy + ry, cx, cy + ry);
|
|
331
|
-
b.curveTo(cx - ox, cy + ry, cx - rx, cy + oy, cx - rx, cy);
|
|
332
|
-
b.curveTo(cx - rx, cy - oy, cx - ox, cy - ry, cx, cy - ry);
|
|
333
|
-
b.curveTo(cx + ox, cy - ry, cx + rx, cy - oy, cx + rx, cy);
|
|
334
|
-
b.close();
|
|
335
|
-
return b.build();
|
|
336
|
-
}
|
|
337
|
-
function regularPolygonPath(center, radius, sides, rotation = 0) {
|
|
338
|
-
const b = new PathBuilder();
|
|
339
|
-
for (let i = 0; i < sides; i++) {
|
|
340
|
-
const a = rotation + i / sides * Math.PI * 2;
|
|
341
|
-
const x = center.x + radius * Math.cos(a);
|
|
342
|
-
const y = center.y + radius * Math.sin(a);
|
|
343
|
-
if (i === 0) b.moveTo(x, y);
|
|
344
|
-
else b.lineTo(x, y);
|
|
345
|
-
}
|
|
346
|
-
b.close();
|
|
347
|
-
return b.build();
|
|
348
|
-
}
|
|
349
|
-
function starPath(center, outerRadius, points = 5, innerRadius = outerRadius / 2, rotation = 0) {
|
|
350
|
-
const b = new PathBuilder();
|
|
351
|
-
const n = points * 2;
|
|
352
|
-
for (let i = 0; i < n; i++) {
|
|
353
|
-
const a = rotation + i / n * Math.PI * 2;
|
|
354
|
-
const r = i % 2 === 0 ? outerRadius : innerRadius;
|
|
355
|
-
const x = center.x + r * Math.cos(a);
|
|
356
|
-
const y = center.y + r * Math.sin(a);
|
|
357
|
-
if (i === 0) b.moveTo(x, y);
|
|
358
|
-
else b.lineTo(x, y);
|
|
359
|
-
}
|
|
360
|
-
b.close();
|
|
361
|
-
return b.build();
|
|
362
|
-
}
|
|
363
|
-
function linePath(a, b) {
|
|
364
|
-
const pb = new PathBuilder();
|
|
365
|
-
pb.moveTo(a.x, a.y);
|
|
366
|
-
pb.lineTo(b.x, b.y);
|
|
367
|
-
return pb.build();
|
|
368
|
-
}
|
|
369
|
-
function transformPath(path, m) {
|
|
370
|
-
const [a, b, c, d, e, f] = m;
|
|
371
|
-
if (path.kind === "rect") {
|
|
372
|
-
if (b === 0 && c === 0) {
|
|
373
|
-
const x0 = a * path.x + e;
|
|
374
|
-
const y0 = d * path.y + f;
|
|
375
|
-
const x1 = a * (path.x + path.width) + e;
|
|
376
|
-
const y1 = d * (path.y + path.height) + f;
|
|
377
|
-
return {
|
|
378
|
-
kind: "rect",
|
|
379
|
-
x: Math.min(x0, x1),
|
|
380
|
-
y: Math.min(y0, y1),
|
|
381
|
-
width: Math.abs(x1 - x0),
|
|
382
|
-
height: Math.abs(y1 - y0)
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
const poly = new PathBuilder().moveTo(path.x, path.y).lineTo(path.x + path.width, path.y).lineTo(path.x + path.width, path.y + path.height).lineTo(path.x, path.y + path.height).close().build();
|
|
386
|
-
return transformPolygon(poly, m);
|
|
387
|
-
}
|
|
388
|
-
return transformPolygon(path, m);
|
|
389
|
-
}
|
|
390
|
-
function transformPolygon(path, m) {
|
|
391
|
-
const mapped = transformCoords(path.coords, m);
|
|
392
|
-
return { ...path, coords: Float32Array.from(mapped) };
|
|
393
|
-
}
|
|
394
|
-
function translatePath(path, dx, dy) {
|
|
395
|
-
if (path.kind === "rect") {
|
|
396
|
-
return { kind: "rect", x: path.x + dx, y: path.y + dy, width: path.width, height: path.height };
|
|
397
|
-
}
|
|
398
|
-
return translatePolygonCopy(path, dx, dy);
|
|
399
|
-
}
|
|
400
|
-
function translatePolygonCopy(path, dx, dy) {
|
|
401
|
-
const next = new Float32Array(path.coords.length);
|
|
402
|
-
const { commands, coords } = path;
|
|
403
|
-
forEachSegment(commands, coords, (cmd, ci) => {
|
|
404
|
-
for (let k = 0, len = pathCommandCoordCount(cmd); k < len; k += 2) {
|
|
405
|
-
next[ci + k] = coords[ci + k] + dx;
|
|
406
|
-
next[ci + k + 1] = coords[ci + k + 1] + dy;
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
return { kind: "polygon", commands: path.commands, coords: next, fillRule: path.fillRule };
|
|
410
|
-
}
|
|
411
|
-
function scalePathToBounds(path, target) {
|
|
412
|
-
if (path.kind === "rect") {
|
|
413
|
-
return { kind: "rect", x: target.x, y: target.y, width: target.width, height: target.height };
|
|
414
|
-
}
|
|
415
|
-
const src = boundsOfPath(path);
|
|
416
|
-
return scalePolygon(path, src, target);
|
|
417
|
-
}
|
|
418
|
-
function scalePolygon(path, src, dst) {
|
|
419
|
-
const m = boxToBox(src.x, src.y, src.width, src.height, dst.x, dst.y, dst.width, dst.height);
|
|
420
|
-
return transformPath(path, m);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// src/core/geometry/unionBounds.ts
|
|
424
|
-
function unionBounds(poses) {
|
|
425
|
-
let minX = Infinity;
|
|
426
|
-
let minY = Infinity;
|
|
427
|
-
let maxX = -Infinity;
|
|
428
|
-
let maxY = -Infinity;
|
|
429
|
-
let any = false;
|
|
430
|
-
for (const p of poses) {
|
|
431
|
-
any = true;
|
|
432
|
-
if (p.x < minX) minX = p.x;
|
|
433
|
-
if (p.y < minY) minY = p.y;
|
|
434
|
-
const right = p.x + p.width;
|
|
435
|
-
const bottom = p.y + p.height;
|
|
436
|
-
if (right > maxX) maxX = right;
|
|
437
|
-
if (bottom > maxY) maxY = bottom;
|
|
438
|
-
}
|
|
439
|
-
if (!any) return null;
|
|
440
|
-
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
441
|
-
}
|
|
442
|
-
function axisAlignedBounds(b) {
|
|
443
|
-
const rotation = b.rotation;
|
|
444
|
-
if (!rotation) {
|
|
445
|
-
return { x: b.x, y: b.y, width: b.width, height: b.height };
|
|
446
|
-
}
|
|
447
|
-
const cos = Math.cos(rotation);
|
|
448
|
-
const sin = Math.sin(rotation);
|
|
449
|
-
const cx = b.x + b.width / 2;
|
|
450
|
-
const cy = b.y + b.height / 2;
|
|
451
|
-
let minX = Infinity;
|
|
452
|
-
let minY = Infinity;
|
|
453
|
-
let maxX = -Infinity;
|
|
454
|
-
let maxY = -Infinity;
|
|
455
|
-
const corners = [
|
|
456
|
-
[b.x, b.y],
|
|
457
|
-
[b.x + b.width, b.y],
|
|
458
|
-
[b.x + b.width, b.y + b.height],
|
|
459
|
-
[b.x, b.y + b.height]
|
|
460
|
-
];
|
|
461
|
-
for (const [px, py] of corners) {
|
|
462
|
-
const dx = px - cx;
|
|
463
|
-
const dy = py - cy;
|
|
464
|
-
const rx = cx + dx * cos - dy * sin;
|
|
465
|
-
const ry = cy + dx * sin + dy * cos;
|
|
466
|
-
if (rx < minX) minX = rx;
|
|
467
|
-
if (rx > maxX) maxX = rx;
|
|
468
|
-
if (ry < minY) minY = ry;
|
|
469
|
-
if (ry > maxY) maxY = ry;
|
|
470
|
-
}
|
|
471
|
-
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
472
|
-
}
|
|
473
|
-
function unionAABB(parts) {
|
|
474
|
-
let minX = Infinity;
|
|
475
|
-
let minY = Infinity;
|
|
476
|
-
let maxX = -Infinity;
|
|
477
|
-
let maxY = -Infinity;
|
|
478
|
-
let any = false;
|
|
479
|
-
for (const part of parts) {
|
|
480
|
-
if (!part) continue;
|
|
481
|
-
const b = axisAlignedBounds(part);
|
|
482
|
-
any = true;
|
|
483
|
-
if (b.x < minX) minX = b.x;
|
|
484
|
-
if (b.y < minY) minY = b.y;
|
|
485
|
-
const right = b.x + b.width;
|
|
486
|
-
const bottom = b.y + b.height;
|
|
487
|
-
if (right > maxX) maxX = right;
|
|
488
|
-
if (bottom > maxY) maxY = bottom;
|
|
489
|
-
}
|
|
490
|
-
if (!any) return null;
|
|
491
|
-
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// src/core/geometry/poseDescriptor.ts
|
|
495
|
-
function poseDescriptorForNode(descriptor, node) {
|
|
496
|
-
return descriptor.forNode?.(node) ?? descriptor;
|
|
497
|
-
}
|
|
498
|
-
function aabbIntersectsRect(b, r) {
|
|
499
|
-
return b.x < r.x + r.width && b.x + b.width > r.x && b.y < r.y + r.height && b.y + b.height > r.y;
|
|
500
|
-
}
|
|
501
|
-
var RECT_POSE_DESCRIPTOR = {
|
|
502
|
-
getBounds: (p) => p,
|
|
503
|
-
remapBounds: (p, src, dst) => {
|
|
504
|
-
const sx = src.width === 0 ? 1 : dst.width / src.width;
|
|
505
|
-
const sy = src.height === 0 ? 1 : dst.height / src.height;
|
|
506
|
-
return {
|
|
507
|
-
...p,
|
|
508
|
-
x: dst.x + (p.x - src.x) * sx,
|
|
509
|
-
y: dst.y + (p.y - src.y) * sy,
|
|
510
|
-
width: p.width * sx,
|
|
511
|
-
height: p.height * sy
|
|
512
|
-
};
|
|
513
|
-
},
|
|
514
|
-
fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height }),
|
|
515
|
-
translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),
|
|
516
|
-
intersectsRect: (p, r) => aabbIntersectsRect(p, r),
|
|
517
|
-
lerp: (a, b, t) => ({
|
|
518
|
-
...a,
|
|
519
|
-
x: a.x + (b.x - a.x) * t,
|
|
520
|
-
y: a.y + (b.y - a.y) * t,
|
|
521
|
-
width: a.width + (b.width - a.width) * t,
|
|
522
|
-
height: a.height + (b.height - a.height) * t
|
|
523
|
-
}),
|
|
524
|
-
// `Bounds` carries an optional `rotation`, and `withRotation` writes into
|
|
525
|
-
// it — so reading it back has to be the same channel, or a pose reports
|
|
526
|
-
// itself unrotated to `useResize` and to port placement while painting
|
|
527
|
-
// rotated.
|
|
528
|
-
getRotation: (p) => p.rotation ?? 0,
|
|
529
|
-
withRotation: (p, rotation) => ({ ...p, rotation })
|
|
530
|
-
};
|
|
531
|
-
var ROTATED_POSE_DESCRIPTOR = {
|
|
532
|
-
getBounds: RECT_POSE_DESCRIPTOR.getBounds,
|
|
533
|
-
remapBounds: RECT_POSE_DESCRIPTOR.remapBounds,
|
|
534
|
-
translate: RECT_POSE_DESCRIPTOR.translate,
|
|
535
|
-
intersectsRect: RECT_POSE_DESCRIPTOR.intersectsRect,
|
|
536
|
-
lerp: RECT_POSE_DESCRIPTOR.lerp,
|
|
537
|
-
fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height, rotation: 0 }),
|
|
538
|
-
getRotation: (p) => p.rotation,
|
|
539
|
-
withRotation: (p, rotation) => ({ ...p, rotation })
|
|
540
|
-
};
|
|
541
|
-
function remapRotatedLeaf(pose, src, dst) {
|
|
542
|
-
const sx = src.width === 0 ? 1 : dst.width / src.width;
|
|
543
|
-
const sy = src.height === 0 ? 1 : dst.height / src.height;
|
|
544
|
-
const theta = pose.rotation ?? 0;
|
|
545
|
-
const cos = Math.cos(theta);
|
|
546
|
-
const sin = Math.sin(theta);
|
|
547
|
-
const ux = sx * cos, uy = sy * sin;
|
|
548
|
-
const vx = -sx * sin, vy = sy * cos;
|
|
549
|
-
const width = pose.width * Math.hypot(ux, uy);
|
|
550
|
-
const height = pose.height * Math.hypot(vx, vy);
|
|
551
|
-
const rotation = Math.atan2(uy, ux);
|
|
552
|
-
const cxNew = dst.x + (pose.x + pose.width / 2 - src.x) * sx;
|
|
553
|
-
const cyNew = dst.y + (pose.y + pose.height / 2 - src.y) * sy;
|
|
554
|
-
return {
|
|
555
|
-
...pose,
|
|
556
|
-
x: cxNew - width / 2,
|
|
557
|
-
y: cyNew - height / 2,
|
|
558
|
-
width,
|
|
559
|
-
height,
|
|
560
|
-
rotation
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
function visualBoundsViaDescriptor(pose, geometry) {
|
|
564
|
-
const b = geometry.getBounds(pose);
|
|
565
|
-
const rotation = geometry.getRotation?.(pose) ?? b.rotation ?? 0;
|
|
566
|
-
return axisAlignedBounds({ x: b.x, y: b.y, width: b.width, height: b.height, rotation });
|
|
567
|
-
}
|
|
568
|
-
function translatePoseViaDescriptor(pose, dx, dy, geometry) {
|
|
569
|
-
if (geometry.translate) return geometry.translate(pose, dx, dy);
|
|
570
|
-
const src = geometry.getBounds(pose);
|
|
571
|
-
const dst = { x: src.x + dx, y: src.y + dy, width: src.width, height: src.height };
|
|
572
|
-
return geometry.remapBounds(pose, src, dst);
|
|
573
|
-
}
|
|
574
|
-
var pathPoseDescriptor = {
|
|
575
|
-
getBounds: (path) => boundsOfPath(path),
|
|
576
|
-
remapBounds: (path, src, dst) => transformPath(
|
|
577
|
-
path,
|
|
578
|
-
boxToBox(src.x, src.y, src.width, src.height, dst.x, dst.y, dst.width, dst.height)
|
|
579
|
-
),
|
|
580
|
-
fromBounds: (b) => ({ kind: "rect", x: b.x, y: b.y, width: b.width, height: b.height }),
|
|
581
|
-
translate: (path, dx, dy) => translatePath(path, dx, dy),
|
|
582
|
-
// WHY: AABB pre-test is cheap; only fall through to per-corner pointInPath
|
|
583
|
-
// when the rect is fully inside the AABB (silhouette test).
|
|
584
|
-
intersectsRect: (path, rect) => {
|
|
585
|
-
const b = boundsOfPath(path);
|
|
586
|
-
if (!aabbIntersectsRect(b, rect)) return false;
|
|
587
|
-
if (path.kind === "rect") return true;
|
|
588
|
-
if (pointInPath(path, rect.x, rect.y) || pointInPath(path, rect.x + rect.width, rect.y) || pointInPath(path, rect.x, rect.y + rect.height) || pointInPath(path, rect.x + rect.width, rect.y + rect.height)) return true;
|
|
589
|
-
return true;
|
|
590
|
-
},
|
|
591
|
-
lerp: (a, b, t) => {
|
|
592
|
-
if (a.kind === "rect" && b.kind === "rect") {
|
|
593
|
-
return {
|
|
594
|
-
kind: "rect",
|
|
595
|
-
x: a.x + (b.x - a.x) * t,
|
|
596
|
-
y: a.y + (b.y - a.y) * t,
|
|
597
|
-
width: a.width + (b.width - a.width) * t,
|
|
598
|
-
height: a.height + (b.height - a.height) * t
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
if (a.kind === "polygon" && b.kind === "polygon" && a.coords.length === b.coords.length) {
|
|
602
|
-
const next = new Float32Array(a.coords.length);
|
|
603
|
-
for (let i = 0; i < a.coords.length; i++) {
|
|
604
|
-
next[i] = a.coords[i] + (b.coords[i] - a.coords[i]) * t;
|
|
605
|
-
}
|
|
606
|
-
return { kind: "polygon", commands: a.commands, coords: next, fillRule: a.fillRule };
|
|
607
|
-
}
|
|
608
|
-
throw new Error("pathPoseDescriptor.lerp: incompatible path shapes");
|
|
609
|
-
},
|
|
610
|
-
// Path poses carry no x/y/width/height/rotation fields — the kit's
|
|
611
|
-
// `wrapWithPoseRotation` helper has nothing to bind a rotation to, and
|
|
612
|
-
// `remapBounds` would drop a synthetic rotation field on every commit.
|
|
613
|
-
// Returning false here hides the rotation affordance for Path consumers
|
|
614
|
-
// so the rotate cursor doesn't appear without a working interaction.
|
|
615
|
-
supportsRotation: () => false
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
// src/interactions/actions/resize/autoPoseDescriptor.ts
|
|
619
|
-
function isPathLike(p) {
|
|
620
|
-
return !!p && typeof p === "object" && "kind" in p && (p.kind === "polygon" || p.kind === "rect");
|
|
621
|
-
}
|
|
622
|
-
function isRectPose(p) {
|
|
623
|
-
if (!p || typeof p !== "object") return false;
|
|
624
|
-
const r = p;
|
|
625
|
-
return typeof r.x === "number" && typeof r.y === "number" && typeof r.width === "number" && typeof r.height === "number";
|
|
626
|
-
}
|
|
627
|
-
var AUTO_POSE_DESCRIPTOR = {
|
|
628
|
-
getBounds: (p) => isPathLike(p) ? pathPoseDescriptor.getBounds(p) : RECT_POSE_DESCRIPTOR.getBounds(p),
|
|
629
|
-
remapBounds: (p, src, dst) => isPathLike(p) ? pathPoseDescriptor.remapBounds(p, src, dst) : RECT_POSE_DESCRIPTOR.remapBounds(p, src, dst),
|
|
630
|
-
fromBounds: (b, template) => isPathLike(template) ? pathPoseDescriptor.fromBounds(b, template) : RECT_POSE_DESCRIPTOR.fromBounds(b, template),
|
|
631
|
-
translate: (p, dx, dy) => isPathLike(p) ? pathPoseDescriptor.translate(p, dx, dy) : RECT_POSE_DESCRIPTOR.translate(p, dx, dy),
|
|
632
|
-
intersectsRect: (p, rect) => isPathLike(p) ? pathPoseDescriptor.intersectsRect(p, rect) : RECT_POSE_DESCRIPTOR.intersectsRect(p, rect),
|
|
633
|
-
getRotation: (p) => {
|
|
634
|
-
if (isPathLike(p)) return 0;
|
|
635
|
-
const r = p.rotation;
|
|
636
|
-
return typeof r === "number" ? r : 0;
|
|
637
|
-
},
|
|
638
|
-
// Path-shaped poses can't carry rotation (see `pathPoseDescriptor`).
|
|
639
|
-
// Everything else flows through `wrapWithPoseRotation`'s x/y/w/h gate at
|
|
640
|
-
// paint time, so report `true` and let the wrapper no-op for poses
|
|
641
|
-
// missing AABB fields.
|
|
642
|
-
supportsRotation: (p) => !isPathLike(p),
|
|
643
|
-
withRotation: (p, rotation) => isPathLike(p) ? p : { ...p, rotation }
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
export { AUTO_POSE_DESCRIPTOR, PathBuilder, RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, aabbIntersectsRect, axisAlignedBounds, boundsOfPath, ellipsePath, isPathLike, isRectPose, linePath, pathPoseDescriptor, pointInPath, polygonFromPoints, polylineFromPoints, poseDescriptorForNode, rectPath, regularPolygonPath, remapRotatedLeaf, scalePathToBounds, starPath, strokeHitTest, transformPath, translatePath, translatePoseViaDescriptor, unionAABB, unionBounds, visualBoundsViaDescriptor };
|
|
647
|
-
//# sourceMappingURL=chunk-L5YNZYEG.js.map
|
|
648
|
-
//# sourceMappingURL=chunk-L5YNZYEG.js.map
|