Skip to content

Commit 7f7a8e7

Browse files
author
DavidQ
committed
Fix Object Preview selection drawing style snap and Paint Stroke behavior - PR_26133_069-object-preview-selection-style-and-snap-fixes
1 parent 99ca943 commit 7f7a8e7

4 files changed

Lines changed: 49 additions & 22 deletions

File tree

docs/dev/reports/playwright_v8_coverage_report.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Playwright V8 Coverage Report
1+
# Playwright V8 Coverage Report
22

3-
PR: PR_26133_066-paint-stroke-picker-and-transparent-right-click
3+
PR: PR_26133_069-object-preview-selection-style-and-snap-fixes
44

55
Source: docs/dev/reports/playwright_v8_coverage_report.txt generated by the latest npm run test:workspace-v2 run.
66

@@ -21,13 +21,9 @@ Source: docs/dev/reports/playwright_v8_coverage_report.txt generated by the late
2121

2222
## Changed Runtime JS Files Covered
2323

24-
- (95%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 6355/6355; executed functions 644/676
24+
- (95%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 6357/6357; executed functions 644/676
2525

2626
## Changed JS Files Considered
2727

2828
- (0%) tests/playwright/tools/WorkspaceManagerV2.spec.mjs - Playwright test file, not collected as browser runtime coverage
2929
- (95%) tools/object-vector-studio-v2/js/ToolStarterApp.js - changed runtime JS file with browser V8 coverage
30-
31-
## Non-JS Changed Files
32-
33-
- tools/object-vector-studio-v2/index.html - markup change, not applicable to V8 coverage

docs/dev/reports/playwright_workspace_v2_results.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
# Playwright Workspace V2 Results
1+
# Playwright Workspace V2 Results
22

3-
PR: PR_26133_066-paint-stroke-picker-and-transparent-right-click
3+
PR: PR_26133_069-object-preview-selection-style-and-snap-fixes
44

55
## Validation
66

77
- PASS: npm run test:workspace-v2
88
- Result: 54 passed
9-
- Runtime: 5.0m
9+
- Runtime: 4.9m
1010
- Browser project: playwright
1111
- Workers: 1
1212

1313
## Targeted Checks Covered
1414

15-
- Picker tool renders with the Nerd Font eye-dropper icon and samples fill/stroke colors, opacities, and stroke width into palette controls without recoloring shapes.
16-
- Paint and Stroke remain independent modes; selecting Shape/Tools activates Stroke mode and drawing keeps Stroke active.
17-
- Right-click inside Object Preview suppresses the browser context menu and applies transparent fill/stroke only to the clicked shape based on the active palette mode.
18-
- Fill and Stroke opacity values stay unchanged unless directly edited; applying Stroke does not mutate Fill opacity and applying Paint does not mutate Stroke opacity.
19-
- Selected circle resize handles render larger while existing non-circle selection chrome remains unchanged.
15+
- New Object Vector Studio V2 shapes are committed stroke-only with transparent fill for line, polygon, polyline, rectangle, square, circle, ellipse, triangle, and text drawing flows.
16+
- Empty canvas click deselects the current shape and clicking inside another shape selects it.
17+
- Selected shape click-hold-drag movement updates live through the preview surface.
18+
- Circle selection handle resize updates circle geometry.
19+
- Snap Grid stores whole logical coordinates and Snap None preserves fractional coordinates.
20+
- Paint and Stroke stay independent; applying Stroke does not mutate Fill opacity and applying Paint does not mutate Stroke opacity.
21+
- Selecting Shape/Tools activates Stroke mode.
2022

2123
## Console/Runtime Errors
2224

tests/playwright/tools/WorkspaceManagerV2.spec.mjs

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
22852285
geometry: createdRectangleSchemaDefaults.schemaGeometry,
22862286
locked: createdRectangleSchemaDefaults.schemaShapeCommon.locked,
22872287
style: {
2288-
fill: "#ffffff",
2288+
fill: "#00000000",
22892289
fillOpacity: createdRectangleSchemaDefaults.schemaStyle.fillOpacity,
22902290
stroke: "#ffffff",
22912291
strokeOpacity: createdRectangleSchemaDefaults.schemaStyle.strokeOpacity,
@@ -3397,6 +3397,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
33973397
fields,
33983398
geometry: shape.geometry,
33993399
schemaOk: app.schemaService.validatePayload(app.currentPayload).ok,
3400+
style: shape.style,
34003401
tool: shape.tool
34013402
};
34023403
});
@@ -3408,6 +3409,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
34083409
],
34093410
geometry: { height: 60, width: 60, x: -80, y: -30 },
34103411
schemaOk: true,
3412+
style: { fill: "#00000000", fillOpacity: 1, stroke: "#ffffff", strokeOpacity: 1, strokeWidth: 3 },
34113413
tool: "square"
34123414
});
34133415

