feat: add canvas annotation system (rect, line, text draw tools)#122
Open
theblondealex wants to merge 2 commits into
Open
feat: add canvas annotation system (rect, line, text draw tools)#122theblondealex wants to merge 2 commits into
theblondealex wants to merge 2 commits into
Conversation
Adds a draw toolbar button next to the settings cog that opens a popover with three annotation tools: - Rectangle: drag to place a rounded border box for grouping terminals visually; click/drag only activates on the stroke (interior is transparent to events) - Line: free-draw or click two terminals to create an anchored connector; connected lines track terminal movement and only detach when the line itself is dragged individually - Text: click to place a label; double-click to edit in-place All annotations: - Render behind the tile layer in a dedicated annotation layer (SVG for lines/rects, DOM for text) - Are moveable by click+drag; multi-select via marquee (blue highlight) and drag moves the whole group including any selected tiles together - Show a per-annotation popover on single click: trash (Delete/Backspace also works), hex colour input, ±font size for text - Persist to canvas-state.json alongside tiles on every change - Adapt default colour to light/dark mode via the --muted CSS variable Draw-line mode highlights hovered terminals with a green glow (muted pre-click, solid post-click) and shows a dashed preview line while connecting; Escape cancels at any point. Pencil button is positioned to the right of the update pill and left of the settings cog, with dynamic positioning when the pill is visible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Working on a large project in Collab often means dozens of terminal and browser tiles scattered across a canvas with no way to communicate structure to yourself have order to the different projects you might run in parralell. There's no way to group related tiles, label what something does, or draw a connection between two terminals that are part of the same pipeline.
This comes up directly in #29 (canvas needs a way to visually group/organise tiles) and #25 (users want to annotate and label their workspace). Right now the only option is careful spatial arrangement, which breaks down fast as a canvas grows.
This PR adds a lightweight annotation layer — rects to group tiles, lines to connect them, and text labels — so you can impose structure on a canvas without changing how tiles themselves work.
Demo video
annotations.1.1.mov
note since recording the video the location of the draw has moved to near the + like below, and colour of the popovers to match DS
Changes
src/windows/shell/src/annotation-manager.tssrc/windows/shell/src/annotation-renderer.tssrc/windows/shell/index.htmlsrc/windows/shell/src/shell.csssrc/windows/shell/src/renderer.jssrc/windows/shell/src/tile-interactions.jsonGroupDragStart/onGroupDragMove/onGroupDragEndcallbacks for cross-system dragsrc/windows/shell/src/tile-manager.jsattachDragsrc/main/canvas-persistence.tsAnnotationStateunion type to the persisted canvas schemaHow it works
<g>elements for rects and lines (inside a masked group that hides annotations under tiles), DOM<div>elements for textcanvas-state.jsonalongside tiles on every change;annotationsis optional in the schema so existing state files load cleanly--mutedCSS variable so it adapts to light/dark modeCloses #29, closes #25