Skip to content

Add basic shapes to the example drawing - #675

Open
Chuyutseng wants to merge 4 commits into
sysprog21:mainfrom
Chuyutseng:add-example-shape-tools
Open

Chuyutseng wants to merge 4 commits into
sysprog21:mainfrom
Chuyutseng:add-example-shape-tools

Conversation

@Chuyutseng

@Chuyutseng Chuyutseng commented Nov 12, 2026 •

Copy link
Copy Markdown

Problem and behavior

As described in #625, candidates currently need to draw basic shapes freehand when illustrating coding examples, making it difficult to create consistent diagrams.

Add Line, Rectangle and Ellipse tools to the Example drawing toolbar. Each tool previews the shape while dragging and commits it as one undoable edit when the pointer is released. Selecting a color preserves the active shape tool.

Approach

Follow the agreed approach in the issue discussion by representing each completed shape as an ordinary stroke: two endpoints for a line, a closed four-corner path for a rectangle, and a closed polyline for an ellipse.

Dragging replaces the uncommitted preview rather than adding intermediate shapes to the journal. Completed shapes reuse the existing color, undo, clear, recording, replay and reconnection paths without introducing a new operation kind.

Update the drawing-tool documentation to match the supported tools.

Validation

./scripts/test.sh browser passed on the final head: 3,155 passed, zero failures, and one test skipped because ffmpeg is unavailable.

make build passed. Manual checks of the local drawing preview covered all three tools, color selection, Undo and Clear. Additional browser probes checked keyboard selection, cancellation when the board becomes locked, and stroke/point capacity boundaries.

Browser regression tests verify all four drag directions, shape geometry, painted pixels, preview/journal separation, color selection, undo, clear, replay, reconnection and cancellation.

The full gate was attempted but did not pass. The fork's stale origin/main caused Rust size-baseline findings; the fork has since been synchronized, but the full gate was not rerun. An unchanged Rust handoff test also failed with a socket fixture/handshake error, including when run in isolation. The run was stopped during desktop dependency setup, so the remaining checks were not completed.

A credentialed live interview was not run. Replay and reconnection were checked through local browser regressions.

Screenshots

screenshots

Closes #625


Summary by cubic

Adds Line, Rectangle, and Ellipse tools to the Example drawing toolbar so candidates can produce consistent diagrams while explaining examples. Shapes preview while dragging and commit as one ordinary, replayable stroke on release, closing #625.

  • Rectangle commits as a closed four-corner path and ellipse as a closed 128-segment polyline; drag previews are not journaled.
  • Completed shapes reuse the existing color, undo, clear, recording, replay, and reconnection paths; selecting a color preserves the active shape tool. Color buttons are renamed to their color name alone, and the group is now labelled "Colour".
  • Pointer movement uses the board's own rounding and bounds, so sub-pixel drags no longer rebuild an unchanged preview. Shapes that collapse to one pixel, and shapes finished before any move, are dropped without an edit; pen clicks still leave dots. A shape that drops the shared preview also resends the restored board.
  • Updates drawing-tool docs and adds shared browser test helpers covering drag directions, geometry, pixel output, cancellation, history, reconnect flush, and the 2 s flush deadline.
  • The Chromium CI action gains a full-browser input, letting only the browser lane install full Chromium for native pointer capture; all other lanes keep the headless shell, with a matching cache key and gate coverage.

Written for commit f6d54af. Summary will update on new commits.

View guided diff

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

@jserv

jserv commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

The required interactive review for the 206-line change was completed on the current head.

Remove this statement, as it adds no value to the conversation.

@Chuyutseng
Chuyutseng force-pushed the add-example-shape-tools branch from 80fcea8 to 6ae0eeb Compare November 12, 2026 12:38
cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

@LeafYeh1 LeafYeh1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two points: the preview-dropping steps the collapsed-shape branch copies, and the cost of the new browser cases.

Comment thread web/example-board.js Resolved
Comment thread tests/browser/example-board-ui.test.js Resolved
jserv

This comment was marked as resolved.

@Chuyutseng
Chuyutseng force-pushed the add-example-shape-tools branch from 6ae0eeb to 898e630 Compare November 13, 2026 06:18
jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

@Chuyutseng
Chuyutseng force-pushed the add-example-shape-tools branch from 898e630 to 0d8d536 Compare November 13, 2026 07:26
cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

@Chuyutseng
Chuyutseng force-pushed the add-example-shape-tools branch from 0d8d536 to af34b09 Compare November 16, 2026 08:04
@Chuyutseng
Chuyutseng requested a review from alanhc as a code owner November 16, 2026 08:04
cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

Candidates need consistent diagrams while explaining coding examples.
Preview each shape during dragging and commit its outline as an ordinary
stroke so existing undo, recording, replay and reconnection keep
working. Cover direction, color, pixels, cancellation and history in
browser tests.

Close sysprog21#625

Change-Id: I20c06c511222c2ebe50811ca0c4c24999ced3a05
@Chuyutseng
Chuyutseng force-pushed the add-example-shape-tools branch from af34b09 to 6bc2a62 Compare November 16, 2026 09:51
jserv

This comment was marked as resolved.

Ending an interview can finish a held shape before any pointer move.
Cover empty boards and an existing text label so removing the unopened
stroke guard is caught as a rejected finish instead of reaching users.

Change-Id: I32d7801e64f53abfc24c949af77967a39af5637b
jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

Repeated image decoding and fixed mouse scales make the shape tests
harder to maintain. Decode uploads in the shared publisher, keep tool
point counts in one table, and derive native mouse positions from the
canvas bounds and board dimensions.

Change-Id: I0d1f2eab4bdf54e1e2c7f33698f09f0c599e4743
Comment thread web/example-board.js Resolved
Comment thread tests/browser/example-board-ui.test.js Resolved
Sub-pixel pointer moves rebuilt shape previews even when the stored
stroke stayed on the same pixels. Reuse the board model clamp so drag
comparisons and stored points share rounding and bounds.

Check that reconnect flushes successfully and uploads the canvas JPEG,
so a stale image cannot pass on its stroke count alone.

Change-Id: I8fbf226490b25f15f674ccf5a7ea5fda2d761e43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add basic shape tools to the example drawing area

3 participants