Skip to content

fix: live shape previews, dropdown type-ahead, and mixed fonts in one text layer - #104

Merged
IAmJSD merged 3 commits into
mainfrom
t3code/8029003f
Sep 3, 2026
Merged

IAmJSD merged 3 commits into
mainfrom
t3code/8029003f

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Sep 3, 2026

Copy link
Copy Markdown
Member

Closes #99, #100 and #101.

Shape tools (#101)

The rectangle, ellipse, polygon, line and custom shape tools now show the real shape, fill and all, while it is being dragged out. The preview is the very layer the drag would commit, rebuilt on each move and kept outside history (DragPreview in plugins/tools-vector); on release it is re-inserted as the single undoable edit, and cancelling or switching tool drops it. The old overlay drew a rectangle for every kind.

Dropdowns (#100)

Every dropdown follows the keyboard while open: typing jumps to the first row starting with what was typed (a one-second pause starts a new word; a letter pressed repeatedly cycles through its rows), Up/Down/Home/End walk the rows, Enter picks the highlighted one. The open dropdown publishes its rows through a thread-local the way dialogs publish their default action (ui::open_dropdown). The layers panel's hand-rolled blend-mode menu now uses the shared widget. Escape on a dropdown inside a dialog now closes the dropdown rather than the whole dialog.

Text layers (#99)

TextSpec gains runs: byte ranges that override the layer's family, style or size, so one layer can mix fonts. The engine resolves one face per distinct style, kerns only within a face, sizes each line to its tallest face and places the caret from the same pass as the glyphs. In the type tool a selection takes the bar's font, style or size for just those characters; with nothing selected the whole layer changes as before; typing after a styled word continues in it, and the bar follows the caret. Plain specs serialize byte-for-byte as before, so existing files load unchanged. A new LayerExtrasSet history op makes "Edit Text" undo the spec and layer name together with the pixels (they previously drifted apart after an undo).

Verification

  • cargo check --workspace --all-targets clean; tests pass in schist-core, schist-text-engine, schist-tools-vector, schist-tools-type and schist-app (new tests for each feature).
  • Driven headlessly in the release build (Xvfb + lavapipe): rectangle drag shows the filled shape at every pointer position; m in the blend menu jumps to Multiply, Down + Enter commits Color Burn; b picks Bold and d/dd/ddd cycle the DejaVu families in the font menu; "hi there" renders with "there" in a different family on one layer.

Left out

  • Per-run colour (needs per-run coverage from the engine; colour stays per layer).
  • Affinity import still flattens a text object's character runs to the first one; the runs are in the file, so wiring them up is a follow-up.
  • The wasm build was not exercised.

🤖 Generated with Claude Code

… text layer

Closes #99, #100 and #101.

Shape tools (#101): the rectangle, ellipse, polygon, line and custom
shape tools now show the real shape, fill and all, while it is being
dragged out. The preview is the very layer the drag would commit,
rebuilt on each move and kept outside history; on release it is
re-inserted as the single undoable edit, and cancelling drops it. The
old overlay drew a rectangle for every kind.

Dropdowns (#100): every dropdown follows the keyboard while open. Typing
jumps to the first row starting with what was typed (a pause of a second
starts a new word; a letter pressed repeatedly cycles through its rows),
the arrows and Home/End walk the rows, Enter picks the highlighted one.
The open dropdown publishes its rows through a thread-local the way
dialogs publish their default action. The layers panel's hand-rolled
blend-mode menu now uses the shared widget. Escape on a dropdown inside
a dialog closes the dropdown rather than the dialog.

Text layers (#99): `TextSpec` gains `runs`, byte ranges that override the
layer's family, style or size, so one layer can mix fonts. The engine
resolves one face per distinct style, kerns only within a face, sizes
each line to its tallest face and places the caret from the same pass
as the glyphs. In the type tool, a selection takes the bar's font, style
or size for just those characters; with nothing selected the whole
layer changes as before; typing after a styled word continues in it and
the bar follows the caret. Plain specs serialize exactly as before, so
existing files load unchanged. A new `LayerExtrasSet` history op makes
"Edit Text" undo the spec and layer name together with the pixels,
which previously drifted apart.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@IAmJSD

IAmJSD commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

seems to fix 101 and 100, 99 still seems broken and linter broke

@IAmJSD
IAmJSD merged commit d46a679 into main Sep 3, 2026
4 checks passed
@IAmJSD
IAmJSD deleted the t3code/8029003f branch September 3, 2026 23:50
@IAmJSD

IAmJSD commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Addressed the review follow-ups in 9e98156 and 2afdddf:

  • Font layers don't support multiple fonts #99 is now reachable with the mouse: clicking places the caret and dragging creates a real text selection, so changing the font/style/size affects only that range.
  • The selected range now uses a translucent blue background and is clipped inside the text layer's main bounding box (no raised secondary outline).
  • Fixed the strict Clippy failure in ui.rs and the additional single-character insertion lints exposed by the current toolchain.

Verification:

  • Real headless GUI drag over one word, including the rendered selection highlight
  • cargo clippy --workspace --all-targets -- -D warnings
  • Workspace/focused tests and app build locally
  • Final GitHub checks green: Web, Ubuntu, macOS, and Windows

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.

Font layers don't support multiple fonts

1 participant