@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { axisAlignedBounds as e } from "./unionBounds.js";
|
|
2
|
+
import { poseLinearOf as t } from "@weasel-js/geom";
|
|
3
3
|
//#region src/core/geometry/poseDescriptor.ts
|
|
4
4
|
function n(e, t) {
|
|
5
5
|
return e.forNode?.(t) ?? e;
|
|
@@ -34,6 +34,52 @@ var r = {
|
|
|
34
34
|
width: e.width + (t.width - e.width) * n,
|
|
35
35
|
height: e.height + (t.height - e.height) * n
|
|
36
36
|
}),
|
|
37
|
+
axes: (e) => [
|
|
38
|
+
e.x,
|
|
39
|
+
e.y,
|
|
40
|
+
e.width,
|
|
41
|
+
e.height
|
|
42
|
+
].every((e) => typeof e == "number") ? {
|
|
43
|
+
count: 5,
|
|
44
|
+
names: [
|
|
45
|
+
"x",
|
|
46
|
+
"y",
|
|
47
|
+
"width",
|
|
48
|
+
"height",
|
|
49
|
+
"rotation"
|
|
50
|
+
],
|
|
51
|
+
angles: [4],
|
|
52
|
+
to: (e) => [
|
|
53
|
+
e.x,
|
|
54
|
+
e.y,
|
|
55
|
+
e.width,
|
|
56
|
+
e.height,
|
|
57
|
+
e.rotation ?? 0
|
|
58
|
+
],
|
|
59
|
+
from: (t) => {
|
|
60
|
+
let n = {
|
|
61
|
+
...e,
|
|
62
|
+
x: t[0],
|
|
63
|
+
y: t[1],
|
|
64
|
+
width: t[2],
|
|
65
|
+
height: t[3]
|
|
66
|
+
};
|
|
67
|
+
return (e.rotation !== void 0 || t[4] !== 0) && (n.rotation = t[4]), n;
|
|
68
|
+
},
|
|
69
|
+
add: (e, t) => {
|
|
70
|
+
let n = {
|
|
71
|
+
...e,
|
|
72
|
+
x: e.x + t[0],
|
|
73
|
+
y: e.y + t[1],
|
|
74
|
+
width: e.width + t[2],
|
|
75
|
+
height: e.height + t[3]
|
|
76
|
+
}, r = (e.rotation ?? 0) + t[4];
|
|
77
|
+
return (e.rotation !== void 0 || r !== 0) && (n.rotation = r), n;
|
|
78
|
+
},
|
|
79
|
+
write: (e, t, n) => {
|
|
80
|
+
t[n] = e.x, t[n + 1] = e.y, t[n + 2] = e.width, t[n + 3] = e.height, t[n + 4] = e.rotation ?? 0;
|
|
81
|
+
}
|
|
82
|
+
} : null,
|
|
37
83
|
getRotation: (e) => e.rotation ?? 0,
|
|
38
84
|
withRotation: (e, t) => ({
|
|
39
85
|
...e,
|
|
@@ -44,6 +90,7 @@ var r = {
|
|
|
44
90
|
remapBounds: r.remapBounds,
|
|
45
91
|
translate: r.translate,
|
|
46
92
|
lerp: r.lerp,
|
|
93
|
+
axes: r.axes,
|
|
47
94
|
fromBounds: (e) => ({
|
|
48
95
|
x: e.x,
|
|
49
96
|
y: e.y,
|
|
@@ -68,18 +115,18 @@ function a(e, t, n) {
|
|
|
68
115
|
rotation: m
|
|
69
116
|
};
|
|
70
117
|
}
|
|
71
|
-
function o(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rotation:
|
|
79
|
-
transform:
|
|
80
|
-
}
|
|
118
|
+
function o(t, n) {
|
|
119
|
+
return e(s(t, n));
|
|
120
|
+
}
|
|
121
|
+
function s(e, n) {
|
|
122
|
+
let r = n.getBounds(e), i = n.getRotation?.(e) ?? r.rotation ?? 0, a = t(e) ?? t(r);
|
|
123
|
+
return !i && !a ? r : {
|
|
124
|
+
...r,
|
|
125
|
+
...i ? { rotation: i } : {},
|
|
126
|
+
...a ? { transform: a } : {}
|
|
127
|
+
};
|
|
81
128
|
}
|
|
82
|
-
function
|
|
129
|
+
function c(e, t, n, r) {
|
|
83
130
|
if (r.translate) return r.translate(e, t, n);
|
|
84
131
|
let i = r.getBounds(e), a = {
|
|
85
132
|
x: i.x + t,
|
|
@@ -90,6 +137,6 @@ function s(e, t, n, r) {
|
|
|
90
137
|
return r.remapBounds(e, i, a);
|
|
91
138
|
}
|
|
92
139
|
//#endregion
|
|
93
|
-
export { r as RECT_POSE_DESCRIPTOR, i as ROTATED_POSE_DESCRIPTOR, n as poseDescriptorForNode, a as remapRotatedLeaf,
|
|
140
|
+
export { r as RECT_POSE_DESCRIPTOR, i as ROTATED_POSE_DESCRIPTOR, s as framedBounds, n as poseDescriptorForNode, a as remapRotatedLeaf, c as translatePoseViaDescriptor, o as visualBoundsViaDescriptor };
|
|
94
141
|
|
|
95
142
|
//# sourceMappingURL=poseDescriptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poseDescriptor.js","names":["poseDescriptorForNode","descriptor","node","RECT_POSE_DESCRIPTOR","p","sx","src","dst","sy","b","dx","dy","a","t","ROTATED_POSE_DESCRIPTOR","remapRotatedLeaf","theta","pose","cos","sin","ux","uy","vx","vy","width","height","rotation","cxNew","cyNew","visualBoundsViaDescriptor","geometry","transform","poseLinearOf","axisAlignedBounds","translatePoseViaDescriptor"],"sources":["../../../src/core/geometry/poseDescriptor.ts"],"sourcesContent":["import type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\nimport { poseLinearOf } from 'core/geometry/poseFrame';\n\n/** `Bounds` with a required rotation angle (radians). Pivot is the AABB\n * center of the unrotated `{x, y, width, height}`. */\nexport interface RotatedPose extends Bounds {\n rotation: number;\n}\n\n/**\n * Bridges arbitrary `TPose` shapes into the resize hook's bounds-driven math.\n * The hook reads bounds via `getBounds`, runs anchor-relative math on those\n * bounds, then asks `remapBounds` to project the result back into TPose.\n *\n * `remapBounds(pose, src, dst)` is a single operation that subsumes both\n * \"set my own AABB to dst\" (single-leaf resize) and \"scale me as a leaf\n * inside parent's src→dst rect\" (group resize) — they're the same affine\n * map. For rect-shaped poses the default geometry interprets the pose as\n * its own bounds; for Path or polygon poses the consumer supplies a\n * projection that knows how to read and rewrite the underlying geometry.\n */\nexport interface PoseDescriptor<TPose, TNode = unknown> {\n getBounds(pose: TPose): Bounds;\n remapBounds(pose: TPose, src: Bounds, dst: Bounds): TPose;\n /** A pose occupying `bounds`, of the same kind as `template`. Unlike\n * `remapBounds`, the result carries none of the template's shape. */\n fromBounds(bounds: Bounds, template: TPose): TPose;\n /** Translate the pose by (dx, dy). Optional — when omitted, callers fall\n * back to a translation derived from `remapBounds` (origin shifted, no\n * scale). Path-shaped poses should provide this for performance. */\n translate?(pose: TPose, dx: number, dy: number): TPose;\n /** Interpolate between two poses. Optional — animation helpers fall back to\n * rect-shape lerp when omitted (which fails for non-rect poses). */\n lerp?(a: TPose, b: TPose, t: number): TPose;\n /** Read the pose's rotation in radians. Pivot is the AABB center\n * (`getBounds(pose)` center). Default 0 when omitted — descriptor\n * declares \"this pose has no rotation.\" When supplied and non-zero,\n * `useResize` projects the drag delta into the leaf's local frame,\n * runs anchor math there, and translates the resulting pose so the\n * diagonally opposite world-space corner is pinned. */\n getRotation?(pose: TPose): number;\n /** True iff this pose shape can carry a rotation. Consulted by the\n * rotation affordance to decide whether to render the rotate cursor /\n * drag-band over a selection. When omitted, the kit assumes `true` for\n * back-compat — descriptors whose poses lack `x/y/width/height/rotation`\n * fields (e.g. polygon Paths) should return `false` so the affordance\n * hides instead of exposing a non-functional rotate cursor. */\n supportsRotation?(pose: TPose): boolean;\n /** Write a rotation (radians) into the pose, bounds unchanged. Absent means\n * the pose cannot carry one, and the rotate action leaves it alone. */\n withRotation?(pose: TPose, rotation: number): TPose;\n /**\n * A descriptor specialized to one node. Every other method here sees only\n * the pose, so shapes sharing a pose type — a sphere and a box both posed by\n * position/rotation/scale — are indistinguishable to them. Implement this to\n * read `node.data` once and hand back a descriptor that knows which shape it\n * is describing.\n *\n * Callers reach it through {@link poseDescriptorForNode}, at whichever site\n * holds the node; the specialized descriptor then travels into the bounds and\n * hit-test helpers in place of this one. Sites with only an id keep using the\n * unspecialized descriptor, which is why this is optional on both ends.\n */\n forNode?(node: TNode): PoseDescriptor<TPose, TNode>;\n}\n\n/** The descriptor `node` should be read through: its own specialization when\n * it declares one, and otherwise the descriptor unchanged. */\nexport function poseDescriptorForNode<TPose, TNode>(\n descriptor: PoseDescriptor<TPose, TNode>,\n node: TNode,\n): PoseDescriptor<TPose, TNode> {\n return descriptor.forNode?.(node) ?? descriptor;\n}\n\n/** Identity geometry for `TPose extends Bounds`. Treats the pose as its\n * own bounds and remaps via affine scale against `src`/`dst`. */\nexport const RECT_POSE_DESCRIPTOR: PoseDescriptor<Bounds> = {\n getBounds: (p) => p,\n remapBounds: (p, src, dst) => {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n return {\n ...p,\n x: dst.x + (p.x - src.x) * sx,\n y: dst.y + (p.y - src.y) * sy,\n width: p.width * sx,\n height: p.height * sy,\n };\n },\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height }),\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n lerp: (a, b, t) => ({\n ...a,\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n }),\n // `Bounds` carries an optional `rotation`, and `withRotation` writes into\n // it — so reading it back has to be the same channel, or a pose reports\n // itself unrotated to `useResize` and to port placement while painting\n // rotated.\n getRotation: (p) => p.rotation ?? 0,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/** Identity geometry for `RotatedPose`. Inherits rect-shape projection\n * from `RECT_POSE_DESCRIPTOR` (the `RotatedPose extends Bounds`\n * subtype lets the rect descriptor's methods apply directly; `remapBounds`\n * preserves the `rotation` field via `...p` spread). Adds `getRotation` so\n * `useResize` knows to take the rotation-aware math path. */\nexport const ROTATED_POSE_DESCRIPTOR: PoseDescriptor<RotatedPose> = {\n getBounds: RECT_POSE_DESCRIPTOR.getBounds as PoseDescriptor<RotatedPose>['getBounds'],\n remapBounds: RECT_POSE_DESCRIPTOR.remapBounds as PoseDescriptor<RotatedPose>['remapBounds'],\n translate: RECT_POSE_DESCRIPTOR.translate as PoseDescriptor<RotatedPose>['translate'],\n lerp: RECT_POSE_DESCRIPTOR.lerp as PoseDescriptor<RotatedPose>['lerp'],\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height, rotation: 0 }),\n getRotation: (p) => p.rotation,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/**\n * Remap a **rotated** leaf inside a group resize.\n *\n * The naive `remapBounds` scales a leaf's axis-aligned `width`/`height` by the\n * group's per-axis factors and carries `rotation` through untouched. That is\n * right when `src`/`dst` are already expressed in the leaf's own frame — the\n * single-leaf resize path, where the drag delta was projected into that frame\n * before the anchor math ran. In a group resize they are world-frame, so the\n * leaf's local axes do not line up with the axes being scaled: at 90° a\n * horizontal stretch should grow the leaf's `height`, and the naive map grows\n * its `width`.\n *\n * What this computes is the group affine applied to the leaf's local frame,\n * with the shear dropped — the pose model is `{x, y, width, height, rotation}`\n * and cannot represent the parallelogram a non-uniform scale of a rotated box\n * actually produces. The center moves exactly; each local axis takes the\n * length of its own image; the rotation follows the image of the local x-axis.\n *\n * Degenerates to the naive map at `rotation === 0`, and to a plain uniform\n * scale when `sx === sy`, both exactly.\n */\nexport function remapRotatedLeaf<TPose extends RotatedPose>(\n pose: TPose,\n src: Bounds,\n dst: Bounds,\n): TPose {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n const theta = pose.rotation ?? 0;\n const cos = Math.cos(theta);\n const sin = Math.sin(theta);\n\n // Images of the leaf's local unit axes under the group's diagonal scale.\n const ux = sx * cos, uy = sy * sin;\n const vx = -sx * sin, vy = sy * cos;\n\n const width = pose.width * Math.hypot(ux, uy);\n const height = pose.height * Math.hypot(vx, vy);\n const rotation = Math.atan2(uy, ux);\n\n // The center is a point, so it takes the group affine directly.\n const cxNew = dst.x + (pose.x + pose.width / 2 - src.x) * sx;\n const cyNew = dst.y + (pose.y + pose.height / 2 - src.y) * sy;\n\n return {\n ...pose,\n x: cxNew - width / 2,\n y: cyNew - height / 2,\n width,\n height,\n rotation,\n };\n}\n\n/** The pose's visual bounds: its box expanded to cover the box as drawn\n * under its rotation and `transform`, so a turned or skewed shape reports\n * the extent of its ink. */\nexport function visualBoundsViaDescriptor<TPose>(\n pose: TPose,\n geometry: PoseDescriptor<TPose>,\n): Bounds {\n const b = geometry.getBounds(pose);\n const rotation =\n geometry.getRotation?.(pose) ?? (b as { rotation?: number }).rotation ?? 0;\n const transform = poseLinearOf(pose) ?? undefined;\n return axisAlignedBounds({ x: b.x, y: b.y, width: b.width, height: b.height, rotation, transform });\n}\n\n/** Translate through `geometry.translate`, or via `remapBounds` onto a shifted\n * copy of the pose's own bounds when the descriptor has none. */\nexport function translatePoseViaDescriptor<TPose>(\n pose: TPose,\n dx: number,\n dy: number,\n geometry: PoseDescriptor<TPose>,\n): TPose {\n if (geometry.translate) return geometry.translate(pose, dx, dy);\n const src = geometry.getBounds(pose);\n const dst = { x: src.x + dx, y: src.y + dy, width: src.width, height: src.height };\n return geometry.remapBounds(pose, src, dst);\n}\n"],"mappings":";;;AAqEA,SAAgBA,EACd,GACA,GAC8B;CAC9B,OAAOC,EAAW,UAAUC,CAAI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AI,IAAII;EAAI,GAAGJ,EAAI,IAAIK;EAAI,OAAOL,EAAI;EAAO,QAAQA,EAAI;CAAO;CACjF,OAAOwB,EAAS,YAAYb,GAAMX,GAAKC,CAAG;AAC5C"}
|
|
1
|
+
{"version":3,"file":"poseDescriptor.js","names":["poseDescriptorForNode","descriptor","node","RECT_POSE_DESCRIPTOR","p","sx","src","dst","sy","b","dx","dy","a","t","like","n","pose","d","rotation","at","ROTATED_POSE_DESCRIPTOR","remapRotatedLeaf","theta","cos","sin","ux","uy","vx","vy","width","height","cxNew","cyNew","visualBoundsViaDescriptor","axisAlignedBounds","framedBounds","geometry","transform","poseLinearOf","translatePoseViaDescriptor"],"sources":["../../../src/core/geometry/poseDescriptor.ts"],"sourcesContent":["import type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\nimport { poseLinearOf } from '@weasel-js/geom';\nimport type { TargetAxes } from '@weasel-js/animator';\n\n/** `Bounds` with a required rotation angle (radians). Pivot is the AABB\n * center of the unrotated `{x, y, width, height}`. */\nexport interface RotatedPose extends Bounds {\n rotation: number;\n}\n\n/**\n * Bridges arbitrary `TPose` shapes into the kit's bounds-driven math: bounds\n * are read via `getBounds`, and `remapBounds` projects a result back into\n * TPose.\n *\n * `remapBounds(pose, src, dst)` subsumes both \"set my own AABB to dst\"\n * (single-leaf resize) and \"scale me as a leaf inside parent's src→dst rect\"\n * (group resize) — they're the same affine map.\n */\nexport interface PoseDescriptor<TPose, TNode = unknown> {\n getBounds(pose: TPose): Bounds;\n remapBounds(pose: TPose, src: Bounds, dst: Bounds): TPose;\n /** A pose occupying `bounds`, of the same kind as `template`. Unlike\n * `remapBounds`, the result carries none of the template's shape. */\n fromBounds(bounds: Bounds, template: TPose): TPose;\n /** Translate the pose by (dx, dy). Optional — when omitted, callers fall\n * back to a translation derived from `remapBounds` (origin shifted, no\n * scale). Path-shaped poses should provide this for performance. */\n translate?(pose: TPose, dx: number, dy: number): TPose;\n /** Interpolate between two poses. Optional — animation helpers fall back to\n * rect-shape lerp when omitted (which fails for non-rect poses). */\n lerp?(a: TPose, b: TPose, t: number): TPose;\n /** How a pose of `like`'s kind maps to the flat numbers an animation moves, and which of them\n * are angles. `from` keeps the fields of `like` that are not axes. Null for a pose this\n * descriptor cannot map; absent, a pose animates by its flat numeric fields. */\n axes?(like: TPose): TargetAxes<TPose> | null;\n /** Read the pose's rotation in radians. Pivot is the AABB center\n * (`getBounds(pose)` center). Default 0 when omitted. */\n getRotation?(pose: TPose): number;\n /** True iff this pose shape can carry a rotation; the rotation affordance\n * hides when it is `false`. When omitted, the kit assumes `true`, so a\n * descriptor whose poses cannot rotate (e.g. polygon Paths) should\n * return `false`. */\n supportsRotation?(pose: TPose): boolean;\n /** Write a rotation (radians) into the pose, bounds unchanged. Absent means\n * the pose cannot carry one, and the rotate action leaves it alone. */\n withRotation?(pose: TPose, rotation: number): TPose;\n /**\n * A descriptor specialized to one node. Every other method here sees only\n * the pose, so shapes sharing a pose type are indistinguishable to them.\n * Implement this to read `node.data` once and hand back a descriptor that\n * knows which shape it is describing. Callers reach it through\n * {@link poseDescriptorForNode}; sites with only an id keep using the\n * unspecialized descriptor.\n */\n forNode?(node: TNode): PoseDescriptor<TPose, TNode>;\n}\n\n/** The descriptor `node` should be read through: its own specialization when\n * it declares one, and otherwise the descriptor unchanged. */\nexport function poseDescriptorForNode<TPose, TNode>(\n descriptor: PoseDescriptor<TPose, TNode>,\n node: TNode,\n): PoseDescriptor<TPose, TNode> {\n return descriptor.forNode?.(node) ?? descriptor;\n}\n\n/** Identity geometry for `TPose extends Bounds`. Treats the pose as its\n * own bounds and remaps via affine scale against `src`/`dst`. */\nexport const RECT_POSE_DESCRIPTOR: PoseDescriptor<Bounds> = {\n getBounds: (p) => p,\n remapBounds: (p, src, dst) => {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n return {\n ...p,\n x: dst.x + (p.x - src.x) * sx,\n y: dst.y + (p.y - src.y) * sy,\n width: p.width * sx,\n height: p.height * sy,\n };\n },\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height }),\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n lerp: (a, b, t) => ({\n ...a,\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n }),\n axes: (like) => {\n const flat = [like.x, like.y, like.width, like.height];\n if (!flat.every((n) => typeof n === 'number')) return null;\n return {\n count: 5,\n names: ['x', 'y', 'width', 'height', 'rotation'],\n angles: [4],\n to: (p) => [p.x, p.y, p.width, p.height, p.rotation ?? 0],\n from: (a) => {\n const pose = { ...like, x: a[0]!, y: a[1]!, width: a[2]!, height: a[3]! };\n if (like.rotation !== undefined || a[4] !== 0) pose.rotation = a[4]!;\n return pose;\n },\n add: (p, d) => {\n const pose = { ...p, x: p.x + d[0]!, y: p.y + d[1]!, width: p.width + d[2]!, height: p.height + d[3]! };\n const rotation = (p.rotation ?? 0) + d[4]!;\n if (p.rotation !== undefined || rotation !== 0) pose.rotation = rotation;\n return pose;\n },\n write: (p, out, at) => {\n out[at] = p.x;\n out[at + 1] = p.y;\n out[at + 2] = p.width;\n out[at + 3] = p.height;\n out[at + 4] = p.rotation ?? 0;\n },\n };\n },\n // `withRotation` writes into `Bounds`' optional `rotation`, so this reads\n // the same channel, or a pose reports itself unrotated while painting rotated.\n getRotation: (p) => p.rotation ?? 0,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/** Identity geometry for `RotatedPose`: `RECT_POSE_DESCRIPTOR`'s projection,\n * with a required `rotation`. */\nexport const ROTATED_POSE_DESCRIPTOR: PoseDescriptor<RotatedPose> = {\n getBounds: RECT_POSE_DESCRIPTOR.getBounds as PoseDescriptor<RotatedPose>['getBounds'],\n remapBounds: RECT_POSE_DESCRIPTOR.remapBounds as PoseDescriptor<RotatedPose>['remapBounds'],\n translate: RECT_POSE_DESCRIPTOR.translate as PoseDescriptor<RotatedPose>['translate'],\n lerp: RECT_POSE_DESCRIPTOR.lerp as PoseDescriptor<RotatedPose>['lerp'],\n axes: RECT_POSE_DESCRIPTOR.axes as PoseDescriptor<RotatedPose>['axes'],\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height, rotation: 0 }),\n getRotation: (p) => p.rotation,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/**\n * Remap a **rotated** leaf inside a group resize.\n *\n * The naive `remapBounds` scales a leaf's axis-aligned `width`/`height` by the\n * group's per-axis factors and carries `rotation` through untouched. That is\n * right when `src`/`dst` are expressed in the leaf's own frame. In a group\n * resize they are world-frame: at 90° a horizontal stretch should grow the\n * leaf's `height`, and the naive map grows its `width`.\n *\n * What this computes is the group affine applied to the leaf's local frame,\n * with the shear dropped — the pose model cannot represent the parallelogram\n * a non-uniform scale of a rotated box produces. The center moves exactly;\n * each local axis takes the length of its own image; the rotation follows the\n * image of the local x-axis.\n */\nexport function remapRotatedLeaf<TPose extends RotatedPose>(\n pose: TPose,\n src: Bounds,\n dst: Bounds,\n): TPose {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n const theta = pose.rotation ?? 0;\n const cos = Math.cos(theta);\n const sin = Math.sin(theta);\n\n // Images of the leaf's local unit axes under the group's diagonal scale.\n const ux = sx * cos, uy = sy * sin;\n const vx = -sx * sin, vy = sy * cos;\n\n const width = pose.width * Math.hypot(ux, uy);\n const height = pose.height * Math.hypot(vx, vy);\n const rotation = Math.atan2(uy, ux);\n\n // The center is a point, so it takes the group affine directly.\n const cxNew = dst.x + (pose.x + pose.width / 2 - src.x) * sx;\n const cyNew = dst.y + (pose.y + pose.height / 2 - src.y) * sy;\n\n return {\n ...pose,\n x: cxNew - width / 2,\n y: cyNew - height / 2,\n width,\n height,\n rotation,\n };\n}\n\n/** The pose's visual bounds: its box expanded to cover the box as drawn\n * under its rotation and `transform`, so a turned or skewed shape reports\n * the extent of its ink. */\nexport function visualBoundsViaDescriptor<TPose>(\n pose: TPose,\n geometry: PoseDescriptor<TPose>,\n): Bounds {\n return axisAlignedBounds(framedBounds(pose, geometry));\n}\n\n/** The pose's box with the rotation and `transform` it is drawn in: what\n * `poseFrameOf` reads, for a pose only its descriptor can read. */\nexport function framedBounds<TPose>(pose: TPose, geometry: PoseDescriptor<TPose>): Bounds {\n const b = geometry.getBounds(pose);\n const rotation = geometry.getRotation?.(pose) ?? b.rotation ?? 0;\n const transform = poseLinearOf(pose) ?? poseLinearOf(b);\n if (!rotation && !transform) return b;\n return { ...b, ...(rotation ? { rotation } : {}), ...(transform ? { transform } : {}) };\n}\n\n/** Translate through `geometry.translate`, or via `remapBounds` onto a shifted\n * copy of the pose's own bounds when the descriptor has none. */\nexport function translatePoseViaDescriptor<TPose>(\n pose: TPose,\n dx: number,\n dy: number,\n geometry: PoseDescriptor<TPose>,\n): TPose {\n if (geometry.translate) return geometry.translate(pose, dx, dy);\n const src = geometry.getBounds(pose);\n const dst = { x: src.x + dx, y: src.y + dy, width: src.width, height: src.height };\n return geometry.remapBounds(pose, src, dst);\n}\n"],"mappings":";;;AA6DA,SAAgBA,EACd,GACA,GAC8B;CAC9B,OAAOC,EAAW,UAAUC,CAAI,KAAKD;AACvC;AAIA,IAAaE,IAA+C;CAC1D,YAAY,MAAMC;CAClB,cAAc,GAAG,GAAK,MAAQ;EAC5B,IAAMC,IAAKC,EAAI,UAAU,IAAI,IAAIC,EAAI,QAAQD,EAAI,OAC3CE,IAAKF,EAAI,WAAW,IAAI,IAAIC,EAAI,SAASD,EAAI;EACnD,OAAO;GACL,GAAGF;GACH,GAAGG,EAAI,KAAKH,EAAE,IAAIE,EAAI,KAAKD;GAC3B,GAAGE,EAAI,KAAKH,EAAE,IAAIE,EAAI,KAAKE;GAC3B,OAAOJ,EAAE,QAAQC;GACjB,QAAQD,EAAE,SAASI;EACrB;CACF;C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AAQ,IAAIV,EAAI,KAAKD,GACpD2B,IAAQzB,EAAI,KAAKS,EAAK,IAAIA,EAAK,SAAS,IAAIV,EAAI,KAAKE;CAE3D,OAAO;EACL,GAAGQ;EACH,GAAGe,IAAQF,IAAQ;EACnB,GAAGG,IAAQF,IAAS;EACpB;EACA;EACA;CACF;AACF;AAKA,SAAgBG,EACd,GACA,GACQ;CACR,OAAOC,EAAkBC,EAAanB,GAAMoB,CAAQ,CAAC;AACvD;AAIA,SAAgBD,EAAoB,GAAa,GAAyC;CACxF,IAAM1B,IAAI2B,EAAS,UAAUpB,CAAI,GAC3BE,IAAWkB,EAAS,cAAcpB,CAAI,KAAKP,EAAE,YAAY,GACzD4B,IAAYC,EAAatB,CAAI,KAAKsB,EAAa7B,CAAC;CAEtD,OADI,CAACS,KAAY,CAACmB,IAAkB5B,IAC7B;EAAE,GAAGA;EAAG,GAAIS,IAAW,EAAE,YAAS,IAAI,CAAC;EAAI,GAAImB,IAAY,EAAE,aAAU,IAAI,CAAC;CAAG;AACxF;AAIA,SAAgBE,EACd,GACA,GACA,GACA,GACO;CACP,IAAIH,EAAS,WAAW,OAAOA,EAAS,UAAUpB,GAAMN,GAAIC,CAAE;CAC9D,IAAML,IAAM8B,EAAS,UAAUpB,CAAI,GAC7BT,IAAM;EAAE,GAAGD,EAAI,IAAII;EAAI,GAAGJ,EAAI,IAAIK;EAAI,OAAOL,EAAI;EAAO,QAAQA,EAAI;CAAO;CACjF,OAAO8B,EAAS,YAAYpB,GAAMV,GAAKC,CAAG;AAC5C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { nodeMemo as e } from "../scene/nodeMemo.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { boxContainsBox as i, pointInPolygon as a, polygonContainsPath as o, polygonIntersectsPath as s } from "@weasel-js/geom";
|
|
2
|
+
import { visualBoundsViaDescriptor as t } from "./poseDescriptor.js";
|
|
3
|
+
import { boxContainsBox as n, pathThroughPoseFrame as r, pointInPolygon as i, polygonContainsPath as a, polygonIntersectsPath as o, poseFrameOf as s } from "@weasel-js/geom";
|
|
5
4
|
//#region src/core/geometry/regionHit.ts
|
|
6
5
|
function c(e) {
|
|
7
6
|
let { x: t, y: n, width: r, height: i } = e;
|
|
@@ -51,49 +50,48 @@ function u(e) {
|
|
|
51
50
|
function d(e) {
|
|
52
51
|
return typeof e == "object" && !!e && e.kind === "polygon";
|
|
53
52
|
}
|
|
54
|
-
function f(
|
|
55
|
-
return d(
|
|
53
|
+
function f(n, r, i) {
|
|
54
|
+
return d(r) ? e(n, "aabb", r, () => i.getBounds(r)) : t(r, i);
|
|
56
55
|
}
|
|
57
|
-
function p(e,
|
|
58
|
-
if (
|
|
59
|
-
let
|
|
60
|
-
return
|
|
56
|
+
function p(e, t) {
|
|
57
|
+
if (s(e)) {
|
|
58
|
+
let t = e;
|
|
59
|
+
return r({
|
|
61
60
|
kind: "rect",
|
|
62
|
-
x:
|
|
63
|
-
y:
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
61
|
+
x: t.x,
|
|
62
|
+
y: t.y,
|
|
63
|
+
width: t.width,
|
|
64
|
+
height: t.height
|
|
66
65
|
}, e);
|
|
67
66
|
}
|
|
68
67
|
return {
|
|
69
68
|
kind: "rect",
|
|
70
|
-
x:
|
|
71
|
-
y:
|
|
72
|
-
width:
|
|
73
|
-
height:
|
|
69
|
+
x: t.x,
|
|
70
|
+
y: t.y,
|
|
71
|
+
width: t.width,
|
|
72
|
+
height: t.height
|
|
74
73
|
};
|
|
75
74
|
}
|
|
76
|
-
function m(e, t,
|
|
77
|
-
if (!Number.isFinite(
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
if (t === "centers") return
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
function m(e, t, r, s, c, l = () => !0) {
|
|
76
|
+
if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.width) || !Number.isFinite(s.height)) return !1;
|
|
77
|
+
let u = e.bounds;
|
|
78
|
+
if (s.x >= u.x + u.width || s.x + s.width <= u.x || s.y >= u.y + u.height || s.y + s.height <= u.y) return !1;
|
|
79
|
+
if (t === "centers") return i(e.coords, s.x + s.width / 2, s.y + s.height / 2);
|
|
80
|
+
let f = n([
|
|
81
|
+
u.x,
|
|
82
|
+
u.y,
|
|
83
|
+
u.x + u.width,
|
|
84
|
+
u.y + u.height
|
|
86
85
|
], [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
92
|
-
if (t === "enclosed") return
|
|
93
|
-
if (e.isRect &&
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return p.kind === "rect" && e.isRect ? !0 : s(e.verts, p);
|
|
86
|
+
s.x,
|
|
87
|
+
s.y,
|
|
88
|
+
s.x + s.width,
|
|
89
|
+
s.y + s.height
|
|
90
|
+
]), p = d(r);
|
|
91
|
+
if (t === "enclosed") return f ? a(e.verts, p ? r : c()) : !1;
|
|
92
|
+
if (e.isRect && f) return !0;
|
|
93
|
+
let m = p ? r : c();
|
|
94
|
+
return l() ? m.kind === "rect" && e.isRect ? !0 : o(e.verts, m) : o(e.verts, m, { filled: !1 });
|
|
97
95
|
}
|
|
98
96
|
//#endregion
|
|
99
97
|
export { d as isSilhouettePose, u as polygonRegion, p as poseOutline, c as rectRegion, f as regionBoundsOf, l as regionOf, m as regionTakes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regionHit.js","names":["rectRegion","w","h","r","regionOf","x","y","verts","flat","minX","minY","maxX","maxY","i","coords","bounds","polygonRegion","polygon","p","isSilhouettePose","pose","regionBoundsOf","nodeMemo","node","g","visualBoundsViaDescriptor","poseOutline","poseFrameOf","pathThroughPoseFrame","b","regionTakes","ab","region","mode","pointInPolygon","inBox","boxContainsBox","silhouette","polygonContainsPath","outline","
|
|
1
|
+
{"version":3,"file":"regionHit.js","names":["rectRegion","w","h","r","regionOf","x","y","verts","flat","minX","minY","maxX","maxY","i","coords","bounds","polygonRegion","polygon","p","isSilhouettePose","pose","regionBoundsOf","nodeMemo","node","g","visualBoundsViaDescriptor","poseOutline","poseFrameOf","pathThroughPoseFrame","b","regionTakes","ab","region","mode","pointInPolygon","inBox","boxContainsBox","silhouette","polygonContainsPath","outline","drawn","filled","polygonIntersectsPath"],"sources":["../../../src/core/geometry/regionHit.ts"],"sourcesContent":["/**\n * Whether a marquee or a lasso takes one node: the per-node decision the\n * scene's area walk (`canvas/deps/hitTestArea`) makes.\n *\n * What a node draws is not knowable here — the painters sit above `core/` — so\n * the caller hands in the node's outline as a thunk, asked for only when the\n * bounds cannot decide. A pose that is itself a polygon path is its own\n * outline and never asks.\n */\nimport {\n boxContainsBox,\n pointInPolygon,\n polygonContainsPath,\n polygonIntersectsPath,\n type Path,\n type PolygonPath,\n} from '@weasel-js/geom';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { LassoHitMode } from 'core/adapters/types';\nimport { nodeMemo } from 'core/scene/nodeMemo';\nimport type { Vec2 } from './vec2';\nimport { pathThroughPoseFrame, poseFrameOf } from '@weasel-js/geom';\nimport { visualBoundsViaDescriptor, type PoseDescriptor } from './poseDescriptor';\n\n/** A closed selection area: a marquee rect or a lasso polygon. */\nexport interface SelectRegion {\n /** The area's vertices; the closing edge back to the first is implicit. */\n readonly verts: readonly Vec2[];\n /** `verts` interleaved as `[x0, y0, x1, y1, …]`. */\n readonly coords: readonly number[];\n readonly bounds: Bounds;\n /** True when the area is its own bounding rect, so a node inside `bounds`\n * is inside the area without further work. Never true for a lasso: a node\n * inside the hull's box can still miss the hull. */\n readonly isRect: boolean;\n}\n\n/** A marquee's region. */\nexport function rectRegion(r: Bounds): SelectRegion {\n const { x, y, width: w, height: h } = r;\n return regionOf([x, y, x + w, y, x + w, y + h, x, y + h], { x, y, width: w, height: h }, true)!;\n}\n\n/** A region from interleaved coords. `bounds` is derived when omitted; `null`\n * when there are no coords to bound. */\nexport function regionOf(\n coords: ArrayLike<number>,\n bounds?: Bounds,\n isRect = false,\n): SelectRegion | null {\n const verts: Vec2[] = [];\n const flat: number[] = [];\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (let i = 0; i + 1 < coords.length; i += 2) {\n const x = coords[i], y = coords[i + 1];\n verts.push({ x, y });\n flat.push(x, y);\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n if (verts.length === 0) return null;\n return {\n verts,\n coords: flat,\n bounds: bounds ?? { x: minX, y: minY, width: maxX - minX, height: maxY - minY },\n isRect,\n };\n}\n\n/** A lasso's region, or `null` for fewer than three vertices. */\nexport function polygonRegion(polygon: ReadonlyArray<Vec2>): SelectRegion | null {\n if (polygon.length < 3) return null;\n const coords: number[] = [];\n for (const p of polygon) coords.push(p.x, p.y);\n return regionOf(coords);\n}\n\n/** A pose that is its own drawn outline. */\nexport function isSilhouettePose(pose: unknown): pose is PolygonPath {\n return pose !== null && typeof pose === 'object' && (pose as Path).kind === 'polygon';\n}\n\n/**\n * The box a region fast-rejects a node against: a silhouette pose's own bounds,\n * else the pose's visual bounds — which for a rotated pose is the box of its\n * rotated ink, reaching past the pose box. `g` is the node's descriptor.\n */\nexport function regionBoundsOf(node: object, pose: unknown, g: PoseDescriptor<unknown>): Bounds {\n // Memo is silhouettes-only: a rect pose's bounds are the pose itself, and\n // memoizing it costs more than it saves. The result may be shared; never mutate it.\n return isSilhouettePose(pose)\n ? nodeMemo(node, 'aabb', pose, () => g.getBounds(pose))\n : visualBoundsViaDescriptor(pose, g);\n}\n\n/** The outline of a node nothing paints: its pose rect through the pose's\n * frame, else its visual bounds `b`. */\nexport function poseOutline(pose: unknown, b: Bounds): Path {\n if (poseFrameOf(pose)) {\n const p = pose as Bounds;\n return pathThroughPoseFrame({ kind: 'rect', x: p.x, y: p.y, width: p.width, height: p.height }, pose);\n }\n return { kind: 'rect', x: b.x, y: b.y, width: b.width, height: b.height };\n}\n\n/**\n * Whether `region` takes a node under `mode`, given its pose, its bounds `b`\n * from {@link regionBoundsOf}, and its drawn outline on demand.\n *\n * - `intersect` — the outline meets the region anywhere: its interior too,\n * unless `filled` says nothing paints it.\n * - `enclosed` — the whole outline lies inside it.\n * - `centers` — the center of `b` lies inside it.\n *\n * A node without finite bounds is never taken.\n */\nexport function regionTakes(\n region: SelectRegion,\n mode: LassoHitMode,\n pose: unknown,\n b: Bounds,\n outline: () => Path,\n filled: () => boolean = () => true,\n): boolean {\n if (\n !Number.isFinite(b.x) || !Number.isFinite(b.y) ||\n !Number.isFinite(b.width) || !Number.isFinite(b.height)\n ) {\n return false;\n }\n const ab = region.bounds;\n if (\n b.x >= ab.x + ab.width || b.x + b.width <= ab.x ||\n b.y >= ab.y + ab.height || b.y + b.height <= ab.y\n ) {\n return false;\n }\n if (mode === 'centers') {\n return pointInPolygon(region.coords, b.x + b.width / 2, b.y + b.height / 2);\n }\n const inBox = boxContainsBox(\n [ab.x, ab.y, ab.x + ab.width, ab.y + ab.height],\n [b.x, b.y, b.x + b.width, b.y + b.height],\n );\n const silhouette = isSilhouettePose(pose);\n if (mode === 'enclosed') {\n // A node sticking out of the region's box cannot be inside the region.\n if (!inBox) return false;\n return polygonContainsPath(region.verts, silhouette ? pose : outline());\n }\n // Swallowed whole by a marquee: no outline can change the answer.\n if (region.isRect && inBox) return true;\n const drawn = silhouette ? pose : outline();\n if (!filled()) return polygonIntersectsPath(region.verts, drawn, { filled: false });\n // An axis-aligned rect overlapping a marquee's box already meets it.\n if (drawn.kind === 'rect' && region.isRect) return true;\n return polygonIntersectsPath(region.verts, drawn);\n}\n"],"mappings":";;;;AAsCA,SAAgBA,EAAW,GAAyB;CAClD,IAAM,EAAE,MAAG,MAAG,OAAOC,GAAG,QAAQC,MAAMC;CACtC,OAAOC,EAAS;EAACC;EAAGC;EAAGD,IAAIJ;EAAGK;EAAGD,IAAIJ;EAAGK,IAAIJ;EAAG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CAI1C,OAHKE,EAAO,IAERD,EAAM,SAAS,UAAUR,EAAO,SAAe,KAC5CU,EAAsBV,EAAO,OAAOQ,CAAK,IAH1BE,EAAsBV,EAAO,OAAOQ,GAAO,EAAE,QAAQ,GAAM,CAAC;AAIpF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { applyToPoint as e, invert as t, poseFrameOf as n } from "@weasel-js/geom";
|
|
2
|
+
//#region src/core/geometry/targetFrame.ts
|
|
3
|
+
var r = [
|
|
4
|
+
1,
|
|
5
|
+
0,
|
|
6
|
+
0,
|
|
7
|
+
1,
|
|
8
|
+
0,
|
|
9
|
+
0
|
|
10
|
+
], i = {
|
|
11
|
+
identity: !0,
|
|
12
|
+
toWorld: r,
|
|
13
|
+
toLocal: r
|
|
14
|
+
};
|
|
15
|
+
function a(e) {
|
|
16
|
+
let r = n(e);
|
|
17
|
+
return r ? {
|
|
18
|
+
identity: !1,
|
|
19
|
+
toWorld: r,
|
|
20
|
+
toLocal: t(r)
|
|
21
|
+
} : i;
|
|
22
|
+
}
|
|
23
|
+
function o(e) {
|
|
24
|
+
return e.identity ? 0 : Math.atan2(e.toWorld[1], e.toWorld[0]);
|
|
25
|
+
}
|
|
26
|
+
function s(e) {
|
|
27
|
+
if (e.identity) return !0;
|
|
28
|
+
let [t, n, r, i] = e.toWorld;
|
|
29
|
+
return Math.abs(t - i) < 1e-9 && Math.abs(n + r) < 1e-9 && Math.abs(t * t + n * n - 1) < 1e-9;
|
|
30
|
+
}
|
|
31
|
+
function c(t, n, r) {
|
|
32
|
+
if (t.identity) return {
|
|
33
|
+
x: n,
|
|
34
|
+
y: r
|
|
35
|
+
};
|
|
36
|
+
let [i, a] = e(t.toWorld, n, r);
|
|
37
|
+
return {
|
|
38
|
+
x: i,
|
|
39
|
+
y: a
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function l(t, n, r) {
|
|
43
|
+
if (t.identity) return {
|
|
44
|
+
x: n,
|
|
45
|
+
y: r
|
|
46
|
+
};
|
|
47
|
+
if (!t.toLocal) return null;
|
|
48
|
+
let [i, a] = e(t.toLocal, n, r);
|
|
49
|
+
return {
|
|
50
|
+
x: i,
|
|
51
|
+
y: a
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function u(e, t, n) {
|
|
55
|
+
if (e.identity) return {
|
|
56
|
+
x: t,
|
|
57
|
+
y: n
|
|
58
|
+
};
|
|
59
|
+
let r = e.toLocal;
|
|
60
|
+
return r && {
|
|
61
|
+
x: r[0] * t + r[2] * n,
|
|
62
|
+
y: r[1] * t + r[3] * n
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function d(e, t) {
|
|
66
|
+
if (e.identity) return t;
|
|
67
|
+
let [n, r, i, a] = e.toWorld, o = Math.sign(n * a - r * i) || 1;
|
|
68
|
+
return {
|
|
69
|
+
x: (a * t.x - r * t.y) * o,
|
|
70
|
+
y: (n * t.y - i * t.x) * o
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function f(e, t, n) {
|
|
74
|
+
let [r, i, a, o] = n.toWorld, s = r * t.x, c = i * t.y, l = a * t.x, u = o * t.y, d = Math.abs(s * u - c * l);
|
|
75
|
+
return d === 0 ? {
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0
|
|
78
|
+
} : {
|
|
79
|
+
x: e * Math.hypot(l, u) / d,
|
|
80
|
+
y: e * Math.hypot(s, c) / d
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function p(e, t) {
|
|
84
|
+
return [
|
|
85
|
+
c(t, e.x, e.y),
|
|
86
|
+
c(t, e.x + e.width, e.y),
|
|
87
|
+
c(t, e.x + e.width, e.y + e.height),
|
|
88
|
+
c(t, e.x, e.y + e.height)
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { i as IDENTITY_TARGET, o as angleOf, s as isRigid, c as localToWorld, d as normalToWorld, f as pxExtentIn, p as targetCorners, a as targetTransformOf, u as worldDeltaToLocal, l as worldToLocal };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=targetFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targetFrame.js","names":["IDENTITY","IDENTITY_TARGET","targetTransformOf","toWorld","poseFrameOf","bounds","invert","angleOf","xf","isRigid","a","b","c","d","localToWorld","lx","ly","x","y","applyToPoint","worldToLocal","wx","wy","worldDeltaToLocal","dx","dy","m","normalToWorld","n","k","pxExtentIn","ux","scale","uy","vx","vy","det","px","targetCorners"],"sources":["../../../src/core/geometry/targetFrame.ts"],"sourcesContent":["/**\n * The frame selection chrome reads a target in: `poseFrameOf` over the\n * target's bounds, with the helpers the outline, the handles, their hit\n * regions, and the resize and rotate actions all place themselves by.\n */\nimport { applyToPoint, invert, poseFrameOf, type Mat3, type Scale2 } from '@weasel-js/geom';\n\n/** Local↔world maps for a chrome target. Local is the target's unrotated box\n * frame; world is where the node is drawn. */\nexport interface TargetTransform {\n /** No rotation and no `transform`: local is world. */\n identity: boolean;\n /** Target box frame → world. */\n toWorld: Mat3;\n /** World → target box frame. `null` when the target's `transform` is\n * singular: it draws nothing, and no world point maps back. */\n toLocal: Mat3 | null;\n}\n\nconst IDENTITY: Mat3 = [1, 0, 0, 1, 0, 0];\n\nexport const IDENTITY_TARGET: TargetTransform = { identity: true, toWorld: IDENTITY, toLocal: IDENTITY };\n\n/** The frame `bounds` is drawn in: its `rotation`, its `transform`, or both. */\nexport function targetTransformOf(bounds: unknown): TargetTransform {\n const toWorld = poseFrameOf(bounds);\n if (!toWorld) return IDENTITY_TARGET;\n return { identity: false, toWorld, toLocal: invert(toWorld) };\n}\n\n/** How far the target's x axis is turned from world's, radians. */\nexport function angleOf(xf: TargetTransform): number {\n return xf.identity ? 0 : Math.atan2(xf.toWorld[1], xf.toWorld[0]);\n}\n\n/** Whether the frame only turns the target: no skew, no stretch, no flip. */\nexport function isRigid(xf: TargetTransform): boolean {\n if (xf.identity) return true;\n const [a, b, c, d] = xf.toWorld;\n return Math.abs(a - d) < 1e-9 && Math.abs(b + c) < 1e-9 && Math.abs(a * a + b * b - 1) < 1e-9;\n}\n\n/** local point → world point. */\nexport function localToWorld(xf: TargetTransform, lx: number, ly: number): { x: number; y: number } {\n if (xf.identity) return { x: lx, y: ly };\n const [x, y] = applyToPoint(xf.toWorld, lx, ly);\n return { x, y };\n}\n\n/** world point → local point; `null` where nothing maps back. */\nexport function worldToLocal(xf: TargetTransform, wx: number, wy: number): { x: number; y: number } | null {\n if (xf.identity) return { x: wx, y: wy };\n if (!xf.toLocal) return null;\n const [x, y] = applyToPoint(xf.toLocal, wx, wy);\n return { x, y };\n}\n\n/** A world delta in the target's own axes; `null` where nothing maps back. */\nexport function worldDeltaToLocal(xf: TargetTransform, dx: number, dy: number): { x: number; y: number } | null {\n if (xf.identity) return { x: dx, y: dy };\n const m = xf.toLocal;\n return m && { x: m[0] * dx + m[2] * dy, y: m[1] * dx + m[3] * dy };\n}\n\n/** A local edge's outward normal as a world direction, unnormalized. A normal\n * goes through the inverse transpose, so it stays square to a skewed edge. */\nexport function normalToWorld(xf: TargetTransform, n: { x: number; y: number }): { x: number; y: number } {\n if (xf.identity) return n;\n const [a, b, c, d] = xf.toWorld;\n const k = Math.sign(a * d - b * c) || 1;\n return { x: (d * n.x - b * n.y) * k, y: (a * n.y - c * n.x) * k };\n}\n\n/** `pxExtent` along the target's own axes: how far along each an edge across\n * it must move to move `px` on screen. */\nexport function pxExtentIn(px: number, scale: Scale2, xf: TargetTransform): { x: number; y: number } {\n const [a, b, c, d] = xf.toWorld;\n const ux = a * scale.x, uy = b * scale.y;\n const vx = c * scale.x, vy = d * scale.y;\n const det = Math.abs(ux * vy - uy * vx);\n if (det === 0) return { x: 0, y: 0 };\n return { x: (px * Math.hypot(vx, vy)) / det, y: (px * Math.hypot(ux, uy)) / det };\n}\n\n/** The target's box corners in world, TL/TR/BR/BL. */\nexport function targetCorners(\n b: { x: number; y: number; width: number; height: number },\n xf: TargetTransform,\n): { x: number; y: number }[] {\n return [\n localToWorld(xf, b.x, b.y),\n localToWorld(xf, b.x + b.width, b.y),\n localToWorld(xf, b.x + b.width, b.y + b.height),\n localToWorld(xf, b.x, b.y + b.height),\n ];\n}\n"],"mappings":";;AAmBA,IAAMA,IAAiB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC,GAE3BC,IAAmC;CAAE,UAAU;CAAM,SAASD;CAAU,SAASA;AAAS;AAGvG,SAAgBE,EAAkB,GAAkC;CAClE,IAAMC,IAAUC,EAAYC,CAAM;CAElC,OADKF,IACE;EAAE,UAAU;EAAO;EAAS,SAASG,EAAOH,CAAO;CAAE,IADvCF;AAEvB;AAGA,SAAgBM,EAAQ,GAA6B;CACnD,OAAOC,EAAG,WAAW,IAAI,KAAK,MAAMA,EAAG,QAAQ,IAAIA,EAAG,QAAQ,EAAE;AAClE;AAGA,SAAgBC,EAAQ,GAA8B;CACpD,IAAID,EAAG,UAAU,OAAO;CACxB,IAAM,CAACE,GAAGC,GAAGC,GAAGC,KAAKL,EAAG;CACxB,OAAO,KAAK,IAAIE,IAAIG,CAAC,IAAI,QAAQ,KAAK,IAAIF,IAAIC,CAAC,IAAI,QAAQ,KAAK,IAAIF,IAAIA,IAAIC,IAAIA,IAAI,CAAC,IAAI;AAC3F;AAGA,SAAgBG,EAAa,GAAqB,GAAY,GAAsC;CAClG,IAAIN,EAAG,UAAU,OAAO;EAAE,GAAGO;EAAI,GAAGC;CAAG;CACvC,IAAM,CAACC,GAAGC,KAAKC,EAAaX,EAAG,SAASO,GAAIC,CAAE;CAC9C,OAAO;EAAE;EAAG;CAAE;AAChB;AAGA,SAAgBI,EAAa,GAAqB,GAAY,GAA6C;CACzG,IAAIZ,EAAG,UAAU,OAAO;EAAE,GAAGa;EAAI,GAAGC;CAAG;CACvC,IAAI,CAACd,EAAG,SAAS,OAAO;CACxB,IAAM,CAACS,GAAGC,KAAKC,EAAaX,EAAG,SAASa,GAAIC,CAAE;CAC9C,OAAO;E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AAE,IAAIA,EAAE,OAAOA,EAAE,IAAIA,EAAE,MAAM;EAC9CG,EAAaN,GAAIG,EAAE,GAAGA,EAAE,IAAIA,EAAE,MAAM;CACtC;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { applyToPoint as t } from "@weasel-js/geom";
|
|
1
|
+
import { applyToPoint as e, poseFrameOf as t } from "@weasel-js/geom";
|
|
3
2
|
//#region src/core/geometry/unionBounds.ts
|
|
4
3
|
function n(e) {
|
|
5
4
|
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = !1;
|
|
@@ -16,7 +15,7 @@ function n(e) {
|
|
|
16
15
|
} : null;
|
|
17
16
|
}
|
|
18
17
|
function r(n) {
|
|
19
|
-
let r =
|
|
18
|
+
let r = t(n);
|
|
20
19
|
if (!r) return {
|
|
21
20
|
x: n.x,
|
|
22
21
|
y: n.y,
|
|
@@ -29,8 +28,8 @@ function r(n) {
|
|
|
29
28
|
[n.x + n.width, n.y + n.height],
|
|
30
29
|
[n.x, n.y + n.height]
|
|
31
30
|
];
|
|
32
|
-
for (let [
|
|
33
|
-
let [c, l] =
|
|
31
|
+
for (let [t, n] of c) {
|
|
32
|
+
let [c, l] = e(r, t, n);
|
|
34
33
|
c < i && (i = c), c > o && (o = c), l < a && (a = l), l > s && (s = l);
|
|
35
34
|
}
|
|
36
35
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionBounds.js","names":["unionBounds","minX","minY","maxX","maxY","any","p","poses","right","bottom","axisAlignedBounds","frame","poseFrameOf","b","corners","px","py","rx","ry","applyToPoint","unionAABB","part","parts"],"sources":["../../../src/core/geometry/unionBounds.ts"],"sourcesContent":["/**\n * Union math over rect-shaped poses.\n *\n * Two answers, deliberately distinct. `unionBounds` folds the *unrotated*\n * boxes and is what commit-time actions want, because they go on to write\n * poses back in that same frame. `unionAABB` expands each rotated member to\n * the extent of its ink first, and is what anything a user looks at or clicks\n * wants — selection chrome, gesture bounds, an export viewBox. Folding the\n * unrotated box there under-reports the extent of a rotated member exactly\n * when the consumer is watching it move.\n */\n\nimport { applyToPoint } from '@weasel-js/geom';\nimport type { RectPose } from 'core/scene/types';\nimport { poseFrameOf } from '
|
|
1
|
+
{"version":3,"file":"unionBounds.js","names":["unionBounds","minX","minY","maxX","maxY","any","p","poses","right","bottom","axisAlignedBounds","frame","poseFrameOf","b","corners","px","py","rx","ry","applyToPoint","unionAABB","part","parts"],"sources":["../../../src/core/geometry/unionBounds.ts"],"sourcesContent":["/**\n * Union math over rect-shaped poses.\n *\n * Two answers, deliberately distinct. `unionBounds` folds the *unrotated*\n * boxes and is what commit-time actions want, because they go on to write\n * poses back in that same frame. `unionAABB` expands each rotated member to\n * the extent of its ink first, and is what anything a user looks at or clicks\n * wants — selection chrome, gesture bounds, an export viewBox. Folding the\n * unrotated box there under-reports the extent of a rotated member exactly\n * when the consumer is watching it move.\n */\n\nimport { applyToPoint } from '@weasel-js/geom';\nimport type { RectPose } from 'core/scene/types';\nimport { poseFrameOf } from '@weasel-js/geom';\nexport type { RectPose };\n\n/** Compute the AABB envelope of a set of rect-shaped poses, ignoring any\n * rotation they carry. See the module docstring before reaching for this\n * over {@link unionAABB}. */\nexport function unionBounds<TPose extends RectPose>(poses: Iterable<TPose>): RectPose | null {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let any = false;\n for (const p of poses) {\n any = true;\n if (p.x < minX) minX = p.x;\n if (p.y < minY) minY = p.y;\n const right = p.x + p.width;\n const bottom = p.y + p.height;\n if (right > maxX) maxX = right;\n if (bottom > maxY) maxY = bottom;\n }\n if (!any) return null;\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/**\n * Axis-align a pose that carries a `rotation` or a `transform`: returns the\n * AABB of the box as drawn, its four corners through `poseFrameOf`, with both\n * fields dropped.\n *\n * A pose with neither is returned as-is.\n */\nexport function axisAlignedBounds<TPose extends RectPose>(b: TPose): RectPose {\n const frame = poseFrameOf(b);\n if (!frame) {\n // Strip an explicit `rotation: 0` so callers can rely on the absence of\n // the field meaning \"axis-aligned\".\n return { x: b.x, y: b.y, width: b.width, height: b.height };\n }\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n const corners: ReadonlyArray<readonly [number, number]> = [\n [b.x, b.y],\n [b.x + b.width, b.y],\n [b.x + b.width, b.y + b.height],\n [b.x, b.y + b.height],\n ];\n for (const [px, py] of corners) {\n const [rx, ry] = applyToPoint(frame, px, py);\n if (rx < minX) minX = rx;\n if (rx > maxX) maxX = rx;\n if (ry < minY) minY = ry;\n if (ry > maxY) maxY = ry;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/**\n * Fold every part into one world-space AABB, skipping `null` / `undefined`\n * entries. Rotated parts are expanded via {@link axisAlignedBounds} first;\n * the result never carries a `rotation` (a union of several oriented boxes\n * has no single orientation to report).\n *\n * Returns `null` when nothing was contributed.\n */\nexport function unionAABB<TPose extends RectPose>(\n parts: Iterable<TPose | null | undefined>,\n): RectPose | null {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let any = false;\n for (const part of parts) {\n if (!part) continue;\n const b = axisAlignedBounds(part);\n any = true;\n if (b.x < minX) minX = b.x;\n if (b.y < minY) minY = b.y;\n const right = b.x + b.width;\n const bottom = b.y + b.height;\n if (right > maxX) maxX = right;\n if (bottom > maxY) maxY = bottom;\n }\n if (!any) return null;\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n"],"mappings":";;AAoBA,SAAgBA,EAAoC,GAAyC;CAC3F,IAAIC,IAAO,UACPC,IAAO,UACPC,IAAO,WACPC,IAAO,WACPC,IAAM;CACV,KAAK,IAAMC,KAAKC,GAAO;EAGrB,AAFA,IAAM,IACFD,EAAE,IAAIL,MAAM,IAAOK,EAAE,IACrBA,EAAE,IAAIJ,MAAM,IAAOI,EAAE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ACFR,EAAE,IAAIZ,MAAM,IAAOY,EAAE,IACrBA,EAAE,IAAIX,MAAM,IAAOW,EAAE;EACzB,IAAML,IAAQK,EAAE,IAAIA,EAAE,OAChBJ,IAASI,EAAE,IAAIA,EAAE;EAEvB,AADIL,IAAQL,MAAM,IAAOK,IACrBC,IAASL,MAAM,IAAOK;CAC5B;CAEA,OADKJ,IACE;EAAE,GAAGJ;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK,IADlD;AAEnB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { commandPaint as e } from "@weasel-js/renderer";
|
|
2
|
+
//#region src/core/layers/backgroundFill.ts
|
|
3
|
+
var t = "scene-background-fill";
|
|
4
|
+
function n(t, n) {
|
|
5
|
+
let r = {
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: n.width,
|
|
9
|
+
height: n.height
|
|
10
|
+
}, i = e(t, r);
|
|
11
|
+
return i ? [{
|
|
12
|
+
kind: "path",
|
|
13
|
+
path: {
|
|
14
|
+
kind: "rect",
|
|
15
|
+
...r
|
|
16
|
+
},
|
|
17
|
+
fill: { paint: i }
|
|
18
|
+
}] : [];
|
|
19
|
+
}
|
|
20
|
+
function r(e) {
|
|
21
|
+
return {
|
|
22
|
+
id: t,
|
|
23
|
+
label: "Background fill",
|
|
24
|
+
space: "screen",
|
|
25
|
+
draw: (t, r, i) => n(e, i)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { t as BACKGROUND_FILL_LAYER_ID, n as backgroundFillCommands, r as createBackgroundFillLayer };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=backgroundFill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backgroundFill.js","names":["BACKGROUND_FILL_LAYER_ID","backgroundFillCommands","rect","size","fill","commandPaint","paint","createBackgroundFillLayer","dims"],"sources":["../../../src/core/layers/backgroundFill.ts"],"sourcesContent":["import { commandPaint, type DrawCommand } from '@weasel-js/renderer';\nimport type { Paint } from '@weasel-js/paint';\nimport type { Dims, RenderLayer } from './render';\n\n/** The id of the layer {@link createBackgroundFillLayer} builds. */\nexport const BACKGROUND_FILL_LAYER_ID = 'scene-background-fill';\n\n/**\n * `paint` filling a `size` rect at the origin, with `'bounds'` units resolved\n * against that rect. Empty when the paint cannot be drawn yet.\n */\nexport function backgroundFillCommands(paint: Paint, size: Dims): DrawCommand[] {\n const rect = { x: 0, y: 0, width: size.width, height: size.height };\n const fill = commandPaint(paint, rect);\n return fill ? [{ kind: 'path', path: { kind: 'rect', ...rect }, fill: { paint: fill } }] : [];\n}\n\n/** A screen-space layer filling the whole surface, whatever the camera. */\nexport function createBackgroundFillLayer(paint: Paint): RenderLayer<unknown> {\n return {\n id: BACKGROUND_FILL_LAYER_ID,\n label: 'Background fill',\n space: 'screen',\n draw: (_data, _view, dims) => backgroundFillCommands(paint, dims),\n };\n}\n"],"mappings":";;AAKA,IAAaA,IAA2B;AAMxC,SAAgBC,EAAuB,GAAc,GAA2B;CAC9E,IAAMC,IAAO;EAAE,GAAG;EAAG,GAAG;EAAG,OAAOC,EAAK;EAAO,QAAQA,EAAK;CAAO,GAC5DC,IAAOC,EAAaC,GAAOJ,CAAI;CACrC,OAAOE,IAAO,CAAC;EAAE,MAAM;EAAQ,MAAM;GAAE,MAAM;GAAQ,GAAGF;EAAK;EAAG,MAAM,EAAE,OAAOE,EAAK;CAAE,CAAC,IAAI,CAAC;AAC9F;AAGA,SAAgBG,EAA0B,GAAoC;CAC5E,OAAO;EACL,IAAIP;EACJ,OAAO;EACP,OAAO;EACP,OAAO,GAAO,GAAO,MAASC,EAAuBK,GAAOE,CAAI;CAClE;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"children.js","names":["createChildrenLayer","opts","getChildren","ids","out","id","sub","data","view","cmd"],"sources":["../../../src/core/layers/children.ts"],"sourcesContent":["/**\n * Z-ordered child renderer: a `RenderLayer` factory over an `OrderedAdapter`.\n * Children are drawn in z-order (index 0 = bottom). If the adapter doesn't\n * implement `getChildren`, the layer is a silent no-op.\n */\n\nimport type { DrawCommand } from '@weasel-js/renderer';\nimport type { RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport type { OrderedAdapter } from 'core/adapters/types';\n\n/** Options for `createChildrenLayer`. */\nexport interface CreateChildrenLayerOpts<TData> {\n /** Layer id for the visibility/order map. Default `'children'`. */\n id?: string;\n /** Human-readable label. Default `'Children'`. */\n label?: string;\n /** Source of `getChildren`. Only the read side is used. */\n adapter: Pick<OrderedAdapter, 'getChildren'>;\n /** Parent id (null = root). Function form lets the layer follow a moving\n * selection or focus. Default `null`. */\n parentId?: string | null | (() => string | null);\n /** Draw one child. Called once per id in z-order (bottom → top). The\n * per-child outputs are concatenated into the layer's `DrawCommand[]`. */\n drawChild(id: string, data: TData, view: View): DrawCommand[];\n /** Forwarded to the produced `RenderLayer`. */\n defaultVisible?: boolean;\n /** Forwarded to the produced `RenderLayer`. */\n alwaysOn?: boolean;\n}\n\n/** Build a `RenderLayer` that draws an `OrderedAdapter`'s children in z-order. */\nexport function createChildrenLayer<TData = unknown>(\n opts: CreateChildrenLayerOpts<TData>,\n): RenderLayer<TData> {\n return {\n id: opts.id ?? 'children',\n label: opts.label ?? 'Children',\n defaultVisible: opts.defaultVisible,\n alwaysOn: opts.alwaysOn,\n draw: (data, view) => {\n const getChildren = opts.adapter.getChildren;\n if (!getChildren) return [];\n const parent =\n typeof opts.parentId === 'function'\n ? opts.parentId()\n : opts.parentId ?? null;\n const ids = getChildren(parent);\n const out: DrawCommand[] = [];\n for (const id of ids) {\n const sub = opts.drawChild(id, data, view);\n for (const cmd of sub) out.push(cmd);\n }\n return out;\n },\n };\n}\n"],"mappings":";AAgCA,SAAgBA,EACd,GACoB;CACpB,OAAO;EACL,IAAIC,EAAK,MAAM;EACf,OAAOA,EAAK,SAAS;EACrB,gBAAgBA,EAAK;EACrB,UAAUA,EAAK;EACf,OAAO,GAAM,MAAS;GACpB,IAAMC,IAAcD,EAAK,QAAQ;GACjC,IAAI,CAACC,GAAa,OAAO,CAAC;GAK1B,IAAMC,IAAMD,EAHV,OAAOD,EAAK,YAAa,aACrBA,EAAK,SAAS,IACdA,EAAK,YAAY,IACO,GACxBG,IAAqB,CAAC;GAC5B,KAAK,IAAMC,KAAMF,GAAK;IACpB,IAAMG,IAAML,EAAK,UAAUI,GAAIE,GAAMC,CAAI;IACzC,KAAK,IAAMC,KAAOH,GAAK,EAAI,KAAKG,CAAG;GACrC;GACA,OAAOL;EACT;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { subscribeToSources as e } from "
|
|
2
|
-
//#region src/
|
|
1
|
+
import { subscribeToSources as e } from "./render.js";
|
|
2
|
+
//#region src/core/layers/gateLayer.ts
|
|
3
3
|
function t(t) {
|
|
4
4
|
let { layer: n, visible: r } = t, i = {
|
|
5
5
|
...n,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateLayer.js","names":["gateLayer","opts","wrapped","layer","visible","data","view","dims","deps","hitTest","args","subscribeToSources"],"sources":["../../../src/core/layers/gateLayer.ts"],"sourcesContent":["/**\n * `RenderLayer` wrapper that conditionally emits draw commands based on a\n * predicate.\n *\n * A rule that chrome-caps can express belongs there, since it gates the\n * hit-test as well as the paint. This is for layers outside its vocabulary.\n */\nimport { subscribeToSources, type RenderLayer } from './render';\n\n/** Options for `gateLayer`. */\nexport interface GateLayerOptions<TData> {\n /** The wrapped layer. Everything but `draw`, `hitTest`, and `deps` flows\n * through unchanged. */\n layer: RenderLayer<TData>;\n /** Returns `true` to render the layer this frame, `false` to skip. */\n visible: () => boolean;\n}\n\n/** Wrap a render layer so it only draws, and is only hit, while `visible()`\n * is true. The predicate is consulted per frame. */\nexport function gateLayer<TData>(opts: GateLayerOptions<TData>): RenderLayer<TData> {\n const { layer, visible } = opts;\n const wrapped: RenderLayer<TData> = {\n ...layer,\n draw: (data, view, dims) => (visible() ? layer.draw(data, view, dims) : []),\n };\n const { deps, hitTest } = layer;\n if (deps) wrapped.deps = (data, view, dims) => [visible(), ...deps(data, view, dims)];\n if (hitTest) wrapped.hitTest = (...args) => (visible() ? hitTest(...args) : null);\n if (layer.subscribe) wrapped.subscribe = subscribeToSources([layer]);\n return wrapped;\n}\n"],"mappings":";;AAoBA,SAAgBA,EAAiB,GAAmD;CAClF,IAAM,EAAE,UAAO,eAAYC,GACrBC,IAA8B;EAClC,GAAGC;EACH,OAAO,GAAM,GAAM,MAAUC,EAAQ,IAAID,EAAM,KAAKE,GAAMC,GAAMC,CAAI,IAAI,CAAC;CAC3E,GACM,EAAE,SAAM,eAAYJ;CAI1B,OAHIK,MAAM,EAAQ,QAAQ,GAAM,GAAM,MAAS,CAACJ,EAAQ,GAAG,GAAGI,EAAKH,GAAMC,GAAMC,CAAI,CAAC,IAChFE,MAAS,EAAQ,WAAW,GAAGC,MAAUN,EAAQ,IAAIK,EAAQ,GAAGC,CAAI,IAAI,OACxEP,EAAM,cAAW,EAAQ,YAAYQ,EAAmB,CAACR,CAAK,CAAC,IAC5DD;AACT"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/core/layers/layerGroup.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (!e || e.length === 0) return null;
|
|
4
|
+
let n = [...t], r = /* @__PURE__ */ new Map();
|
|
5
|
+
for (let t of e) for (let e of t.layers) {
|
|
6
|
+
let i = !1;
|
|
7
|
+
for (let a of n) {
|
|
8
|
+
if (a !== e && !a.startsWith(`${e}:`)) continue;
|
|
9
|
+
i = !0;
|
|
10
|
+
let n = r.get(a);
|
|
11
|
+
if (n !== t) {
|
|
12
|
+
if (n) {
|
|
13
|
+
console.warn(`[weasel] layer "${a}" is claimed by layer groups "${n.id}" and "${t.id}"; it stays in "${n.id}".`);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
r.set(a, t);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
i || console.warn(`[weasel] layer group "${t.id}" names "${e}", which matches no layer being drawn, so it groups nothing. Check the id against the layer stack — a scene with declared layers draws as "scene:<layerId>", which "scene" covers.`);
|
|
20
|
+
}
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
function t(e, t, n, r) {
|
|
24
|
+
let i = typeof e.effects == "function" ? e.effects(n, r) : e.effects, a = i && i.length > 0 ? i : void 0;
|
|
25
|
+
if (!a && e.alpha === void 0 && e.colorMatrix === void 0 && e.composite === void 0) return t;
|
|
26
|
+
let o = e.alpha !== void 0 && e.alpha < 1;
|
|
27
|
+
return [{
|
|
28
|
+
kind: "group",
|
|
29
|
+
...a ? { effects: a } : {},
|
|
30
|
+
...!a && (o || e.colorMatrix !== void 0) ? { isolate: !0 } : {},
|
|
31
|
+
...e.alpha === void 0 ? {} : { alpha: e.alpha },
|
|
32
|
+
...e.colorMatrix === void 0 ? {} : { colorMatrix: e.colorMatrix },
|
|
33
|
+
...e.composite === void 0 ? {} : { composite: e.composite },
|
|
34
|
+
children: t
|
|
35
|
+
}];
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { e as groupMembership, t as wrapGroup };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=layerGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerGroup.js","names":["groupMembership","groups","stack","layerIds","byLayer","group","name","matched","id","claimed","wrapGroup","declared","view","dims","effects","children","fades"],"sources":["../../../src/core/layers/layerGroup.ts"],"sourcesContent":["import type { BlendFactors, CompositeOp, DrawCommand, Effect } from '@weasel-js/renderer';\nimport type { View } from 'core/viewport/view';\nimport type { Dims } from './render';\n\n/**\n * Several consecutive layers composited as one.\n *\n * A layer's own `effects` run over that layer alone, which is the wrong\n * picture whenever a pass reads neighboring pixels: `blur(A over B)` is not\n * `blur(A) over blur(B)`. A group draws its members into one buffer, runs one\n * chain over it, and composites the result back once.\n *\n * Membership is by `RenderLayer.id` — the same names `layerOrder` and\n * `layerVisibility` use, not the `layers` map's slot keys.\n *\n * Only *consecutive* members share a buffer. A group whose members are\n * separated in the render order is drawn as one bracket per run, with a\n * warning.\n *\n * This is a render-stack bracket, not a scene `ContainerNode`.\n */\nexport interface LayerGroup {\n /** Names the group in warnings; not a layer id and never drawn. */\n id: string;\n /**\n * Member layer ids. Order here is ignored — the render order decides.\n *\n * A name claims that layer and every layer under it in the `:` namespace, so\n * `'scene'` covers the `scene:<layerId>` layers a scene with declared layers\n * draws as. The separator is required: `'scene'` does not reach `scenery`.\n * A name matching no layer being drawn is warned about.\n */\n layers: readonly string[];\n /** Passes over the group's combined pixels, in order. A thunk is re-read on\n * every frame, so an animating radius costs no React render. */\n effects?: readonly Effect[] | ((view: View, dims: Dims) => readonly Effect[]);\n /** Opacity applied to the group's composited result, not to each member. */\n alpha?: number;\n /** 4×5 color matrix (row-major, 20 numbers) applied to the composited\n * result. See `GroupDrawCommand.colorMatrix`. */\n colorMatrix?: number[];\n /** How the composited result joins the layers under it. Default\n * `source-over`. See `GroupDrawCommand.composite`. */\n composite?: CompositeOp | BlendFactors;\n}\n\n/**\n * Layer id → the group that owns it. First claim wins across groups, with a\n * warning for the second; the same group naming a layer twice — `['scene',\n * 'scene:tiles']` — passes quietly.\n */\nexport function groupMembership(\n groups: readonly LayerGroup[] | undefined,\n layerIds: Iterable<string>,\n): Map<string, LayerGroup> | null {\n if (!groups || groups.length === 0) return null;\n const stack = [...layerIds];\n const byLayer = new Map<string, LayerGroup>();\n for (const group of groups) {\n for (const name of group.layers) {\n let matched = false;\n for (const id of stack) {\n if (id !== name && !id.startsWith(`${name}:`)) continue;\n matched = true;\n const claimed = byLayer.get(id);\n if (claimed === group) continue;\n if (claimed) {\n console.warn(\n `[weasel] layer \"${id}\" is claimed by layer groups \"${claimed.id}\" and ` +\n `\"${group.id}\"; it stays in \"${claimed.id}\".`,\n );\n continue;\n }\n byLayer.set(id, group);\n }\n if (!matched) {\n console.warn(\n `[weasel] layer group \"${group.id}\" names \"${name}\", which matches no layer ` +\n 'being drawn, so it groups nothing. Check the id against the layer stack — a ' +\n 'scene with declared layers draws as \"scene:<layerId>\", which \"scene\" covers.',\n );\n }\n }\n }\n return byLayer;\n}\n\n/**\n * Put one run of a group's commands under its shared compositing.\n *\n * No transform: every member already carries its own space wrap, so a second\n * one here would apply the view twice to world layers and once to screen ones.\n * A group that composites plainly gets no wrapper at all.\n */\nexport function wrapGroup(\n group: LayerGroup,\n children: DrawCommand[],\n view: View,\n dims: Dims,\n): DrawCommand[] {\n const declared = typeof group.effects === 'function'\n ? group.effects(view, dims)\n : group.effects;\n const effects = declared && declared.length > 0 ? declared : undefined;\n if (!effects && group.alpha === undefined && group.colorMatrix === undefined\n && group.composite === undefined) return children;\n const fades = group.alpha !== undefined && group.alpha < 1;\n return [{\n kind: 'group',\n ...(effects ? { effects } : {}),\n ...(!effects && (fades || group.colorMatrix !== undefined) ? { isolate: true } : {}),\n ...(group.alpha !== undefined ? { alpha: group.alpha } : {}),\n ...(group.colorMatrix !== undefined ? { colorMatrix: group.colorMatrix } : {}),\n ...(group.composite !== undefined ? { composite: group.composite } : {}),\n children,\n }];\n}\n"],"mappings":";AAmDA,SAAgBA,EACd,GACA,GACgC;CAChC,IAAI,CAACC,KAAUA,EAAO,WAAW,GAAG,OAAO;CAC3C,IAAMC,IAAQ,CAAC,GAAGC,CAAQ,GACpBC,oBAAU,IAAI,IAAwB;CAC5C,KAAK,IAAMC,KAASJ,GAClB,KAAK,IAAMK,KAAQD,EAAM,QAAQ;EAC/B,IAAIE,IAAU;EACd,KAAK,IAAMC,KAAMN,GAAO;GACtB,IAAIM,MAAOF,KAAQ,CAACE,EAAG,WAAW,GAAGF,EAAK,EAAE,GAAG;GAC/C,IAAU;GACV,IAAMG,IAAUL,EAAQ,IAAII,CAAE;GAC9B,IAAIC,MAAYJ,GAChB;QAAII,GAAS;KACX,QAAQ,KACN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