@@ -3502,14 +3504,15 @@ test.describe("Workspace Manager V2 bootstrap", () => {
35023504
await drawObjectVectorShape(page, "polyline", [{ x: -20, y: 20 }, { x: 0, y: 0 }, { x: 20, y: 20 }]);
35033505
await expect(page.locator("#objectVectorStudioV2RenderSurface polyline[data-shape-index='2']")).toHaveCount(1);
35043506
const pointDrawnShapes = await page.evaluate(() => window.__objectVectorStudioV2App.selectedObject().shapes.map((shape) => ({
3507+
fill: shape.style.fill,
35053508
geometry: shape.geometry,
35063509
stroke: shape.style.stroke,
35073510
tool: shape.tool
35083511
})));
35093512
expect(pointDrawnShapes).toMatchObject([
3510-
{ geometry: { point1: { x: -10, y: 0 }, point2: { x: 10, y: 0 } }, stroke: "#6fd3ff", tool: "line" },
3511-
{ geometry: { points: [{ x: -10, y: -10 }, { x: 10, y: -10 }, { x: 10, y: 10 }, { x: -10, y: 10 }] }, stroke: "#6fd3ff", tool: "polygon" },
3512-
{ geometry: { points: [{ x: -20, y: 20 }, { x: 0, y: 0 }, { x: 20, y: 20 }] }, stroke: "#6fd3ff", tool: "polyline" }
3513+
{ fill: "#00000000", geometry: { point1: { x: -10, y: 0 }, point2: { x: 10, y: 0 } }, stroke: "#6fd3ff", tool: "line" },
3514+
{ fill: "#00000000", geometry: { points: [{ x: -10, y: -10 }, { x: 10, y: -10 }, { x: 10, y: 10 }, { x: -10, y: 10 }] }, stroke: "#6fd3ff", tool: "polygon" },
3515+
{ fill: "#00000000", geometry: { points: [{ x: -20, y: 20 }, { x: 0, y: 0 }, { x: 20, y: 20 }] }, stroke: "#6fd3ff", tool: "polyline" }
35133516
]);
35143517
const strokeOnlyPolygonBeforeSelection = await page.evaluate(() => {
35153518
const app = window.__objectVectorStudioV2App;
@@ -3586,6 +3589,33 @@ test.describe("Workspace Manager V2 bootstrap", () => {
35863589
await expect(page.locator("#objectVectorStudioV2SnapModeButton")).toHaveText("Snap Grid");
35873590
await expect(page.locator("#objectVectorStudioV2SnapModeButton")).toHaveAttribute("data-snap-mode", "grid");
35883591

3592+
await drawObjectVectorShape(page, "rectangle", [{ x: -80, y: -30 }, { x: -20, y: 30 }]);
3593+
await drawObjectVectorShape(page, "square", [{ x: -60, y: -30 }, { x: -10, y: 20 }]);
3594+
await drawObjectVectorShape(page, "circle", [{ x: 20, y: -20 }, { x: 45, y: -20 }]);
3595+
await drawObjectVectorShape(page, "ellipse", [{ x: 60, y: -30 }, { x: 95, y: -5 }]);
3596+
await drawObjectVectorShape(page, "triangle", [{ x: -30, y: 50 }, { x: 10, y: 80 }]);
3597+
await drawObjectVectorShape(page, "text", [{ x: 50, y: 50 }]);
3598+
const strokeOnlyCreatedShapes = await page.evaluate(() => {
3599+
const createdTools = ["rectangle", "square", "circle", "ellipse", "triangle", "text"];
3600+
return window.__objectVectorStudioV2App.selectedObject().shapes
3601+
.filter((shape) => createdTools.includes(shape.tool))
3602+
.map((shape) => ({
3603+
fill: shape.style.fill,
3604+
fillOpacity: shape.style.fillOpacity,
3605+
stroke: shape.style.stroke,
3606+
strokeOpacity: shape.style.strokeOpacity,
3607+
tool: shape.tool
3608+
}));
3609+
});
3610+
expect(strokeOnlyCreatedShapes).toEqual([
3611+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "rectangle" },
3612+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "square" },
3613+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "circle" },
3614+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "ellipse" },
3615+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "triangle" },
3616+
{ fill: "#00000000", fillOpacity: 1, stroke: "#6fd3ff", strokeOpacity: 1, tool: "text" }
3617+
]);
3618+
35893619
expect(pageErrors).toEqual([]);
35903620
expect(consoleErrors).toEqual([]);
35913621
} finally {

tools/object-vector-studio-v2/js/ToolStarterApp.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,7 +3540,7 @@ export class ToolStarterApp {
35403540
locked: false,
35413541
order: 0,
35423542
style: {
3543-
fill: ["arc", "line", "polyline"].includes(tool) ? "none" : (this.currentTargetColor() || "#ffffff"),
3543+
fill: TRANSPARENT_STYLE_COLOR,
35443544
fillOpacity: this.selectedFillOpacity,
35453545
stroke: this.selectedStrokeColor || this.currentTargetColor() || "#ffffff",
35463546
strokeOpacity: this.selectedStrokeOpacity,
@@ -4637,10 +4637,9 @@ export class ToolStarterApp {
46374637
createShapeStyleDefault(type, color) {
46384638
const style = this.schemaDefault("style");
46394639
const strokeColor = this.selectedStrokeColor || color;
4640-
const fillColor = this.selectedFillColor || color;
46414640
return {
46424641
...style,
4643-
fill: ["arc", "line", "polyline"].includes(type) ? "none" : fillColor,
4642+
fill: TRANSPARENT_STYLE_COLOR,
46444643
fillOpacity: this.selectedFillOpacity,
46454644
stroke: strokeColor,
46464645
strokeOpacity: this.selectedStrokeOpacity

0 commit comments

Comments
 (0)