@weasel-js/core 1.9.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +750 -0
- package/README.md +5 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -83
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +54 -100
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +5 -4
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +48 -136
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +35 -39
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +12 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +42 -36
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +41 -51
- package/dist/canvas/Canvas.js +281 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +169 -188
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +22 -23
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +40 -29
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +73 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +39 -37
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +76 -80
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +303 -707
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +49 -68
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +65 -54
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +43 -41
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +52 -50
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +1 -3
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +12 -12
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -132
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +36 -35
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +23 -11
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +46 -37
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +61 -14
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +103 -92
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +116 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +9 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +7 -7
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +5 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -16
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +42 -55
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +95 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +4507 -8459
- package/dist/index.js +275 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +23 -23
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +41 -43
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +19 -19
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +35 -40
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +14 -15
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +30 -31
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +19 -21
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +1 -1
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/move/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +24 -23
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +17 -64
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +77 -72
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +161 -163
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +4 -4
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +43 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +67 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +8 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-CIKDwlsP.d.ts} +84 -164
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -60
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -82
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -94
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -104
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -239
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -85
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -51
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -91
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -74
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -68
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -48
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -11
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -34
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-DM2B87-g.d.ts +0 -356
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { translatePoseViaDescriptor as e } from "../../core/geometry/poseDescriptor.js";
|
|
2
|
+
import { createTransformOp as t } from "../../core/ops/transform.js";
|
|
3
|
+
import { poseKey as n } from "../poseHelpers.js";
|
|
4
|
+
import { clampCorner as r, coastKey as i, sameBounds as a } from "./coast.js";
|
|
5
|
+
//#region src/animation/behaviors/coastOnTargets.ts
|
|
6
|
+
function o(t, n, r, i, a) {
|
|
7
|
+
let o = t.to(r), s = t.to(e(r, 1, 0, n)), c = t.to(e(r, 0, 1, n));
|
|
8
|
+
return t.from(o.map((e, t) => i * (s[t] - e) + a * (c[t] - e)));
|
|
9
|
+
}
|
|
10
|
+
function s(s, c) {
|
|
11
|
+
let { animator: l, ctx: u, d, bounds: f, coasts: p } = s, m = u.adapter, h = -Math.log(s.friction), g = i(), _ = /* @__PURE__ */ new Map(), v = (e) => m.getNode(e.id) !== void 0 && a(d.getBounds(e.target.committed()), d.getBounds(e.seen)), y = (e, t, n, r) => {
|
|
12
|
+
let i = t ?? e.target.committed(), a = o(e.target.axes, d, i, n, r), c = d.getBounds(i);
|
|
13
|
+
e.startX = c.x, e.startY = c.y, e.vx = n, e.vy = r, e.handle = l.decay({
|
|
14
|
+
target: e.target,
|
|
15
|
+
from: t,
|
|
16
|
+
velocity: a,
|
|
17
|
+
friction: s.friction,
|
|
18
|
+
cancelKey: g,
|
|
19
|
+
interrupt: !1,
|
|
20
|
+
onTick: (t) => S(e, t),
|
|
21
|
+
onDone: () => b(e)
|
|
22
|
+
});
|
|
23
|
+
}, b = (e) => {
|
|
24
|
+
e.handle = null, e.seen = e.target.committed();
|
|
25
|
+
for (let e of _.values()) if (e.handle) return;
|
|
26
|
+
w();
|
|
27
|
+
}, x = (e, t) => {
|
|
28
|
+
let r = e.target.committed();
|
|
29
|
+
if (_.delete(e.id), e.handle?.cancel(), e.target.commit(r), e.target.active && m.getNode(e.id) !== void 0) {
|
|
30
|
+
let i = d.getBounds(r), a = d.getBounds(e.seen), s = d.getBounds(t), c = e.vx - h * (s.x - (i.x - a.x) - e.startX), u = e.vy - h * (s.y - (i.y - a.y) - e.startY);
|
|
31
|
+
l.spring({
|
|
32
|
+
target: e.target,
|
|
33
|
+
from: t,
|
|
34
|
+
to: r,
|
|
35
|
+
velocity: o(e.target.axes, d, t, c, u),
|
|
36
|
+
cancelKey: n(e.id),
|
|
37
|
+
interrupt: !1
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
b(e);
|
|
41
|
+
};
|
|
42
|
+
function S(t, n) {
|
|
43
|
+
if (!v(t)) {
|
|
44
|
+
x(t, n);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let i = d.getBounds(n), { nx: a, ny: o, hitX: c, hitY: l } = r(f, i.x, i.y);
|
|
48
|
+
if (!c && !l) return;
|
|
49
|
+
let u = c ? 0 : t.vx - h * (i.x - t.startX), p = l ? 0 : t.vy - h * (i.y - t.startY);
|
|
50
|
+
t.handle?.cancel(), t.target.commit(e(t.target.committed(), a - i.x, o - i.y, d)), t.seen = t.target.committed(), s.boundary === "continue" && Math.hypot(u, p) > 0 ? y(t, void 0, u, p) : b(t);
|
|
51
|
+
}
|
|
52
|
+
let C = {
|
|
53
|
+
ids: u.draggedIds.slice(),
|
|
54
|
+
stop: () => {
|
|
55
|
+
if (!l.isActive(g)) {
|
|
56
|
+
p.delete(C);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (let e of _.values()) e.handle?.cancel(), e.handle = null, e.seen = e.target.committed();
|
|
60
|
+
w();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
p.add(C);
|
|
64
|
+
function w() {
|
|
65
|
+
if (!p.delete(C) || !m.applyOps) return;
|
|
66
|
+
let e = [];
|
|
67
|
+
for (let n of _.values()) {
|
|
68
|
+
if (!v(n)) continue;
|
|
69
|
+
let r = u.origin.get(n.id) ?? n.seen, i = n.target.committed();
|
|
70
|
+
n.target.commit(r), e.push(t({
|
|
71
|
+
id: n.id,
|
|
72
|
+
from: r,
|
|
73
|
+
to: i,
|
|
74
|
+
label: "flick"
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
e.length > 0 && m.applyOps(e, "flick");
|
|
78
|
+
}
|
|
79
|
+
for (let [e, t] of c) _.set(e, {
|
|
80
|
+
id: e,
|
|
81
|
+
target: t,
|
|
82
|
+
seen: t.committed(),
|
|
83
|
+
handle: null,
|
|
84
|
+
startX: 0,
|
|
85
|
+
startY: 0,
|
|
86
|
+
vx: 0,
|
|
87
|
+
vy: 0
|
|
88
|
+
});
|
|
89
|
+
for (let e of [..._.values()]) y(e, u.current.get(e.id), s.vx, s.vy);
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { s as coastOnTargets };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=coastOnTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coastOnTargets.js","names":["poseVelocity","base","ax","at","alongX","translatePoseViaDescriptor","d","alongY","vx","i","b","vy","coastOnTargets","a","adapter","ctx","drag","cancelKey","coastKey","riders","ours","r","sameBounds","launch","from","velocity","corner","animator","tick","own","halted","other","drop","left","moved","was","poseKey","clampCorner","bounds","hitX","hitY","nx","ny","coast","commitFlick","coasts","ops","to","createTransformOp","id","target","targets"],"sources":["../../../src/animation/behaviors/coastOnTargets.ts"],"sourcesContent":["import { createTransformOp } from 'core/ops/transform';\nimport type { Op } from 'core/ops/types';\nimport { translatePoseViaDescriptor, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport type { Target, TargetAxes } from '@weasel-js/animator';\nimport type { AnimationHandle } from '@weasel-js/animator';\nimport { poseKey } from '../poseHelpers';\nimport { clampCorner, coastKey, sameBounds, type Coast, type CoastArgs } from './coast';\n\ninterface Rider<TPose> {\n id: string;\n target: Target<TPose>;\n /** The committed pose as the coast last left it. Anything else there is another writer's. */\n seen: TPose;\n /** Null once this node has stopped. */\n handle: AnimationHandle | null;\n /** The corner and velocity its running decay started with. */\n startX: number;\n startY: number;\n vx: number;\n vy: number;\n}\n\n/** A world velocity as the rate of change of a pose at `at`. */\nfunction poseVelocity<TPose>(\n ax: TargetAxes<TPose>,\n d: PoseDescriptor<TPose>,\n at: TPose,\n vx: number,\n vy: number,\n): TPose {\n const base = ax.to(at);\n const alongX = ax.to(translatePoseViaDescriptor(at, 1, 0, d));\n const alongY = ax.to(translatePoseViaDescriptor(at, 0, 1, d));\n return ax.from(base.map((b, i) => vx * (alongX[i]! - b) + vy * (alongY[i]! - b)));\n}\n\n/**\n * A coast on each node's own pose target: a decay per node, so anything else animating the\n * node adds to it. The document keeps the pre-drag pose while the node travels, takes the\n * pose it stops at, and the flick is recorded as one transform once every node has stopped.\n */\nexport function coastOnTargets<TPose>(a: CoastArgs<TPose>, targets: ReadonlyMap<string, Target<TPose>>): void {\n const { animator, ctx, d, bounds, coasts } = a;\n const adapter = ctx.adapter;\n // Speed lost per unit traveled: an exponential coast's velocity is its first less this times\n // how far it has gone, which is how a node stopped at an edge knows what speed it has left.\n const drag = -Math.log(a.friction);\n const cancelKey = coastKey();\n const riders = new Map<string, Rider<TPose>>();\n\n const ours = (r: Rider<TPose>): boolean =>\n adapter.getNode(r.id) !== undefined && sameBounds(d.getBounds(r.target.committed()), d.getBounds(r.seen));\n\n const launch = (r: Rider<TPose>, from: TPose | undefined, vx: number, vy: number): void => {\n const at = from ?? r.target.committed();\n const velocity = poseVelocity(r.target.axes, d, at, vx, vy);\n const corner = d.getBounds(at);\n r.startX = corner.x;\n r.startY = corner.y;\n r.vx = vx;\n r.vy = vy;\n r.handle = animator.decay<TPose>({\n target: r.target,\n from,\n velocity,\n friction: a.friction,\n cancelKey,\n interrupt: false,\n onTick: (own) => tick(r, own),\n onDone: () => halted(r),\n });\n };\n\n const halted = (r: Rider<TPose>): void => {\n r.handle = null;\n r.seen = r.target.committed();\n for (const other of riders.values()) if (other.handle) return;\n commitFlick();\n };\n\n /**\n * Takes `r` out of the coast where another writer left its node. Where that writer is another\n * animation on the node, the node is still short of `left` by what the coast had traveled, at\n * `own`: a spring carries that to nothing from the coast's speed, joining the node's moves.\n */\n const drop = (r: Rider<TPose>, own: TPose): void => {\n const left = r.target.committed();\n riders.delete(r.id);\n r.handle?.cancel();\n r.target.commit(left);\n if (r.target.active && adapter.getNode(r.id) !== undefined) {\n const moved = d.getBounds(left);\n const was = d.getBounds(r.seen);\n const corner = d.getBounds(own);\n const vx = r.vx - drag * (corner.x - (moved.x - was.x) - r.startX);\n const vy = r.vy - drag * (corner.y - (moved.y - was.y) - r.startY);\n animator.spring<TPose>({\n target: r.target,\n from: own,\n to: left,\n velocity: poseVelocity(r.target.axes, d, own, vx, vy),\n cancelKey: poseKey(r.id),\n interrupt: false,\n });\n }\n halted(r);\n };\n\n function tick(r: Rider<TPose>, own: TPose): void {\n if (!ours(r)) { drop(r, own); return; }\n const corner = d.getBounds(own);\n const { nx, ny, hitX, hitY } = clampCorner(bounds, corner.x, corner.y);\n if (!hitX && !hitY) return;\n const vx = hitX ? 0 : r.vx - drag * (corner.x - r.startX);\n const vy = hitY ? 0 : r.vy - drag * (corner.y - r.startY);\n // Canceled, it commits the pose it reached; the edge is where it belongs.\n r.handle?.cancel();\n r.target.commit(translatePoseViaDescriptor(r.target.committed(), nx - corner.x, ny - corner.y, d));\n r.seen = r.target.committed();\n if (a.boundary === 'continue' && Math.hypot(vx, vy) > 0) launch(r, undefined, vx, vy);\n else halted(r);\n }\n\n const coast: Coast = {\n ids: ctx.draggedIds.slice(),\n stop: (): void => {\n // Canceled from outside (cancelAll, unmount), it stopped long ago and somewhere else.\n if (!animator.isActive(cancelKey)) {\n coasts.delete(coast);\n return;\n }\n for (const r of riders.values()) {\n r.handle?.cancel();\n r.handle = null;\n r.seen = r.target.committed();\n }\n commitFlick();\n },\n };\n coasts.add(coast);\n\n function commitFlick(): void {\n if (!coasts.delete(coast) || !adapter.applyOps) return;\n const ops: Op[] = [];\n for (const r of riders.values()) {\n if (!ours(r)) continue;\n const from = ctx.origin.get(r.id) ?? r.seen;\n const to = r.target.committed();\n // A scene records the write it sees, not an op's `from`, so the document goes back first.\n r.target.commit(from);\n ops.push(createTransformOp<TPose>({ id: r.id, from, to, label: 'flick' }));\n }\n if (ops.length > 0) adapter.applyOps(ops, 'flick');\n }\n\n for (const [id, target] of targets) {\n riders.set(id, { id, target, seen: target.committed(), handle: null, startX: 0, startY: 0, vx: 0, vy: 0 });\n }\n // Each starts from its release pose, which the document does not hold: the drag was a preview.\n for (const r of [...riders.values()]) launch(r, ctx.current.get(r.id), a.vx, a.vy);\n}\n"],"mappings":";;;;;AAuBA,SAASA,EACP,GACA,GACA,GACA,GACA,GACO;CACP,IAAMC,IAAOC,EAAG,GAAGC,CAAE,GACfC,IAASF,EAAG,GAAGG,EAA2BF,GAAI,GAAG,GAAGG,CAAC,CAAC,GACtDC,IAASL,EAAG,GAAGG,EAA2BF,GAAI,GAAG,GAAGG,CAAC,CAAC;CAC5D,OAAOJ,EAAG,KAAKD,EAAK,KAAK,GAAG,MAAMO,KAAMJ,EAAOK,KAAMC,KAAKC,KAAMJ,EAAOE,KAAMC,EAAE,CAAC;AAClF;AAO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E_DESCRIPTOR as e } from "../../core/geometry/autoPoseDescriptor.js";
|
|
2
|
+
import { coastByWrite as t } from "./coastByWrite.js";
|
|
3
|
+
import { coastOnTargets as n } from "./coastOnTargets.js";
|
|
4
4
|
import { getScratch as r, scratchKey as i, setScratch as a } from "@weasel-js/routing";
|
|
5
5
|
//#region src/animation/behaviors/momentum.ts
|
|
6
|
-
var o =
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ny: a,
|
|
13
|
-
hit: !1
|
|
14
|
-
};
|
|
15
|
-
let o = !1;
|
|
16
|
-
return i < p.x ? (i = p.x, o = !0) : i > p.x + p.width && (i = p.x + p.width, o = !0), a < p.y ? (a = p.y, o = !0) : a > p.y + p.height && (a = p.y + p.height, o = !0), {
|
|
17
|
-
nx: i,
|
|
18
|
-
ny: a,
|
|
19
|
-
hit: o
|
|
20
|
-
};
|
|
21
|
-
}, _ = (e) => {
|
|
22
|
-
let t = r(e.scratch, c);
|
|
23
|
-
t || (t = [], a(e.scratch, c, t)), t.push({
|
|
24
|
-
t: f(),
|
|
6
|
+
var o = i("momentum.samples");
|
|
7
|
+
function s(i) {
|
|
8
|
+
let s = i.friction ?? .92, c = i.threshold ?? 200, l = i.velocitySampleMs ?? 80, u = i.now ?? (() => Date.now()), d = i.poseDescriptor ?? e, f = (e) => {
|
|
9
|
+
let t = r(e.scratch, o);
|
|
10
|
+
t || (t = [], a(e.scratch, o, t)), t.push({
|
|
11
|
+
t: u(),
|
|
25
12
|
x: e.pointer.worldX,
|
|
26
13
|
y: e.pointer.worldY
|
|
27
14
|
});
|
|
28
|
-
let n =
|
|
15
|
+
let n = u() - l * 4;
|
|
29
16
|
for (; t.length > 1 && t[0].t < n;) t.shift();
|
|
30
|
-
},
|
|
17
|
+
}, p = /* @__PURE__ */ new Set(), m = (e) => {
|
|
18
|
+
let { adapter: t } = e;
|
|
19
|
+
if (!t.poseTarget) return null;
|
|
20
|
+
let n = /* @__PURE__ */ new Map();
|
|
21
|
+
for (let r of e.draggedIds) {
|
|
22
|
+
if (!e.current.has(r)) continue;
|
|
23
|
+
let a = t.getNode(r) && t.poseTarget(r, i.poseDescriptor);
|
|
24
|
+
if (!a) return null;
|
|
25
|
+
n.set(r, a);
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
};
|
|
31
29
|
return {
|
|
32
30
|
onStart(e) {
|
|
33
|
-
for (let t of [...
|
|
34
|
-
a(e.scratch,
|
|
31
|
+
for (let t of [...p]) t.ids.some((t) => e.draggedIds.includes(t)) && t.stop();
|
|
32
|
+
a(e.scratch, o, []), f(e);
|
|
35
33
|
},
|
|
36
34
|
onMove(e) {
|
|
37
|
-
|
|
35
|
+
f(e);
|
|
38
36
|
},
|
|
39
|
-
onEnd(
|
|
37
|
+
onEnd(e, a) {
|
|
40
38
|
if (a.answered) return;
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
44
|
-
for (let e of
|
|
45
|
-
|
|
39
|
+
let u = r(e.scratch, o) ?? [];
|
|
40
|
+
if (u.length < 2) return;
|
|
41
|
+
let f = u[u.length - 1], h = f.t - l, g = u[0];
|
|
42
|
+
for (let e of u) if (e.t >= h) {
|
|
43
|
+
g = e;
|
|
46
44
|
break;
|
|
47
45
|
}
|
|
48
|
-
let
|
|
49
|
-
if (
|
|
50
|
-
let
|
|
51
|
-
if (Math.hypot(
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ids: n.draggedIds.slice(),
|
|
65
|
-
stop: () => {
|
|
66
|
-
if (!i.animator.isActive(M)) {
|
|
67
|
-
v.delete(N);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
P.cancel(), F();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
v.add(N), D(new Map([...O].flatMap((e) => {
|
|
74
|
-
let t = w.get(e);
|
|
75
|
-
return t === void 0 ? [] : [[e, t]];
|
|
76
|
-
})));
|
|
77
|
-
let P = i.animator.decay({
|
|
78
|
-
from: {
|
|
79
|
-
x: 0,
|
|
80
|
-
y: 0
|
|
81
|
-
},
|
|
82
|
-
velocity: {
|
|
83
|
-
x: S,
|
|
84
|
-
y: C
|
|
85
|
-
},
|
|
86
|
-
friction: l,
|
|
87
|
-
cancelKey: M,
|
|
88
|
-
add: (e, t) => ({
|
|
89
|
-
x: e.x + t.x,
|
|
90
|
-
y: e.y + t.y
|
|
91
|
-
}),
|
|
92
|
-
scale: (e, t) => ({
|
|
93
|
-
x: e.x * t,
|
|
94
|
-
y: e.y * t
|
|
95
|
-
}),
|
|
96
|
-
magnitude: (e) => Math.hypot(e.x, e.y),
|
|
97
|
-
onTick: (e) => {
|
|
98
|
-
T = e;
|
|
99
|
-
let n = p !== void 0, r = /* @__PURE__ */ new Map();
|
|
100
|
-
for (let i of [...O]) {
|
|
101
|
-
if (!A(i)) {
|
|
102
|
-
O.delete(i), r.set(i, null);
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
let a = w.get(i);
|
|
106
|
-
if (!a) continue;
|
|
107
|
-
let o = h.getBounds(a), { nx: s, ny: c, hit: l } = g(o.x, o.y, e.x, e.y);
|
|
108
|
-
l || (n = !1), j.set(i, {
|
|
109
|
-
x: s,
|
|
110
|
-
y: c
|
|
111
|
-
}), r.set(i, t(a, s - o.x, c - o.y, h));
|
|
112
|
-
}
|
|
113
|
-
D(r);
|
|
114
|
-
for (let e of O) k.set(e, h.getBounds(E.getPose(e)));
|
|
115
|
-
if (O.size === 0) {
|
|
116
|
-
v.delete(N), P.cancel();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
m === "stop" && n && N.stop();
|
|
120
|
-
},
|
|
121
|
-
onDone: () => {
|
|
122
|
-
F();
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
function F() {
|
|
126
|
-
if (!v.delete(N)) return;
|
|
127
|
-
let r = [], i = /* @__PURE__ */ new Map();
|
|
128
|
-
for (let a of O) {
|
|
129
|
-
if (i.set(a, null), !A(a)) continue;
|
|
130
|
-
let o = w.get(a);
|
|
131
|
-
if (!o) continue;
|
|
132
|
-
let s = h.getBounds(o), c = j.get(a) ?? {
|
|
133
|
-
x: s.x + T.x,
|
|
134
|
-
y: s.y + T.y
|
|
135
|
-
}, l = t(o, c.x - s.x, c.y - s.y, h), u = n.origin.get(a) ?? o;
|
|
136
|
-
r.push(e({
|
|
137
|
-
id: a,
|
|
138
|
-
from: u,
|
|
139
|
-
to: l,
|
|
140
|
-
label: "flick"
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
if (r.length > 0) {
|
|
144
|
-
if (E.applyOps) E.applyOps(r, "flick");
|
|
145
|
-
else if (E.previewPoses) for (let e of r) e.apply(E);
|
|
146
|
-
}
|
|
147
|
-
E.previewPoses?.(i);
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
46
|
+
let _ = (f.t - g.t) / 1e3;
|
|
47
|
+
if (_ <= 0) return;
|
|
48
|
+
let v = (f.x - g.x) / _, y = (f.y - g.y) / _;
|
|
49
|
+
if (Math.hypot(v, y) < c) return;
|
|
50
|
+
let b = {
|
|
51
|
+
animator: i.animator,
|
|
52
|
+
ctx: e,
|
|
53
|
+
vx: v,
|
|
54
|
+
vy: y,
|
|
55
|
+
friction: s,
|
|
56
|
+
d,
|
|
57
|
+
coasts: p,
|
|
58
|
+
bounds: i.bounds,
|
|
59
|
+
boundary: i.boundary ?? "stop"
|
|
60
|
+
}, x = m(e);
|
|
61
|
+
return x ? n(b, x) : t(b), null;
|
|
150
62
|
}
|
|
151
63
|
};
|
|
152
64
|
}
|
|
153
65
|
//#endregion
|
|
154
|
-
export {
|
|
66
|
+
export { s as momentum };
|
|
155
67
|
|
|
156
68
|
//# sourceMappingURL=momentum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentum.js","names":["sameBounds","a","b","nextCoast","SAMPLES","scratchKey","momentum","friction","opts","threshold","sampleMs","now","bounds","boundaryPolicy","d","AUTO_POSE_DESCRIPTOR","clampToBounds","nx","sx","dx","ny","sy","dy","hit","recordSample","samples","getScratch","ctx","setScratch","cutoff","coasts","coast","id","end","last","first","s","dt","vx","vy","startPoses","lastValue","adapter","show","poses","pose","riding","lastSeen","stillOurs","seen","finalPositions","cancelKey","decayHandle","commitFlick","start","v","k","delta","allHit","frame","translatePoseViaDescriptor","ops","shown","o","fp","finalPose","from","createTransformOp","op"],"sources":["../../../src/animation/behaviors/momentum.ts"],"sourcesContent":["import { createTransformOp } from 'core/ops/transform';\nimport type { Op } from 'core/ops/types';\nimport type { MoveBehavior, GestureContext } from 'interactions/gestures/types';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\nimport type { PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { translatePoseViaDescriptor } from 'core/geometry/poseDescriptor';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport type { Animator } from '../types';\n\n/** Options for the `momentum` move behavior. */\nexport interface MomentumOptions {\n /** Required: the per-Canvas animator that will own the decay. */\n animator: Animator;\n friction?: number; // default 0.92 (per second)\n threshold?: number; // default 200 world units/sec; the slowest release that coasts\n /** Sample window in ms for velocity computation. Default 80ms. */\n velocitySampleMs?: number;\n /** Optional clock override for tests. Defaults to `Date.now`. */\n now?: () => number;\n /**\n * Optional bounds for the object's top-left corner (in world units). When\n * supplied, momentum-driven translation is clamped: each tick's new\n * position is constrained so the object's `(x, y)` stays inside the rect.\n * Without bounds, a hard flick carries the object indefinitely until\n * friction dampens velocity below `threshold`.\n *\n * Note: ignores object size for now — the bound is on the top-left, not\n * the visible edges. A consumer wanting \"object stays fully inside\" should\n * pass `bounds = { x: canvas.x, y: canvas.y, width: canvas.w - obj.w,\n * height: canvas.h - obj.h }` (and accept that it doesn't adapt to\n * variable-sized objects mid-flight).\n */\n bounds?: { x: number; y: number; width: number; height: number };\n /**\n * Boundary policy when the clamped position hits an edge. 'stop' cancels\n * the decay (instant settle at the edge). 'continue' keeps decaying but\n * subsequent ticks stay clamped (object drifts along the edge as friction\n * decays the velocity). Default 'stop'.\n */\n boundary?: 'stop' | 'continue';\n /** How to translate poses. Default `AUTO_POSE_DESCRIPTOR`. */\n poseDescriptor?: PoseDescriptor<unknown>;\n}\n\ninterface PointerSample {\n t: number; // ms timestamp\n x: number;\n y: number;\n}\n\ninterface RectLike { x: number; y: number }\n\nconst sameBounds = (a: Bounds, b: Bounds): boolean =>\n a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n\nlet nextCoast = 0;\n\nconst SAMPLES = scratchKey<PointerSample[]>('momentum.samples');\n\n/**\n * Move behavior that keeps a dragged node coasting after the pointer is\n * released, at the velocity it was traveling, until friction brings it to\n * rest. A release slower than `threshold` does not coast at all.\n *\n * Plugs into the move action rather than replacing it, so the drag itself is\n * unchanged — this only decides what happens after the release. The whole\n * flick, coast included, records as one undoable transform: under an adapter\n * with `previewPoses` the coast is shown without touching the document, and\n * the transform is written once it comes to rest. Dragging a node\n * again while it coasts stops the coast and records it where it stands. A node\n * something else moves or deletes mid-coast, an undo included, drops out of\n * the coast where that left it, and nothing is recorded for it.\n */\nexport function momentum<TPose>(opts: MomentumOptions): MoveBehavior<TPose> {\n const friction = opts.friction ?? 0.92;\n const threshold = opts.threshold ?? 200;\n const sampleMs = opts.velocitySampleMs ?? 80;\n const now = opts.now ?? (() => Date.now());\n const bounds = opts.bounds;\n const boundaryPolicy = opts.boundary ?? 'stop';\n const d = (opts.poseDescriptor ?? AUTO_POSE_DESCRIPTOR) as PoseDescriptor<TPose>;\n\n /** Apply bounds clamp to (sx + dx, sy + dy). Returns clamped (nx, ny) and\n * whether either axis was clamped (signalling boundary hit). */\n const clampToBounds = (sx: number, sy: number, dx: number, dy: number): { nx: number; ny: number; hit: boolean } => {\n let nx = sx + dx;\n let ny = sy + dy;\n if (!bounds) return { nx, ny, hit: false };\n let hit = false;\n if (nx < bounds.x) { nx = bounds.x; hit = true; }\n else if (nx > bounds.x + bounds.width) { nx = bounds.x + bounds.width; hit = true; }\n if (ny < bounds.y) { ny = bounds.y; hit = true; }\n else if (ny > bounds.y + bounds.height) { ny = bounds.y + bounds.height; hit = true; }\n return { nx, ny, hit };\n };\n\n const recordSample = (ctx: GestureContext<TPose>): void => {\n let samples = getScratch(ctx.scratch, SAMPLES);\n if (!samples) {\n samples = [];\n setScratch(ctx.scratch, SAMPLES, samples);\n }\n samples.push({\n t: now(),\n x: ctx.pointer.worldX,\n y: ctx.pointer.worldY,\n });\n // Trim anything older than 4× the sample window — bounded memory.\n const cutoff = now() - sampleMs * 4;\n while (samples.length > 1 && samples[0].t < cutoff) samples.shift();\n };\n\n const coasts = new Set<{ ids: readonly string[]; stop(): void }>();\n\n return {\n onStart(ctx) {\n for (const coast of [...coasts]) {\n if (coast.ids.some((id) => ctx.draggedIds.includes(id))) coast.stop();\n }\n setScratch(ctx.scratch, SAMPLES, []);\n recordSample(ctx);\n },\n onMove(ctx) {\n recordSample(ctx);\n },\n onEnd(ctx, end): Op[] | null | void {\n if (end.answered) return undefined;\n const samples = getScratch(ctx.scratch, SAMPLES) ?? [];\n if (samples.length < 2) return undefined;\n const last = samples[samples.length - 1];\n // Find the oldest sample within `sampleMs` of `last`.\n const cutoff = last.t - sampleMs;\n let first = samples[0];\n for (const s of samples) {\n if (s.t >= cutoff) { first = s; break; }\n }\n const dt = (last.t - first.t) / 1000;\n if (dt <= 0) return undefined;\n const vx = (last.x - first.x) / dt;\n const vy = (last.y - first.y) / dt;\n const speed = Math.hypot(vx, vy);\n if (speed < threshold) return undefined;\n\n // Suppress default commit and fire decay. We translate each dragged id\n // by the per-frame delta and commit one transform op per id when done.\n const startPoses = new Map<string, TPose>(ctx.current);\n let lastValue = { x: 0, y: 0 };\n const adapter = ctx.adapter;\n const show = (poses: Map<string, TPose | null>): void => {\n if (adapter.previewPoses) adapter.previewPoses(poses);\n else for (const [id, pose] of poses) if (pose !== null) adapter.setPose(id, pose);\n };\n // What the scene held for each node right after the coast last wrote it.\n // A node that is gone, or reads back as anything else, has another\n // writer now, an undo or a delete, and leaves the coast unrecorded.\n const riding = new Set(ctx.draggedIds);\n const lastSeen = new Map<string, Bounds>();\n for (const id of riding) {\n if (adapter.getNode(id)) lastSeen.set(id, d.getBounds(adapter.getPose(id)));\n }\n const stillOurs = (id: string): boolean => {\n const seen = lastSeen.get(id);\n return seen !== undefined && adapter.getNode(id) !== undefined\n && sameBounds(d.getBounds(adapter.getPose(id)), seen);\n };\n // Track per-id final positions when bounds clamping is active — used\n // by onDone to compute the correct final transform op (not just\n // start + decay's last delta, which may overshoot the boundary).\n const finalPositions = new Map<string, { x: number; y: number }>();\n const cancelKey = `momentum:${nextCoast++}`;\n const coast = {\n ids: ctx.draggedIds.slice(),\n stop: (): void => {\n // Canceled from outside (cancelAll, unmount), it stopped long ago and somewhere else.\n if (!opts.animator.isActive(cancelKey)) {\n coasts.delete(coast);\n return;\n }\n decayHandle.cancel();\n commitFlick();\n },\n };\n coasts.add(coast);\n // Held from the release itself, so no frame paints the pre-drag pose\n // between the drag's preview going away and the first coast frame.\n show(new Map([...riding].flatMap((id) => {\n const start = startPoses.get(id);\n return start === undefined ? [] : [[id, start] as const];\n })));\n const decayHandle = opts.animator.decay<RectLike>({\n from: { x: 0, y: 0 },\n velocity: { x: vx, y: vy },\n friction,\n cancelKey,\n add: (a, b) => ({ x: a.x + b.x, y: a.y + b.y }),\n scale: (v, k) => ({ x: v.x * k, y: v.y * k }),\n magnitude: (v) => Math.hypot(v.x, v.y),\n onTick: (delta) => {\n lastValue = delta;\n let allHit = bounds !== undefined;\n const frame = new Map<string, TPose | null>();\n for (const id of [...riding]) {\n if (!stillOurs(id)) {\n riding.delete(id);\n frame.set(id, null);\n continue;\n }\n const start = startPoses.get(id);\n if (!start) continue;\n const o = d.getBounds(start);\n const { nx, ny, hit } = clampToBounds(o.x, o.y, delta.x, delta.y);\n if (!hit) allHit = false;\n finalPositions.set(id, { x: nx, y: ny });\n frame.set(id, translatePoseViaDescriptor(start, nx - o.x, ny - o.y, d));\n }\n show(frame);\n for (const id of riding) lastSeen.set(id, d.getBounds(adapter.getPose(id)));\n if (riding.size === 0) {\n coasts.delete(coast);\n decayHandle.cancel();\n return;\n }\n // If 'stop' policy and every dragged id's clamped position hit\n // the boundary, cancel the decay so the animation settles instantly\n // instead of drifting along the edge as friction wears off.\n if (boundaryPolicy === 'stop' && allHit) coast.stop();\n },\n onDone: () => {\n commitFlick();\n },\n });\n\n function commitFlick(): void {\n if (!coasts.delete(coast)) return;\n const ops: Op[] = [];\n const shown = new Map<string, TPose | null>();\n for (const id of riding) {\n shown.set(id, null);\n if (!stillOurs(id)) continue;\n const start = startPoses.get(id);\n if (!start) continue;\n const o = d.getBounds(start);\n const fp = finalPositions.get(id) ?? { x: o.x + lastValue.x, y: o.y + lastValue.y };\n const finalPose = translatePoseViaDescriptor(start, fp.x - o.x, fp.y - o.y, d);\n const from = ctx.origin.get(id) ?? start;\n ops.push(createTransformOp<TPose>({ id, from, to: finalPose, label: 'flick' }));\n }\n // The document first, so the preview never gives way to the pre-drag pose.\n if (ops.length > 0) {\n if (adapter.applyOps) adapter.applyOps(ops, 'flick');\n else if (adapter.previewPoses) for (const op of ops) op.apply(adapter);\n }\n adapter.previewPoses?.(shown);\n }\n\n return null;\n },\n };\n}\n"],"mappings":";;;;;AAqDA,IAAMA,KAAc,GAAW,MAC7BC,EAAE,MAAMC,EAAE,KAAKD,EAAE,MAAMC,EAAE,KAAKD,EAAE,UAAUC,EAAE,SAASD,EAAE,WAAWC,EAAE,QAElEC,IAAY,GAEVC,IAAUC,EAA4B,kBAAkB;AAgB9D,SAAgBC,EAAgB,GAA4C;CAC1E,IAAMC,IAAWC,EAAK,YAAY,KAC5BC,IAAYD,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AAC,GACvEoD,IAAOvC,EAAI,OAAO,IAAIK,CAAE,KAAKsB;KACnC,EAAI,KAAKa,EAAyB;MAAE;MAAI;MAAM,IAAIF;MAAW,OAAO;KAAQ,CAAC,CAAC;IAChF;IAEA,IAAIJ,EAAI,SAAS,GAAG;KAClB,IAAInB,EAAQ,UAAU,EAAQ,SAASmB,GAAK,OAAO;UAC9C,IAAInB,EAAQ,cAAc,KAAK,IAAM0B,KAAMP,GAAK,EAAG,MAAMnB,CAAO;IACvE;IACA,EAAQ,eAAeoB,CAAK;GAC9B;GAEA,OAAO;EACT;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"momentum.js","names":["SAMPLES","scratchKey","momentum","friction","opts","threshold","sampleMs","now","AUTO_POSE_DESCRIPTOR","recordSample","samples","getScratch","ctx","setScratch","cutoff","coasts","targetsOf","adapter","targets","id","target","coast","end","last","first","s","dt","vx","vy","args","coastOnTargets","coastByWrite"],"sources":["../../../src/animation/behaviors/momentum.ts"],"sourcesContent":["import type { Op } from 'core/ops/types';\nimport type { MoveBehavior, GestureContext } from 'interactions/gestures/types';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\nimport type { PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport type { Target } from '@weasel-js/animator';\nimport type { Animator } from '@weasel-js/animator';\nimport type { Coast, CoastArgs } from './coast';\nimport { coastByWrite } from './coastByWrite';\nimport { coastOnTargets } from './coastOnTargets';\n\n/** Options for the `momentum` move behavior. */\nexport interface MomentumOptions {\n /** Required: the per-Canvas animator that will own the decay. */\n animator: Animator;\n friction?: number; // default 0.92 (per second)\n threshold?: number; // default 200 world units/sec; the slowest release that coasts\n /** Sample window in ms for velocity computation. Default 80ms. */\n velocitySampleMs?: number;\n /** Optional clock override for tests. Defaults to `Date.now`. */\n now?: () => number;\n /**\n * Optional bounds for the object's top-left corner (in world units): each\n * tick's new position is clamped so the object's `(x, y)` stays inside the\n * rect. Object size is ignored, so to keep an object fully inside, shrink\n * the rect by the object's width and height.\n */\n bounds?: { x: number; y: number; width: number; height: number };\n /**\n * Boundary policy when the clamped position hits an edge. 'stop' settles at\n * the edge at once. 'continue' keeps decaying, so the object drifts along\n * the edge. Default 'stop'.\n */\n boundary?: 'stop' | 'continue';\n /** How to translate poses. Default `AUTO_POSE_DESCRIPTOR`. */\n poseDescriptor?: PoseDescriptor<unknown>;\n}\n\ninterface PointerSample {\n t: number; // ms timestamp\n x: number;\n y: number;\n}\n\nconst SAMPLES = scratchKey<PointerSample[]>('momentum.samples');\n\n/**\n * Move behavior that keeps a dragged node coasting after the pointer is\n * released, at the velocity it was traveling, until friction brings it to\n * rest. A release slower than `threshold` does not coast at all.\n *\n * The whole flick, coast included, records as one undoable transform, written\n * once it comes to rest. Over an adapter with `poseTarget`, which a\n * scene-backed one has, each node coasts on its own pose target, so anything\n * else animating it adds; over one without, the coast is shown through\n * `previewPoses`, or written through `setPose` each frame. Dragging a node\n * again while it coasts stops the coast and records it where it stands. A\n * `tweenPose` or `springPose` of a coasting node ends its coast. A node\n * something else moves or deletes mid-coast, an undo included, drops out of\n * the coast where that left it, and nothing is recorded for it.\n */\nexport function momentum<TPose>(opts: MomentumOptions): MoveBehavior<TPose> {\n const friction = opts.friction ?? 0.92;\n const threshold = opts.threshold ?? 200;\n const sampleMs = opts.velocitySampleMs ?? 80;\n const now = opts.now ?? (() => Date.now());\n const d = (opts.poseDescriptor ?? AUTO_POSE_DESCRIPTOR) as PoseDescriptor<TPose>;\n\n const recordSample = (ctx: GestureContext<TPose>): void => {\n let samples = getScratch(ctx.scratch, SAMPLES);\n if (!samples) {\n samples = [];\n setScratch(ctx.scratch, SAMPLES, samples);\n }\n samples.push({\n t: now(),\n x: ctx.pointer.worldX,\n y: ctx.pointer.worldY,\n });\n // Trim anything older than 4× the sample window — bounded memory.\n const cutoff = now() - sampleMs * 4;\n while (samples.length > 1 && samples[0].t < cutoff) samples.shift();\n };\n\n const coasts = new Set<Coast>();\n\n /** Every dragged node's pose target, or null where the adapter has none for one of them. */\n const targetsOf = (ctx: GestureContext<TPose>): Map<string, Target<TPose>> | null => {\n const { adapter } = ctx;\n if (!adapter.poseTarget) return null;\n const targets = new Map<string, Target<TPose>>();\n for (const id of ctx.draggedIds) {\n if (!ctx.current.has(id)) continue;\n const target = adapter.getNode(id) && adapter.poseTarget(id, opts.poseDescriptor as PoseDescriptor<TPose> | undefined);\n if (!target) return null;\n targets.set(id, target);\n }\n return targets;\n };\n\n return {\n onStart(ctx) {\n for (const coast of [...coasts]) {\n if (coast.ids.some((id) => ctx.draggedIds.includes(id))) coast.stop();\n }\n setScratch(ctx.scratch, SAMPLES, []);\n recordSample(ctx);\n },\n onMove(ctx) {\n recordSample(ctx);\n },\n onEnd(ctx, end): Op[] | null | void {\n if (end.answered) return undefined;\n const samples = getScratch(ctx.scratch, SAMPLES) ?? [];\n if (samples.length < 2) return undefined;\n const last = samples[samples.length - 1];\n // Find the oldest sample within `sampleMs` of `last`.\n const cutoff = last.t - sampleMs;\n let first = samples[0];\n for (const s of samples) {\n if (s.t >= cutoff) { first = s; break; }\n }\n const dt = (last.t - first.t) / 1000;\n if (dt <= 0) return undefined;\n const vx = (last.x - first.x) / dt;\n const vy = (last.y - first.y) / dt;\n if (Math.hypot(vx, vy) < threshold) return undefined;\n\n const args: CoastArgs<TPose> = {\n animator: opts.animator, ctx, vx, vy, friction, d, coasts,\n bounds: opts.bounds, boundary: opts.boundary ?? 'stop',\n };\n const targets = targetsOf(ctx);\n if (targets) coastOnTargets(args, targets);\n else coastByWrite(args);\n // The coast commits the flick itself, so the move action's own commit is suppressed.\n return null;\n },\n };\n}\n"],"mappings":";;;;;AA4CA,IAAMA,IAAUC,EAA4B,kBAAkB;AAiB9D,SAAgBC,EAAgB,GAA4C;CAC1E,IAAMC,IAAWC,EAAK,YAAY,KAC5BC,IAAYD,EAAK,aAAa,KAC9BE,IAAWF,EAAK,oBAAoB,IACpCG,I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,EAAQ,SAAS,GAAG;GACxB,IAAMa,IAAOb,EAAQA,EAAQ,SAAS,IAEhCI,IAASS,EAAK,IAAIjB,GACpBkB,IAAQd,EAAQ;GACpB,KAAK,IAAMe,KAAKf,GACd,IAAIe,EAAE,KAAKX,GAAQ;IAAE,IAAQW;IAAG;GAAO;GAEzC,IAAMC,KAAMH,EAAK,IAAIC,EAAM,KAAK;GAChC,IAAIE,KAAM,GAAG;GACb,IAAMC,KAAMJ,EAAK,IAAIC,EAAM,KAAKE,GAC1BE,KAAML,EAAK,IAAIC,EAAM,KAAKE;GAChC,IAAI,KAAK,MAAMC,GAAIC,CAAE,IAAIvB,GAAW;GAEpC,IAAMwB,IAAyB;IAC7B,UAAUzB,EAAK;IAAU;IAAK;IAAI;IAAI;IAAU;IAAG;IACnD,QAAQA,EAAK;IAAQ,UAAUA,EAAK,YAAY;GAClD,GACMc,IAAUF,EAAUJ,CAAG;GAI7B,OAHIM,IAASY,EAAeD,GAAMX,CAAO,IACpCa,EAAaF,CAAI,GAEf;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { scenePoseTarget as e } from "./poseTarget.js";
|
|
2
|
+
//#region src/animation/clipTargets.ts
|
|
3
|
+
function t(t, n = {}) {
|
|
4
|
+
return (r) => {
|
|
5
|
+
if (r.startsWith("pose:")) return e(t, r.slice(5), n.descriptor, n.cascade);
|
|
6
|
+
if (r.startsWith("rig:")) return n.rigs?.[r.slice(4)]?.target;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as sceneClipTargets };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=clipTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipTargets.js","names":["sceneClipTargets","name","scenePoseTarget","scene","options"],"sources":["../../src/animation/clipTargets.ts"],"sourcesContent":["import type { ClipBinder, Pose, Target } from '@weasel-js/animator';\nimport type { PoseDescriptor } from '../core/geometry/poseDescriptor';\nimport { scenePoseTarget, type PoseCascade, type PoseTargetScene } from './poseTarget';\n\n/** Options for `sceneClipTargets`. */\nexport interface SceneClipTargetsOptions<TPose> {\n /** Rigs by the name a clip calls them: a track naming `rig:<name>` moves that rig's pose. */\n rigs?: Readonly<Record<string, { readonly target: Target<Pose> }>>;\n /** As `scenePoseTarget` takes them. */\n descriptor?: PoseDescriptor<TPose>;\n cascade?: PoseCascade<TPose>;\n}\n\n/**\n * A `ClipBinder.target` over a scene. `pose:<node id>` is that node's pose target, the one\n * `scenePoseTarget` answers, and `rig:<name>` is the target of the rig given under that\n * name. Any other name is `undefined`, for a caller to resolve itself first or after. A track\n * over part of a rig names joints as its `axes`, which the rig's target resolves.\n */\nexport function sceneClipTargets<TPose>(\n scene: PoseTargetScene<TPose>,\n options: SceneClipTargetsOptions<TPose> = {},\n): NonNullable<ClipBinder['target']> {\n return (name) => {\n if (name.startsWith('pose:')) return scenePoseTarget(scene, name.slice(5), options.descriptor, options.cascade);\n if (name.startsWith('rig:')) return options.rigs?.[name.slice(4)]?.target;\n return undefined;\n };\n}\n"],"mappings":";;AAmBA,SAAgBA,EACd,GACA,IAA0C,CAAC,GACR;CACnC,QAAQ,MAAS;EACf,IAAIC,EAAK,WAAW,OAAO,GAAG,OAAOC,EAAgBC,GAAOF,EAAK,MAAM,CAAC,GAAGG,EAAQ,YAAYA,EAAQ,OAAO;EAC9G,IAAIH,EAAK,WAAW,MAAM,GAAG,OAAOG,EAAQ,OAAOH,EAAK,MAAM,CAAC,EAAE,EAAE;CAErE;AACF"}
|
package/dist/animation/index.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { solveIk as w } from "./rig/solveIk.js";
|
|
17
|
-
import { useRig as T } from "./rig/useRig.js";
|
|
18
|
-
import { hexToOklchDeg as E, hslToSrgb as D, interpolateSrgb as O, lerpColorArray as k, lerpOklab as A, lerpOklch as j, linearSrgbToOklab as M, linearToSrgb as N, oklabToLinearSrgb as P, oklabToOklch as F, oklabToSrgbU8 as I, oklchDegToHex as L, oklchToOklab as R, srgbFloatToOklab as z, srgbToHsl as B, srgbToLinear as V, srgbU8ToOklab as H } from "@weasel-js/paint";
|
|
19
|
-
import { EASINGS as U, SPRING_PRESETS as W, cubicBezierEasing as G, easeIn as K, easeInBack as q, easeInBounce as J, easeInCirc as Y, easeInCubic as X, easeInElastic as Z, easeInExpo as Q, easeInOut as $, easeInOutBack as ee, easeInOutBounce as te, easeInOutCirc as ne, easeInOutCubic as re, easeInOutElastic as ie, easeInOutExpo as ae, easeInOutQuad as oe, easeInOutQuart as se, easeInOutQuint as ce, easeInOutSine as le, easeInQuad as ue, easeInQuart as de, easeInQuint as fe, easeInSine as pe, easeOut as me, easeOutBack as he, easeOutBounce as ge, easeOutCirc as _e, easeOutCubic as ve, easeOutElastic as ye, easeOutExpo as be, easeOutQuad as xe, easeOutQuart as Se, easeOutQuint as Ce, easeOutSine as we, linear as Te, resolveEasing as Ee } from "@weasel-js/geom";
|
|
20
|
-
export { r as ColorOverrideRegistry, U as EASINGS, v as IDENTITY_JOINT, W as SPRING_PRESETS, o as animateLifecycle, a as animateOnSetPose, S as bindRig, y as blendPoses, s as createReflowTransition, u as createSlew, G as cubicBezierEasing, f as cycleVertexColors, K as easeIn, q as easeInBack, J as easeInBounce, Y as easeInCirc, X as easeInCubic, Z as easeInElastic, Q as easeInExpo, $ as easeInOut, ee as easeInOutBack, te as easeInOutBounce, ne as easeInOutCirc, re as easeInOutCubic, ie as easeInOutElastic, ae as easeInOutExpo, oe as easeInOutQuad, se as easeInOutQuart, ce as easeInOutQuint, le as easeInOutSine, ue as easeInQuad, de as easeInQuart, fe as easeInQuint, pe as easeInSine, me as easeOut, he as easeOutBack, ge as easeOutBounce, _e as easeOutCirc, ve as easeOutCubic, ye as easeOutElastic, be as easeOutExpo, xe as easeOutQuad, Se as easeOutQuart, Ce as easeOutQuint, we as easeOutSine, E as hexToOklchDeg, D as hslToSrgb, O as interpolateSrgb, k as lerpColorArray, A as lerpOklab, j as lerpOklch, Te as linear, M as linearSrgbToOklab, N as linearToSrgb, b as mirrorPose, l as momentum, P as oklabToLinearSrgb, F as oklabToOklch, I as oklabToSrgbU8, L as oklchDegToHex, R as oklchToOklab, p as rainbowVertexColors, Ee as resolveEasing, x as resolveSkeleton, C as rigidRigApply, n as sampleTrack, d as slewToward, m as solidVertexColors, w as solveIk, e as springPose, h as springVertexColors, z as srgbFloatToOklab, B as srgbToHsl, V as srgbToLinear, H as srgbU8ToOklab, g as staggerVertexColors, t as tweenPose, _ as tweenVertexColors, c as useAnimatedReflow, i as useAnimator, T as useRig };
|
|
1
|
+
import { createPoseTarget as e, poseAxes as t, scenePoseTarget as n } from "./poseTarget.js";
|
|
2
|
+
import { dataRestPath as r } from "./rig/skinBinding.js";
|
|
3
|
+
import { bindRig as i, rigidRigApply as a } from "./rig/bindRig.js";
|
|
4
|
+
import { useRig as o } from "./rig/useRig.js";
|
|
5
|
+
import { placeSkeleton as s, rigFromNode as c, unplaceSkeleton as l, useRigNode as u } from "./rig/rigNode.js";
|
|
6
|
+
import { createWrittenPoseTarget as d } from "./writtenPoseTarget.js";
|
|
7
|
+
import { sceneClipTargets as f } from "./clipTargets.js";
|
|
8
|
+
import { springPose as p, staggerSpringPose as m, tweenPose as h } from "./poseHelpers.js";
|
|
9
|
+
import { animateOnSetPose as g } from "./wrappers/animateOnSetPose.js";
|
|
10
|
+
import { animateLifecycle as _ } from "./wrappers/animateLifecycle.js";
|
|
11
|
+
import { createReflowTransition as v, useAnimatedReflow as y } from "./reflow.js";
|
|
12
|
+
import { momentum as b } from "./behaviors/momentum.js";
|
|
13
|
+
import { EASINGS as x, SPRING_PRESETS as S, cubicBezierEasing as C, easeIn as w, easeInBack as T, easeInBounce as E, easeInCirc as D, easeInCubic as O, easeInElastic as k, easeInExpo as A, easeInOut as j, easeInOutBack as M, easeInOutBounce as N, easeInOutCirc as P, easeInOutCubic as F, easeInOutElastic as I, easeInOutExpo as L, easeInOutQuad as R, easeInOutQuart as z, easeInOutQuint as B, easeInOutSine as V, easeInQuad as H, easeInQuart as U, easeInQuint as W, easeInSine as G, easeOut as K, easeOutBack as q, easeOutBounce as J, easeOutCirc as Y, easeOutCubic as X, easeOutElastic as Z, easeOutExpo as Q, easeOutQuad as $, easeOutQuart as ee, easeOutQuint as te, easeOutSine as ne, linear as re, resolveEasing as ie } from "@weasel-js/geom";
|
|
14
|
+
import { hexToOklchDeg as ae, hslToSrgb as oe, interpolateSrgb as se, lerpColorArray as ce, lerpOklab as le, lerpOklch as ue, linearSrgbToOklab as de, linearToSrgb as fe, oklabToLinearSrgb as pe, oklabToOklch as me, oklabToSrgbU8 as he, oklchDegToHex as ge, oklchToOklab as _e, srgbFloatToOklab as ve, srgbToHsl as ye, srgbToLinear as be, srgbU8ToOklab as xe } from "@weasel-js/paint";
|
|
15
|
+
export { x as EASINGS, S as SPRING_PRESETS, _ as animateLifecycle, g as animateOnSetPose, i as bindRig, e as createPoseTarget, v as createReflowTransition, d as createWrittenPoseTarget, C as cubicBezierEasing, r as dataRestPath, w as easeIn, T as easeInBack, E as easeInBounce, D as easeInCirc, O as easeInCubic, k as easeInElastic, A as easeInExpo, j as easeInOut, M as easeInOutBack, N as easeInOutBounce, P as easeInOutCirc, F as easeInOutCubic, I as easeInOutElastic, L as easeInOutExpo, R as easeInOutQuad, z as easeInOutQuart, B as easeInOutQuint, V as easeInOutSine, H as easeInQuad, U as easeInQuart, W as easeInQuint, G as easeInSine, K as easeOut, q as easeOutBack, J as easeOutBounce, Y as easeOutCirc, X as easeOutCubic, Z as easeOutElastic, Q as easeOutExpo, $ as easeOutQuad, ee as easeOutQuart, te as easeOutQuint, ne as easeOutSine, ae as hexToOklchDeg, oe as hslToSrgb, se as interpolateSrgb, ce as lerpColorArray, le as lerpOklab, ue as lerpOklch, re as linear, de as linearSrgbToOklab, fe as linearToSrgb, b as momentum, pe as oklabToLinearSrgb, me as oklabToOklch, he as oklabToSrgbU8, ge as oklchDegToHex, _e as oklchToOklab, s as placeSkeleton, t as poseAxes, ie as resolveEasing, c as rigFromNode, a as rigidRigApply, f as sceneClipTargets, n as scenePoseTarget, p as springPose, ve as srgbFloatToOklab, ye as srgbToHsl, be as srgbToLinear, xe as srgbU8ToOklab, m as staggerSpringPose, h as tweenPose, l as unplaceSkeleton, y as useAnimatedReflow, o as useRig, u as useRigNode };
|
|
@@ -1,50 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RECT_POSE_DESCRIPTOR as e } from "../core/geometry/poseDescriptor.js";
|
|
2
|
+
import { createTransformOp as t } from "../core/ops/transform.js";
|
|
3
|
+
import { rewindingSpring as n, rewindingTween as r } from "./rewind.js";
|
|
3
4
|
//#region src/animation/poseHelpers.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
if (!
|
|
7
|
-
let o =
|
|
5
|
+
var i = (e) => `pose:${e}`;
|
|
6
|
+
function a(e, n, r, i, a) {
|
|
7
|
+
if (!e.applyOps) return;
|
|
8
|
+
let o = t({
|
|
8
9
|
id: n,
|
|
9
10
|
from: r,
|
|
10
11
|
to: i,
|
|
11
12
|
label: a
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
+
e.applyOps([o], a);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
let o =
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
function o(t, n, o) {
|
|
17
|
+
let s = o.recordOp ?? !0, c = o.opLabel ?? "animate", l = i(o.id), u = n.poseTarget?.(o.id, o.geometry);
|
|
18
|
+
if (u) {
|
|
19
|
+
let e = u.committed();
|
|
20
|
+
s && a(n, o.id, e, o.to, c);
|
|
21
|
+
let i = o.geometry?.lerp;
|
|
22
|
+
return o.rewind ? r(t, u, {
|
|
23
|
+
start: e,
|
|
24
|
+
from: o.from ?? e,
|
|
25
|
+
to: o.to,
|
|
26
|
+
ms: o.ms,
|
|
27
|
+
easing: o.easing,
|
|
28
|
+
cancelKey: l,
|
|
29
|
+
interpolate: i && ((e, t, n) => i(e, t, n)),
|
|
30
|
+
onDone: o.onDone
|
|
31
|
+
}) : t.tween({
|
|
32
|
+
target: u,
|
|
33
|
+
from: o.from ?? e,
|
|
34
|
+
to: o.to,
|
|
35
|
+
ms: o.ms,
|
|
36
|
+
easing: o.easing,
|
|
37
|
+
cancelKey: l,
|
|
38
|
+
interrupt: !1,
|
|
39
|
+
interpolate: i && ((e, t, n) => i(e, t, n)),
|
|
40
|
+
onDone: o.onDone
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let d = o.geometry ?? e;
|
|
44
|
+
if (!d.lerp) throw Error("tweenPose: geometry has no lerp; supply geometry: { ..., lerp }");
|
|
45
|
+
let f = d.lerp, p = n.getPose(o.id);
|
|
46
|
+
return s && a(n, o.id, p, o.to, c), t.tween({
|
|
47
|
+
from: o.from ?? p,
|
|
48
|
+
to: o.to,
|
|
49
|
+
ms: o.ms,
|
|
50
|
+
easing: o.easing,
|
|
51
|
+
cancelKey: l,
|
|
52
|
+
interpolate: (e, t, n) => f(e, t, n),
|
|
53
|
+
onTick: (e) => n.setPose(o.id, e),
|
|
54
|
+
onDone: o.onDone
|
|
28
55
|
});
|
|
29
56
|
}
|
|
30
|
-
function
|
|
31
|
-
let o =
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
function s(t, r, o) {
|
|
58
|
+
let s = o.recordOp ?? !0, c = o.opLabel ?? "animate", l = i(o.id), u = r.poseTarget?.(o.id, o.geometry);
|
|
59
|
+
if (u) {
|
|
60
|
+
let e = u.read(), i = u.committed();
|
|
61
|
+
return s && a(r, o.id, i, o.to, c), o.rewind ? n(t, u, {
|
|
62
|
+
start: i,
|
|
63
|
+
from: e,
|
|
64
|
+
to: o.to,
|
|
65
|
+
cancelKey: l,
|
|
66
|
+
onDone: o.onDone,
|
|
67
|
+
tuning: {
|
|
68
|
+
preset: o.preset,
|
|
69
|
+
stiffness: o.stiffness,
|
|
70
|
+
damping: o.damping,
|
|
71
|
+
mass: o.mass
|
|
72
|
+
}
|
|
73
|
+
}) : t.spring({
|
|
74
|
+
target: u,
|
|
75
|
+
from: e,
|
|
76
|
+
to: o.to,
|
|
77
|
+
preset: o.preset,
|
|
78
|
+
stiffness: o.stiffness,
|
|
79
|
+
damping: o.damping,
|
|
80
|
+
mass: o.mass,
|
|
81
|
+
cancelKey: l,
|
|
82
|
+
onDone: o.onDone
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
let d = o.geometry ?? e;
|
|
86
|
+
if (!d.lerp) throw Error("springPose: geometry has no lerp; supply geometry: { ..., lerp }");
|
|
87
|
+
let f = d.lerp, p = r.getPose(o.id);
|
|
88
|
+
return s && a(r, o.id, p, o.to, c), t.spring({
|
|
35
89
|
from: 0,
|
|
36
90
|
to: 1,
|
|
37
|
-
preset:
|
|
38
|
-
stiffness:
|
|
39
|
-
damping:
|
|
40
|
-
mass:
|
|
41
|
-
cancelKey:
|
|
91
|
+
preset: o.preset,
|
|
92
|
+
stiffness: o.stiffness,
|
|
93
|
+
damping: o.damping,
|
|
94
|
+
mass: o.mass,
|
|
95
|
+
cancelKey: l,
|
|
42
96
|
interpolate: (e, t, n) => e + (t - e) * n,
|
|
43
|
-
onTick: (e) =>
|
|
44
|
-
onDone:
|
|
97
|
+
onTick: (e) => r.setPose(o.id, f(p, o.to, e)),
|
|
98
|
+
onDone: o.onDone
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function c(e) {
|
|
102
|
+
if (typeof e == "object" && e && "id" in e) {
|
|
103
|
+
let t = e.id;
|
|
104
|
+
if (typeof t == "string") return t;
|
|
105
|
+
}
|
|
106
|
+
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
107
|
+
throw Error("staggerSpringPose: each item must either be a primitive (string/number) or have a string `id` field. Otherwise pose ids would collide.");
|
|
108
|
+
}
|
|
109
|
+
function l(e, t, n) {
|
|
110
|
+
return e.stagger(n.items, n.delay).each((r, i) => s(e, t, {
|
|
111
|
+
id: c(r),
|
|
112
|
+
to: n.to(r, i),
|
|
113
|
+
preset: n.preset,
|
|
114
|
+
stiffness: n.stiffness,
|
|
115
|
+
damping: n.damping,
|
|
116
|
+
mass: n.mass,
|
|
117
|
+
geometry: n.geometry,
|
|
118
|
+
recordOp: n.recordOp,
|
|
119
|
+
opLabel: n.opLabel,
|
|
120
|
+
rewind: n.rewind
|
|
121
|
+
}), {
|
|
122
|
+
cancelKey: n.cancelKey,
|
|
123
|
+
label: n.label
|
|
45
124
|
});
|
|
46
125
|
}
|
|
47
126
|
//#endregion
|
|
48
|
-
export {
|
|
127
|
+
export { i as poseKey, s as springPose, l as staggerSpringPose, o as tweenPose };
|
|
49
128
|
|
|
50
129
|
//# sourceMappingURL=poseHelpers.js.map
|