@weasel-js/core 1.9.2 → 1.9.4
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 +393 -0
- package/README.md +2 -2
- package/dist/WeaselProvider.js +5 -5
- package/dist/affordances/composeAffordanceLayer.js +10 -20
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +25 -17
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +27 -20
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/rotationHandle.js +18 -18
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/momentum.js +93 -55
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/loop.js +10 -12
- package/dist/animation/loop.js.map +1 -1
- package/dist/animation/reflow.js +8 -8
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/stagger.js +64 -56
- package/dist/animation/stagger.js.map +1 -1
- package/dist/animation/timeline/booking.js +62 -54
- package/dist/animation/timeline/booking.js.map +1 -1
- package/dist/animation/timeline/createTimeline.js +85 -76
- package/dist/animation/timeline/createTimeline.js.map +1 -1
- package/dist/animation/timeline/sampleTrack.js +13 -5
- package/dist/animation/timeline/sampleTrack.js.map +1 -1
- package/dist/animation/useAnimator.js +45 -35
- package/dist/animation/useAnimator.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +31 -24
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +28 -26
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js +13 -0
- package/dist/animation/wrappers/instantPose.js.map +1 -0
- package/dist/{poseDescriptor-D-OH-tu5.d.ts → autoPoseDescriptor-Ct7yqivU.d.ts} +28 -3
- package/dist/barrel/chrome.js +16 -0
- package/dist/barrel/input.js +19 -0
- package/dist/barrel/interactions.js +42 -0
- package/dist/barrel/paint.js +18 -0
- package/dist/barrel/paths.js +19 -0
- package/dist/barrel/renderer.js +20 -0
- package/dist/barrel/routing.js +51 -0
- package/dist/barrel/text.js +18 -0
- package/dist/barrel/viewport.js +52 -0
- package/dist/builtins-DPcdghtB.d.ts +1223 -0
- package/dist/canvas/Canvas.js +363 -448
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +164 -165
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +37 -32
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +49 -43
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/MinimapCanvas.js +26 -25
- package/dist/canvas/MinimapCanvas.js.map +1 -1
- package/dist/canvas/NodeShape.js +59 -377
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js +50 -47
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +167 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +13 -13
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +67 -0
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
- package/dist/canvas/SceneCanvas/coordTrace.js +10 -0
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +146 -92
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +1 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js +12 -0
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +29 -28
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
- package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
- package/dist/canvas/SceneCanvas/props.js +38 -0
- package/dist/canvas/SceneCanvas/props.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +46 -48
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +33 -33
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +534 -788
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +45 -43
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +91 -0
- package/dist/canvas/buildSceneLayer.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +16 -19
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +68 -52
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/deps/changes.js +13 -0
- package/dist/canvas/deps/changes.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +28 -28
- package/dist/canvas/deps/insert.js +119 -91
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/slice.js +46 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +10 -9
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/derivedPath.js +46 -23
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +7 -7
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/kitRequirements.js +2 -2
- package/dist/canvas/kitRequirements.js.map +1 -1
- package/dist/canvas/layerOrder.js +13 -6
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/minimapMath.js +12 -10
- package/dist/canvas/minimapMath.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/imagePainter.js +87 -0
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/memo.js +9 -0
- package/dist/canvas/nodeShapes/memo.js.map +1 -0
- package/dist/canvas/nodeShapes/nodePaint.js +57 -0
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
- package/dist/canvas/nodeShapes/pathPainter.js +38 -0
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/poseBox.js +20 -0
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
- package/dist/canvas/nodeShapes/shapePainter.js +72 -0
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
- package/dist/canvas/nodeShapes/textPainter.js +55 -0
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +10 -11
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/pickWalk.js +52 -63
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/poseRotation.js +11 -23
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/renderDebugSnapshot.js +5 -5
- package/dist/canvas/renderSceneToPixels.js +3 -1
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +66 -148
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +112 -0
- package/dist/canvas/sceneClipboard.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +39 -40
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/useCanvasRenderer.js +14 -6
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasView.js +58 -0
- package/dist/canvas/useCanvasView.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +35 -26
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +21 -0
- package/dist/canvas/useSceneLayerList.js.map +1 -0
- package/dist/clipboard.d.ts +10 -6
- package/dist/clone.d.ts +4 -3
- package/dist/core/adapters/arrayAdapter.js +48 -39
- package/dist/core/adapters/arrayAdapter.js.map +1 -1
- package/dist/core/device/index.js +5 -4
- package/dist/core/device/useDeviceProfile.js +38 -44
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/core/device/watchDevicePixelRatio.js +17 -0
- package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
- package/dist/core/fillInPoseFrame.js.map +1 -1
- package/dist/core/geometry/poseDescriptor.js +21 -19
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/poseFrame.js +44 -0
- package/dist/core/geometry/poseFrame.js.map +1 -0
- package/dist/core/geometry/poseRotation.js.map +1 -1
- package/dist/core/geometry/regionHit.js +9 -10
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/unionBounds.js +31 -29
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/isPlainObject.js +2 -11
- package/dist/core/ops/arrange.js +1 -0
- package/dist/core/ops/arrange.js.map +1 -1
- package/dist/core/ops/create.js +10 -5
- package/dist/core/ops/create.js.map +1 -1
- package/dist/core/ops/delete.js +12 -24
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/ops/reorder/index.js +43 -40
- package/dist/core/ops/reorder/index.js.map +1 -1
- package/dist/core/ops/reorder/setChildOrder.js +34 -0
- package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
- package/dist/core/paintKinds.js +5 -5
- package/dist/core/paintKinds.js.map +1 -1
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/appliedLog.js +37 -0
- package/dist/core/scene/appliedLog.js.map +1 -0
- package/dist/core/scene/arrivalWindow.js +101 -0
- package/dist/core/scene/arrivalWindow.js.map +1 -0
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/historyFacade.js +84 -0
- package/dist/core/scene/historyFacade.js.map +1 -0
- package/dist/core/scene/kitOps.js +173 -0
- package/dist/core/scene/kitOps.js.map +1 -0
- package/dist/core/scene/layerStack.js +38 -0
- package/dist/core/scene/layerStack.js.map +1 -0
- package/dist/core/scene/lockGuard.js +37 -0
- package/dist/core/scene/lockGuard.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +5 -6
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +45 -19
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +126 -0
- package/dist/core/scene/nodeStore.js.map +1 -0
- package/dist/core/scene/pickability.js +6 -0
- package/dist/core/scene/pickability.js.map +1 -0
- package/dist/core/scene/poseFeed.js +38 -38
- package/dist/core/scene/poseFeed.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +34 -38
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/renderOrder.js +84 -0
- package/dist/core/scene/renderOrder.js.map +1 -0
- package/dist/core/scene/scene.js +289 -866
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/serialization.js +68 -0
- package/dist/core/scene/serialization.js.map +1 -0
- package/dist/core/scene/treeOrder.js +13 -0
- package/dist/core/scene/treeOrder.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/viewport/meanScale.js +1 -1
- package/dist/core/viewport/meanScale.js.map +1 -1
- package/dist/core/viewport/view.js +12 -12
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/zoomBounds.js +10 -8
- package/dist/core/viewport/zoomBounds.js.map +1 -1
- package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-CtCb8a3G.d.ts} +1 -1
- package/dist/debug/createDebugOverlayLayer.js +14 -14
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/flag.js +2 -41
- package/dist/features/chrome-caps/useHoverTracking.js +22 -17
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/focus/gateLayer.js +3 -4
- package/dist/features/focus/gateLayer.js.map +1 -1
- package/dist/features/images/imageCache.js +19 -9
- package/dist/features/images/imageCache.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +14 -11
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/index.js +1 -1
- package/dist/features/ingestion/registerKitHandlers.js +7 -7
- package/dist/features/ingestion/weaselJsonHandler.js +17 -14
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/meshPaint/lazyKind.js +201 -35
- package/dist/features/meshPaint/lazyKind.js.map +1 -1
- package/dist/features/meshPaint/meshPaint.js +82 -79
- package/dist/features/meshPaint/meshPaint.js.map +1 -1
- package/dist/features/minimap/createMinimapContribution.js +42 -42
- package/dist/features/minimap/layers.js +44 -62
- package/dist/features/minimap/layers.js.map +1 -1
- package/dist/features/parallax/createParallaxPlane.js +10 -14
- package/dist/features/parallax/createParallaxPlane.js.map +1 -1
- package/dist/features/paths/anchorEdits.js +19 -8
- package/dist/features/paths/anchorEdits.js.map +1 -1
- package/dist/features/paths/anchors.js +31 -26
- package/dist/features/paths/anchors.js.map +1 -1
- package/dist/features/paths/booleans.js +2 -2
- package/dist/features/paths/index.js +13 -11
- package/dist/features/paths/markerCommands.js +37 -36
- package/dist/features/paths/markerCommands.js.map +1 -1
- package/dist/features/paths/pathInWorld.js +19 -19
- package/dist/features/paths/pathInWorld.js.map +1 -1
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/strokeToPath.js +40 -0
- package/dist/features/paths/strokeToPath.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -1
- package/dist/features/patterns/commandPaint.js +18 -0
- package/dist/features/patterns/commandPaint.js.map +1 -0
- package/dist/features/patterns/index.js +5 -17
- package/dist/features/patterns/index.js.map +1 -1
- package/dist/features/patterns/rasterizeTile.js +17 -0
- package/dist/features/patterns/rasterizeTile.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +52 -44
- package/dist/features/patterns/resolveSpec.js.map +1 -1
- package/dist/features/poseRun/usePoseRun.js +8 -3
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/SelectionContext.js +5 -0
- package/dist/features/selection/SelectionContext.js.map +1 -1
- package/dist/features/selection/overlay.js +18 -18
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/domOffsets.js +82 -0
- package/dist/features/text/domOffsets.js.map +1 -0
- package/dist/features/text/domRuns.js +103 -131
- package/dist/features/text/domRuns.js.map +1 -1
- package/dist/features/text/hitTest.js +5 -2
- package/dist/features/text/hitTest.js.map +1 -1
- package/dist/features/text/isTextData.js +8 -0
- package/dist/features/text/isTextData.js.map +1 -0
- package/dist/features/text/overlayDirection.js +15 -0
- package/dist/features/text/overlayDirection.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +32 -34
- package/dist/features/text/runs/rangeStyle.js.map +1 -1
- package/dist/features/text/textCommand.js +34 -33
- package/dist/features/text/textCommand.js.map +1 -1
- package/dist/features/text/textToPath.js +40 -40
- package/dist/features/text/textToPath.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +76 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/text/useTextEdit.js +184 -160
- package/dist/features/text/useTextEdit.js.map +1 -1
- package/dist/features/tiling/createTiledLayer.js +24 -22
- package/dist/features/tiling/createTiledLayer.js.map +1 -1
- package/dist/index.d.ts +11010 -7700
- package/dist/index.js +316 -309
- package/dist/input/keyState.js +42 -43
- package/dist/input/keyState.js.map +1 -1
- package/dist/input/useKeyModifiers.js +11 -0
- package/dist/input/useKeyModifiers.js.map +1 -0
- package/dist/interactions/actions/align/align.js +8 -8
- package/dist/interactions/actions/clipboard/clipboardOps.js +34 -32
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -1
- package/dist/interactions/actions/defaultCommitAdapter.js +20 -18
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/align.js +9 -10
- package/dist/interactions/actions/defaults/align.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +59 -81
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js +35 -38
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/clipboard.js +26 -10
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -1
- package/dist/interactions/actions/defaults/clone.js +44 -60
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/copySubtree.js +40 -0
- package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +14 -13
- package/dist/interactions/actions/defaults/distribute.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +17 -57
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/editAnchors.js +18 -18
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/flip.js +52 -46
- package/dist/interactions/actions/defaults/flip.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +43 -48
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +35 -33
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insert.js +50 -51
- package/dist/interactions/actions/defaults/insert.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +7 -7
- package/dist/interactions/actions/defaults/lassoSelect.js +67 -70
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js +267 -249
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +40 -68
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
- package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +2 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js +104 -98
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js +111 -110
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +7 -7
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -4
- package/dist/interactions/actions/defaults/setStroke.js +12 -12
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
- package/dist/interactions/actions/defaults/sliceOps.js +19 -19
- package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/edit-anchors/geometry.js +28 -23
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/helpers.js +30 -17
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/hitSelection.js +8 -0
- package/dist/interactions/actions/hitSelection.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +32 -21
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +32 -15
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +33 -0
- package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +18 -18
- package/dist/interactions/actions/poseDescriptorDep.js +16 -4
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +11 -6
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/previewOverrides.js +5 -5
- package/dist/interactions/actions/previewOverrides.js.map +1 -1
- package/dist/interactions/actions/selectionSubtree.js +69 -0
- package/dist/interactions/actions/selectionSubtree.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +66 -62
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
- package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
- package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +8 -6
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/{math-Drrw4ewZ.d.ts → math-J-ACHyEg.d.ts} +1 -2
- package/dist/math.d.ts +2 -3
- package/dist/move.d.ts +12 -11
- package/dist/{originProjection-DEklpDc_.d.ts → originProjection-gHnOup4e.d.ts} +1 -1
- package/dist/{registerProgram-BMZRDgrh.d.ts → registerProgram-T9S_PfAX.d.ts} +18 -7
- package/dist/renderer/DrawCommand.js.map +1 -1
- package/dist/renderer/WeaselRenderer.js +75 -73
- package/dist/renderer/WeaselRenderer.js.map +1 -1
- package/dist/renderer/cache/GLImageCache.js +15 -5
- package/dist/renderer/cache/GLImageCache.js.map +1 -1
- package/dist/renderer/cache/GLMeshCache.js +23 -23
- package/dist/renderer/cache/GLMeshCache.js.map +1 -1
- package/dist/renderer/cache/GLTextureCache.js +18 -1
- package/dist/renderer/cache/GLTextureCache.js.map +1 -1
- package/dist/renderer/cache/cache.js.map +1 -1
- package/dist/renderer/cache/markerCommandCache.js.map +1 -1
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -1
- package/dist/renderer/cullDrawCommands.js +11 -11
- package/dist/renderer/draw/batch.js +133 -0
- package/dist/renderer/draw/batch.js.map +1 -0
- package/dist/renderer/draw/clip.js +89 -0
- package/dist/renderer/draw/clip.js.map +1 -0
- package/dist/renderer/draw/customShader.js +230 -0
- package/dist/renderer/draw/customShader.js.map +1 -0
- package/dist/renderer/draw/drawTriangles.js +8 -0
- package/dist/renderer/draw/drawTriangles.js.map +1 -0
- package/dist/renderer/draw/effects.js +28 -0
- package/dist/renderer/draw/effects.js.map +1 -0
- package/dist/renderer/draw/flushBatch.js +35 -0
- package/dist/renderer/draw/flushBatch.js.map +1 -0
- package/dist/renderer/draw/gradient.js +90 -0
- package/dist/renderer/draw/gradient.js.map +1 -0
- package/dist/renderer/draw/image.js +38 -0
- package/dist/renderer/draw/image.js.map +1 -0
- package/dist/renderer/draw/mesh.js +16 -0
- package/dist/renderer/draw/mesh.js.map +1 -0
- package/dist/renderer/draw/paintBind.js +70 -0
- package/dist/renderer/draw/paintBind.js.map +1 -0
- package/dist/renderer/draw/pathPaint.js +142 -0
- package/dist/renderer/draw/pathPaint.js.map +1 -0
- package/dist/renderer/draw/scratchPass.js +83 -0
- package/dist/renderer/draw/scratchPass.js.map +1 -0
- package/dist/renderer/draw/stencil.js +28 -0
- package/dist/renderer/draw/stencil.js.map +1 -0
- package/dist/renderer/draw/text.js +167 -0
- package/dist/renderer/draw/text.js.map +1 -0
- package/dist/renderer/draw/uniforms.js +77 -0
- package/dist/renderer/draw/uniforms.js.map +1 -0
- package/dist/renderer/draw.js +60 -1116
- package/dist/renderer/draw.js.map +1 -1
- package/dist/renderer/effects/EffectTargets.js +3 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -1
- package/dist/renderer/effects/composite.js +7 -5
- package/dist/renderer/effects/composite.js.map +1 -1
- package/dist/renderer/index.js +18 -17
- package/dist/renderer/math/color.js +63 -83
- package/dist/renderer/math/color.js.map +1 -1
- package/dist/renderer/math/mat3.js +15 -11
- package/dist/renderer/math/mat3.js.map +1 -1
- package/dist/renderer/math/viewToMat3.js +1 -1
- package/dist/renderer/math/viewToMat3.js.map +1 -1
- package/dist/renderer/shaders/ShaderProgram.js +13 -13
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -1
- package/dist/renderer/shaders/glyphPaint.js +3 -3
- package/dist/renderer/shaders/glyphPaint.js.map +1 -1
- package/dist/renderer/shaders/gradFill.js +2 -1
- package/dist/renderer/shaders/gradFill.js.map +1 -1
- package/dist/renderer/shaders/pathFill.js +2 -1
- package/dist/renderer/shaders/pathFill.js.map +1 -1
- package/dist/renderer/shaders/patternFill.js +2 -1
- package/dist/renderer/shaders/patternFill.js.map +1 -1
- package/dist/renderer/shaders/registerProgram.js.map +1 -1
- package/dist/renderer/strokeLengths.js.map +1 -1
- package/dist/renderer/textures/registerTexture.js +25 -5
- package/dist/renderer/textures/registerTexture.js.map +1 -1
- package/dist/renderer.d.ts +16 -15
- package/dist/renderer.js +17 -16
- package/dist/resize.d.ts +5 -6
- package/dist/resize.js +5 -5
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js +12 -6
- package/dist/test-hook/install.js.map +1 -1
- package/dist/{test-seams-CuIxe0xY.d.ts → test-seams-DM2B87-g.d.ts} +4 -4
- package/dist/test-seams.d.ts +2 -2
- package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js +1 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js +1 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +153 -103
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js +1 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/selectionContributions.js +24 -23
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +51 -48
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js +17 -0
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +49 -54
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js +22 -16
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +13 -2
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/useKeybindings.js +14 -30
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-B_9g6hMM.d.ts → types-B4iJRHC3.d.ts} +5 -1
- package/dist/{types-A37hYkeR.d.ts → types-k-5Oqh-U.d.ts} +31 -7
- package/dist/util/color.js +3 -3
- package/dist/util/color.js.map +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +20 -18
- package/dist/autoPoseDescriptor-vCdt55xm.d.ts +0 -27
- package/dist/builtins-C-VgUlWI.d.ts +0 -4514
- package/dist/core/isPlainObject.js.map +0 -1
- package/dist/debug/flag.js.map +0 -1
- package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
- package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
- package/dist/renderer/shaders/imageFill.js +0 -14
- package/dist/renderer/shaders/imageFill.js.map +0 -1
- package/dist/tools/prefs.js +0 -47
- package/dist/tools/prefs.js.map +0 -1
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
//#region ../paint/dist/index.js
|
|
2
|
+
var HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
3
|
+
function parseHexBytes(input) {
|
|
4
|
+
if (!HEX.test(input)) return null;
|
|
5
|
+
const digits = input.slice(1);
|
|
6
|
+
const long = digits.length <= 4 ? digits.replace(/./g, "$&$&") : digits;
|
|
7
|
+
const byte = (i) => Number.parseInt(long.slice(i, i + 2), 16);
|
|
8
|
+
return [
|
|
9
|
+
byte(0),
|
|
10
|
+
byte(2),
|
|
11
|
+
byte(4),
|
|
12
|
+
long.length === 8 ? byte(6) : 255
|
|
13
|
+
];
|
|
14
|
+
}
|
|
2
15
|
var SRGB_TO_LINEAR = (() => {
|
|
3
16
|
const lut = /* @__PURE__ */ new Float64Array(256);
|
|
4
17
|
for (let i = 0; i < 256; i++) {
|
|
@@ -251,32 +264,14 @@ function rgbaToHex(rgba) {
|
|
|
251
264
|
return a >= 1 ? base : `${base}${f(a)}`;
|
|
252
265
|
}
|
|
253
266
|
function parseHex(s) {
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (hex.length === 4) return [
|
|
262
|
-
parseInt(hex[0] + hex[0], 16) / 255,
|
|
263
|
-
parseInt(hex[1] + hex[1], 16) / 255,
|
|
264
|
-
parseInt(hex[2] + hex[2], 16) / 255,
|
|
265
|
-
parseInt(hex[3] + hex[3], 16) / 255
|
|
266
|
-
];
|
|
267
|
-
if (hex.length === 6) return [
|
|
268
|
-
parseInt(hex.slice(0, 2), 16) / 255,
|
|
269
|
-
parseInt(hex.slice(2, 4), 16) / 255,
|
|
270
|
-
parseInt(hex.slice(4, 6), 16) / 255,
|
|
271
|
-
1
|
|
272
|
-
];
|
|
273
|
-
if (hex.length === 8) return [
|
|
274
|
-
parseInt(hex.slice(0, 2), 16) / 255,
|
|
275
|
-
parseInt(hex.slice(2, 4), 16) / 255,
|
|
276
|
-
parseInt(hex.slice(4, 6), 16) / 255,
|
|
277
|
-
parseInt(hex.slice(6, 8), 16) / 255
|
|
267
|
+
const bytes = parseHexBytes(s);
|
|
268
|
+
if (!bytes) throw new Error(`parseColor: invalid hex "${s}"`);
|
|
269
|
+
return [
|
|
270
|
+
bytes[0] / 255,
|
|
271
|
+
bytes[1] / 255,
|
|
272
|
+
bytes[2] / 255,
|
|
273
|
+
bytes[3] / 255
|
|
278
274
|
];
|
|
279
|
-
throw new Error(`parseColor: invalid hex "${s}"`);
|
|
280
275
|
}
|
|
281
276
|
/** Match `name( body )` and return the trimmed body, or null. */
|
|
282
277
|
function unwrapFn(s, name) {
|
|
@@ -569,6 +564,169 @@ const NAMED_COLORS = (() => {
|
|
|
569
564
|
return out;
|
|
570
565
|
})();
|
|
571
566
|
//#endregion
|
|
567
|
+
//#region ../geom/src/mat3.ts
|
|
568
|
+
/**
|
|
569
|
+
* 2D affine transforms in canvas/DOMMatrix order: [a, b, c, d, e, f].
|
|
570
|
+
* x' = a·x + c·y + e
|
|
571
|
+
* y' = b·x + d·y + f
|
|
572
|
+
* Represented as a readonly 6-tuple (f64). The affine tier of the kernel.
|
|
573
|
+
*
|
|
574
|
+
* Convention alignment: the renderer already has a `Mat3` in
|
|
575
|
+
* `src/renderer/math/mat3.ts`. That one is a 9-element column-major
|
|
576
|
+
* array (a full 3×3) laid out for `uniformMatrix3fv` — a deliberately
|
|
577
|
+
* different *representation* for the WebGL upload path. Its *logical element
|
|
578
|
+
* order* is identical to ours: `create(a, b, c, d, tx, ty)` maps
|
|
579
|
+
* `x' = a·x + c·y + tx`, `y' = b·x + d·y + ty` (canvas/DOMMatrix a,b,c,d,e,f).
|
|
580
|
+
* We keep the pure 6-tuple form here (the kernel form); the 9-element form
|
|
581
|
+
* stays a render-layer concern. No second logical convention is created.
|
|
582
|
+
*/
|
|
583
|
+
/** Inverse, or null when the matrix is singular, non-finite, or too
|
|
584
|
+
* ill-conditioned to invert meaningfully at its own scale. */
|
|
585
|
+
function invert$1(m) {
|
|
586
|
+
const det = m[0] * m[3] - m[1] * m[2];
|
|
587
|
+
const norm2 = Math.max(m[0] * m[0] + m[1] * m[1], m[2] * m[2] + m[3] * m[3]);
|
|
588
|
+
if (!(Math.abs(det) > 1e-12 * norm2)) return null;
|
|
589
|
+
const id = 1 / det;
|
|
590
|
+
const a = m[3] * id;
|
|
591
|
+
const b = -m[1] * id;
|
|
592
|
+
const c = -m[2] * id;
|
|
593
|
+
const d = m[0] * id;
|
|
594
|
+
return [
|
|
595
|
+
a,
|
|
596
|
+
b,
|
|
597
|
+
c,
|
|
598
|
+
d,
|
|
599
|
+
-(m[4] * a + m[5] * c),
|
|
600
|
+
-(m[4] * b + m[5] * d)
|
|
601
|
+
];
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/renderer/math/mat3.ts
|
|
605
|
+
/**
|
|
606
|
+
* 2D affine matrix utilities. Column-major 9 elements, matching
|
|
607
|
+
* `WebGL2RenderingContext.uniformMatrix3fv` element order so an upload needs
|
|
608
|
+
* no transpose flag.
|
|
609
|
+
*
|
|
610
|
+
* Layout (column-major):
|
|
611
|
+
* [m00, m10, 0,
|
|
612
|
+
* m01, m11, 0,
|
|
613
|
+
* tx, ty, 1]
|
|
614
|
+
*
|
|
615
|
+
* `apply(m, x, y)` returns `[m * (x, y, 1)] = [m00*x + m01*y + tx,
|
|
616
|
+
* m10*x + m11*y + ty]`.
|
|
617
|
+
*/
|
|
618
|
+
function create(a, b, c, d, tx, ty) {
|
|
619
|
+
return new Float64Array([
|
|
620
|
+
a,
|
|
621
|
+
b,
|
|
622
|
+
0,
|
|
623
|
+
c,
|
|
624
|
+
d,
|
|
625
|
+
0,
|
|
626
|
+
tx,
|
|
627
|
+
ty,
|
|
628
|
+
1
|
|
629
|
+
]);
|
|
630
|
+
}
|
|
631
|
+
function identity() {
|
|
632
|
+
return create(1, 0, 0, 1, 0, 0);
|
|
633
|
+
}
|
|
634
|
+
function multiply(out, m) {
|
|
635
|
+
const a = out[0], b = out[1];
|
|
636
|
+
const c = out[3], d = out[4];
|
|
637
|
+
const tx = out[6], ty = out[7];
|
|
638
|
+
const ma = m[0], mb = m[1];
|
|
639
|
+
const mc = m[3], md = m[4];
|
|
640
|
+
const mtx = m[6], mty = m[7];
|
|
641
|
+
return create(a * ma + c * mb, b * ma + d * mb, a * mc + c * md, b * mc + d * md, a * mtx + c * mty + tx, b * mtx + d * mty + ty);
|
|
642
|
+
}
|
|
643
|
+
/** `m · T(tx, ty)`: composes onto `m`, where `@weasel-js/geom`'s `translate`
|
|
644
|
+
* constructs a fresh matrix. */
|
|
645
|
+
function translated(m, tx, ty) {
|
|
646
|
+
return multiply(m, create(1, 0, 0, 1, tx, ty));
|
|
647
|
+
}
|
|
648
|
+
/** `m · S(sx, sy)`: composes onto `m`, where geom's `scale` constructs one. */
|
|
649
|
+
function scaled(m, sx, sy) {
|
|
650
|
+
return multiply(m, create(sx, 0, 0, sy, 0, 0));
|
|
651
|
+
}
|
|
652
|
+
/** This layout read as the kernel's 6-element affine. The two carry the same
|
|
653
|
+
* logical order, so the conversion is a repack and nothing else — it exists
|
|
654
|
+
* so the repack has a name instead of appearing inline at each crossing. */
|
|
655
|
+
function toAffine(m) {
|
|
656
|
+
return [
|
|
657
|
+
m[0],
|
|
658
|
+
m[1],
|
|
659
|
+
m[3],
|
|
660
|
+
m[4],
|
|
661
|
+
m[6],
|
|
662
|
+
m[7]
|
|
663
|
+
];
|
|
664
|
+
}
|
|
665
|
+
/** The kernel's affine in this layout. The inverse of {@link toAffine}, and
|
|
666
|
+
* what an `SvgGroupNode.transform` (also a kernel affine) becomes on its way
|
|
667
|
+
* to a `GroupDrawCommand`. */
|
|
668
|
+
function fromAffine(a) {
|
|
669
|
+
return create(a[0], a[1], a[2], a[3], a[4], a[5]);
|
|
670
|
+
}
|
|
671
|
+
/** Inverse of an affine matrix, or `null` when `@weasel-js/geom`'s `invert`
|
|
672
|
+
* finds it singular — the same rule, read through this layout. */
|
|
673
|
+
function invert(m) {
|
|
674
|
+
const inv = invert$1(toAffine(m));
|
|
675
|
+
return inv && fromAffine(inv);
|
|
676
|
+
}
|
|
677
|
+
/** A float32 copy of `m`, for `uniformMatrix3fv` or a shader uniform value. */
|
|
678
|
+
function toUniform(m) {
|
|
679
|
+
return Float32Array.from(m);
|
|
680
|
+
}
|
|
681
|
+
function apply(m, x, y) {
|
|
682
|
+
const a = m[0], b = m[1];
|
|
683
|
+
const c = m[3], d = m[4];
|
|
684
|
+
const tx = m[6], ty = m[7];
|
|
685
|
+
return [a * x + c * y + tx, b * x + d * y + ty];
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Map screen pixel coords (0..width on X, 0..height on Y, top-left origin)
|
|
689
|
+
* into clip space (-1..1 on X, 1..-1 on Y — note Y flip so screen-down
|
|
690
|
+
* matches clip-down).
|
|
691
|
+
*/
|
|
692
|
+
function screenToClip(width, height) {
|
|
693
|
+
return create(2 / width, 0, 0, -2 / height, -1, 1);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Uniform-equivalent scale factor: the square root of the absolute
|
|
697
|
+
* determinant of the linear part, i.e. the geometric mean of the two axis
|
|
698
|
+
* scales. Rotation-invariant. Under non-uniform scale it is between the two
|
|
699
|
+
* axes and exact on neither — the same compromise `meanScale` documents.
|
|
700
|
+
*/
|
|
701
|
+
function meanScaleOf(m) {
|
|
702
|
+
return Math.sqrt(Math.abs(m[0] * m[4] - m[1] * m[3]));
|
|
703
|
+
}
|
|
704
|
+
/** The least any direction is scaled by the linear part — its smaller singular
|
|
705
|
+
* value. What a screen length is worth in world units, at most. */
|
|
706
|
+
function minScaleOf(m) {
|
|
707
|
+
const sum = m[0] * m[0] + m[1] * m[1] + m[3] * m[3] + m[4] * m[4];
|
|
708
|
+
const det = m[0] * m[4] - m[1] * m[3];
|
|
709
|
+
return Math.sqrt(Math.max(0, (sum - Math.sqrt(Math.max(0, sum * sum - 4 * det * det))) / 2));
|
|
710
|
+
}
|
|
711
|
+
/** The renderer's 3x3 matrix operations, as one namespace. These work on the
|
|
712
|
+
* 9-element form the GL uniform upload wants — distinct from
|
|
713
|
+
* `@weasel-js/geom`'s 6-element affine `GlMat3`, though the logical element
|
|
714
|
+
* order is the same. */
|
|
715
|
+
const mat3 = {
|
|
716
|
+
identity,
|
|
717
|
+
toAffine,
|
|
718
|
+
fromAffine,
|
|
719
|
+
multiply,
|
|
720
|
+
translated,
|
|
721
|
+
scaled,
|
|
722
|
+
invert,
|
|
723
|
+
toUniform,
|
|
724
|
+
apply,
|
|
725
|
+
screenToClip,
|
|
726
|
+
meanScaleOf,
|
|
727
|
+
minScaleOf
|
|
728
|
+
};
|
|
729
|
+
//#endregion
|
|
572
730
|
//#region src/features/meshPaint/surface.ts
|
|
573
731
|
/** Corner `i` of the boundary walk. */
|
|
574
732
|
function patchCorner(patch, i) {
|
|
@@ -1159,12 +1317,15 @@ function mapPatches(mesh, move) {
|
|
|
1159
1317
|
points: patch.points.map(move)
|
|
1160
1318
|
}));
|
|
1161
1319
|
}
|
|
1320
|
+
/** The paint a pose-frame copy was made from. A copy is rebuilt whenever its
|
|
1321
|
+
* node's pose changes, and bakes the same texels as its source. */
|
|
1322
|
+
const BAKE_SOURCE = /* @__PURE__ */ new WeakMap();
|
|
1162
1323
|
const CACHES = /* @__PURE__ */ new WeakMap();
|
|
1163
1324
|
function cacheFor(ctx) {
|
|
1164
1325
|
let cache = CACHES.get(ctx.resources);
|
|
1165
1326
|
if (!cache) {
|
|
1166
1327
|
const gl = ctx.gl;
|
|
1167
|
-
const made = new MeshBakeCache((
|
|
1328
|
+
const made = new MeshBakeCache((texture) => gl.deleteTexture(texture));
|
|
1168
1329
|
ctx.resources.onRelease(() => {
|
|
1169
1330
|
made.clear();
|
|
1170
1331
|
CACHES.delete(ctx.resources);
|
|
@@ -1185,8 +1346,12 @@ function bakeFor(ctx, mesh) {
|
|
|
1185
1346
|
if (!box) return null;
|
|
1186
1347
|
const size = meshBakeSize(devicePixelsOf(ctx, mesh, box), ctx.maxTextureSize);
|
|
1187
1348
|
const cache = cacheFor(ctx);
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1349
|
+
const key = BAKE_SOURCE.get(mesh) ?? mesh;
|
|
1350
|
+
const hit = cache.get(key, size);
|
|
1351
|
+
if (hit) return {
|
|
1352
|
+
texture: hit,
|
|
1353
|
+
box
|
|
1354
|
+
};
|
|
1190
1355
|
const baked = bakeMesh(mesh.patches, mesh.interpolate ?? "rgb", size);
|
|
1191
1356
|
if (!baked) return null;
|
|
1192
1357
|
const gl = ctx.gl;
|
|
@@ -1199,12 +1364,11 @@ function bakeFor(ctx, mesh) {
|
|
|
1199
1364
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
1200
1365
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, baked.size, baked.size, 0, gl.RGBA, gl.UNSIGNED_BYTE, baked.pixels);
|
|
1201
1366
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
1202
|
-
|
|
1367
|
+
cache.set(key, size, texture);
|
|
1368
|
+
return {
|
|
1203
1369
|
texture,
|
|
1204
|
-
|
|
1370
|
+
box
|
|
1205
1371
|
};
|
|
1206
|
-
cache.set(mesh, size, entry);
|
|
1207
|
-
return entry;
|
|
1208
1372
|
}
|
|
1209
1373
|
function bindMesh(ctx, fill) {
|
|
1210
1374
|
const mesh = asMesh(fill);
|
|
@@ -1218,11 +1382,11 @@ function bindMesh(ctx, fill) {
|
|
|
1218
1382
|
const gl = ctx.gl;
|
|
1219
1383
|
gl.useProgram(program.handle);
|
|
1220
1384
|
ctx.setProjAndModel(program);
|
|
1221
|
-
gl.uniformMatrix3fv(program.uniform("u_worldInv"), false, inverse);
|
|
1385
|
+
gl.uniformMatrix3fv(program.uniform("u_worldInv"), false, mat3.toUniform(inverse));
|
|
1222
1386
|
gl.activeTexture(gl.TEXTURE0);
|
|
1223
1387
|
gl.bindTexture(gl.TEXTURE_2D, entry.texture);
|
|
1224
1388
|
gl.uniform1i(program.uniform("u_sampler"), 0);
|
|
1225
|
-
const { box } = entry
|
|
1389
|
+
const { box } = entry;
|
|
1226
1390
|
gl.uniform2f(program.uniform("u_meshOrigin"), box.x, box.y);
|
|
1227
1391
|
gl.uniform2f(program.uniform("u_meshSize"), box.width, box.height);
|
|
1228
1392
|
gl.uniform1f(program.uniform("u_opacity"), mesh.opacity ?? 1);
|
|
@@ -1247,7 +1411,7 @@ const meshGradientKind = {
|
|
|
1247
1411
|
inPoseFrame: (fill, box) => {
|
|
1248
1412
|
const mesh = asMesh(fill);
|
|
1249
1413
|
if (mesh.units !== "bounds") return fill;
|
|
1250
|
-
|
|
1414
|
+
const posed = asFill({
|
|
1251
1415
|
...mesh,
|
|
1252
1416
|
patches: mapPatches(mesh, (p) => ({
|
|
1253
1417
|
x: box.x + p.x * box.width,
|
|
@@ -1255,6 +1419,8 @@ const meshGradientKind = {
|
|
|
1255
1419
|
})),
|
|
1256
1420
|
units: "local"
|
|
1257
1421
|
});
|
|
1422
|
+
BAKE_SOURCE.set(posed, fill);
|
|
1423
|
+
return posed;
|
|
1258
1424
|
},
|
|
1259
1425
|
toBoundsFrame: (fill, box) => {
|
|
1260
1426
|
const mesh = asMesh(fill);
|