feat(canvas): preview per-segment stroke styles live in the path editor

The vertex editor now hides the base path's uniform stroke when
segment styles exist and overlays one non-hittable path per stroke
segment, resyncing their geometry on every path-editor change and
editor drag so multi-color boolean outlines stay accurate while
editing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 00:59:35 +08:00
parent ca101fd916
commit b5aa547c36
2 changed files with 70 additions and 10 deletions
+5 -1
View File
@@ -161,7 +161,11 @@ test("keeps the Pen tool immediately after Shape in the workspace toolbar", asyn
assert.match(workspaceSource, /settings=\{activeTool === "path" \? pathPenControlSettings : penSettings\}/);
assert.match(workspaceSource, /updateShapeStyle\(pathPenControlNode\.id, pathPenSettingsToShapeStyle\(settings, viewportRef\.current\.k\)\);/);
assert.match(pathEditorSource, /const pathRef = useRef<import\("leafer-ui"\)\.Path \| null>\(null\);/);
assert.match(pathEditorSource, /pathRef\.current\?\.set\(pathNodeStyle\(node\)\);/);
assert.match(pathEditorSource, /pathRef\.current\?\.set\(pathNodeStyle\(node, strokeSegments\.length > 0\)\);/);
assert.match(pathEditorSource, /strokePathRefs\.current/);
assert.match(pathEditorSource, /strokeSegmentsForEditedPath\(pathData, strokeSegmentsRef\.current\)/);
assert.match(pathEditorSource, /DragEvent\.DRAG/);
assert.match(pathEditorSource, /editTargetDuplicate/);
assert.doesNotMatch(workspaceSource, /startPenDrawing\(event, true\)/);
assert.match(workspaceSource, /key === "p"\) return void run\(\(\) => chooseCanvasTool\("path"\)\)/);
assert.match(workspaceSource, /key === "b"\) return void run\(\(\) => chooseCanvasTool\("pen"\)\)/);