Skip to content

fix: always-on annotate tools, draw z-order, and bare image rendering#181

Merged
lklyne merged 6 commits into
mainfrom
fix/toolbar-tools-and-draw-zorder
May 31, 2026
Merged

fix: always-on annotate tools, draw z-order, and bare image rendering#181
lklyne merged 6 commits into
mainfrom
fix/toolbar-tools-and-draw-zorder

Conversation

@lklyne
Copy link
Copy Markdown
Owner

@lklyne lklyne commented May 31, 2026

Summary

  • Toolbar tools no longer require a frame. Draw, Comment, and Inspect are always enabled — removed the hasPages-gated disabled state (and the now-unused annotateAvailable/inspectAvailable locals + prop) so these tools work on an empty canvas.
  • Live drawing stroke renders above file entities. Moved DrawingLayer below StackedCanvasItems so the in-progress stroke sits at the z-order a freshly committed drawing lands at — strokes no longer hide behind frames.
  • Image entities render bare. Image file entities drop the card background, shadow, and border radius, and skip the filename chrome — just the image. The filename still surfaces via the selection popover. The "bare image" rule is centralized in a shared isBareImageEntity predicate used by both the body card and chrome overlay.

Test plan

  • On an empty canvas (no pages), Draw / Comment / Inspect toolbar buttons are enabled and activate.
  • Draw a stroke over a page/frame — the live preview renders above the frame while drawing, matching where it lands once committed.
  • Drop an image onto the canvas — it shows with no card/shadow/border and no filename header; selecting it shows the name in the popover.
  • pnpm typecheck passes.

🤖 Generated with Claude Code

lklyne and others added 6 commits May 31, 2026 13:01
These tools were gated on hasPages, leaving them disabled when the
canvas had no pages or none was selected. Remove the gating so they
work on an empty canvas. hasPages still gates browser-mode toggles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The in-progress drawing preview mounted before StackedCanvasItems, so
with no explicit z-index it painted under file entities and snapped on
top only after commit. Render the preview after StackedCanvasItems so
the live stroke sits where a freshly committed drawing lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Image file entities now render with no background, shadow, or filename
chrome — just the bare image. The selection outline still shows on
select, and the selection popover surfaces the filename. Other file
types keep their card chrome.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract isBareImageEntity predicate shared by the body card and chrome
overlay, and collapse the bare-vs-carded condition in FileBodyLayer into a
single isChromeless local.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The prior refactor commit added entityPresentation.ts but imported a
non-existent './types' module and never wired the helper in, leaving dead
code that broke typecheck. Import CanvasSceneFileEntity from shared/types,
use the helper in FileBodyLayer and FileChrome, and collapse the
bare-vs-carded card condition into a single isChromeless local.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The extracted isBareImageEntity helper tripped fallow's unused-export gate
(its importer detection missed the new one-symbol module). Inline the
`rendererTag === 'image'` check at both sites and delete entityPresentation.ts,
keeping the isChromeless collapse. Behavior-identical; typecheck and fallow pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lklyne lklyne merged commit 4372892 into main May 31, 2026
@lklyne lklyne deleted the fix/toolbar-tools-and-draw-zorder branch May 31, 2026 22:29
lklyne added a commit that referenced this pull request Jun 1, 2026
* fix(toolbar): let draw/comment/inspect activate with no pages

PR #181 removed the hasPages-gated `disabled` on the Draw/Comment/Inspect
toolbar buttons, but a second, main-side gate remained: sanitizeForPages()
in tool-mode silently collapsed annotation/inspect tools back to `select`
when the canvas had zero pages. So the buttons looked clickable but the
activation died in main — the draw tool never became active and its
DrawToolPopup (gated on activeTool.kind === 'draw') never appeared.

Remove the page collapse entirely so draw, comment, and inspect activate on
an empty canvas, matching the always-enabled buttons. Only the drawing
feature flag can veto a tool now. The inspect path is already defensive
about zero pages (syncInspectionState loops over an empty pages list;
panel data reports available/annotateAvailable = pages.length > 0;
inspection enable is forced false with no pages), so no tool crashes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(panel): keep comment toggle available with no pages

The right panel's "Add comments" button gated on pages.length > 0, but
the toolbar comment tool now activates on an empty canvas. Make
annotateAvailable always true so both surfaces agree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant