Skip to content

Sliders: the shared craft-ui ZoomBar and Slider - #267

Draft
brzuchal wants to merge 10 commits into
storytold:mainfrom
brzuchal:craft-ui-slider
Draft

brzuchal wants to merge 10 commits into
storytold:mainfrom
brzuchal:craft-ui-slider

Conversation

@brzuchal

@brzuchal brzuchal commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

DeckCraft's sliders now use the shared components from storytold/craft-libs#33. Before/after screenshots for all three Office-style apps are in that PR.

Draft: craft-ui is pinned to the head of storytold/craft-libs#33 in my fork (brzuchal/craft-libs@61f7ab8, on egui 0.37 like DeckCraft; it reports a drag's end value on release, so Interface size applies when the slider is let go, #767, reads the zoom bar to screen readers in percent with a "Zoom level" percentage, and names a slider's value field like the slider). I'll repin it to storytold/craft-libs and mark this ready once that PR merges. This adds craft-ui as a new dependency of deckcraft-ui-egui; DeckCraft didn't use it before.

In DeckCraft's theme egui's slider rail is invisible: every slider showed only a lone rounded handle, with its value far to the right.

  • Status bar: ZoomBar.
    • Replaces the percentage label, the magnifier icons and the egui slider.
    • Adds a visible orange track, a tick at 100% and double-click back to 100%.
    • Thin −/+ sit right at the track, as in PowerPoint and in WordCraft and GridCraft.
    • The percentage has a fixed width, so going from 99% to 100% no longer moves the slider under the pointer.
    • "Fit slide to current window" stays as it was.
    • Behaviour change to check: −/+ now step to the previous/next multiple of 10% (as in WordCraft and GridCraft) instead of calling view.zoomIn/view.zoomOut. The slider still sets app.ui.zoom over 10–400%, logarithmic.
  • Format Shape uses Slider with its value field:
    • Fill › Transparency (also a gradient stop's transparency);
    • Effects › Glow and Soft Edges size, in pt;
    • Picture › Brightness, Contrast (mark 0), Saturation (mark 1×) and Transparency (now shown in %).
    • These apply on drag end, as before, and also when the value is typed or changed with the keyboard. Before, a typed value in the glow and picture sliders was not applied.
  • Preferences › Interface size: Slider with its value field, step 0.05, mark 1.00×.
  • Colours: widgets::slider_style / zoom_bar_style map DeckCraft's tokens.

Tests

On Rust 1.95.0:

  • cargo test -p deckcraft-ui-egui passes (12).
  • cargo fmt --check and cargo clippy -p deckcraft-ui-egui --all-targets -- -D warnings are clean.

The fixed size and the stepping of the bar are covered by craft-ui's own tests in #33. DeckCraft has no UI harness test for the status bar, so I didn't add one here.

The status bar's zoom becomes craft_ui::slider::ZoomBar
(storytold/craft-libs#33): a visible filled track, a tick and
double-click at 100%, thin -/+ right at the track instead of the
magnifier icons, and a fixed-width percentage, so the slider no longer
moves under the pointer when the zoom goes from 99% to 100%. Format
Shape (fill and gradient-stop transparency, glow, soft edges, picture
brightness, contrast, saturation and transparency) and Preferences
(interface size) use craft_ui::slider::Slider with its value field;
values apply when a drag ends or the field or keyboard changes them.

craft-ui is pinned to the storytold#33 commit in a fork until it merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brzuchal and others added 3 commits October 14, 2026 19:23
Takes main's Format Shape glow (size, colour, transparency) and text
fill transparency, and moves their sliders (fx_slider and
text_transparency_slider) onto the shared craft-ui Slider like the rest
of the pane; the shared slider holds the value while dragging, so their
own drag bookkeeping goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared zoom bar's percentage now opens the Zoom dialog through
main's view.zoomDialog command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Format Shape's fill transparency keeps main's fix (seeded from the
selected shape, per-shape id, nothing written when the value is
unchanged) on the shared craft-ui Slider, which is now named "Fill
transparency" so its label stays the only "Transparency" node. The zoom
bar shows the scale the slide is drawn at, as main's percentage does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brzuchal and others added 2 commits October 15, 2026 04:14
Preferences' Interface size keeps main's apply-on-release (storytold#767) on the
shared craft-ui Slider: nothing rescales while the slider is held, and
the size applies when it is let go or changed from the keyboard or the
value field. craft-ui moves to brzuchal/craft-libs@28aac8d
(storytold/craft-libs#33), whose release frame reports where the drag
ended; main's interface_size_applies_when_the_slider_is_let_go passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only Cargo.lock conflicted: main's lockfile is kept (craft-pdf from the
shared PDF writer) and cargo adds the craft-ui entry, nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…ld#267)

text_of_a_protected_document_without_the_password_fails failed on main: both protected
tests wrote to-protect.pdf / protected.pdf / protect.json at the same paths, and tests run
in parallel. Each now uses its own names.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fill transparency: main's seed reads a picture fill's alpha too; it now feeds the shared slider. Status bar: the shared ZoomBar stays, and main's status_bar_controls_have_names test passes on it with craft-ui 677d0aa (storytold/craft-libs#33), whose slider reads in percent with its range and whose percentage is a "Zoom level" button with the percentage as its value. The gradient stop's slider is named "Stop transparency", so only the row label reads "Transparency" (main's fill test counts those), and its pending value is cleared with the type it was stored as (f64).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

brzuchal and others added 3 commits October 25, 2026 18:17
Main moved DeckCraft to egui 0.37 and named the plain egui sliders it had where this branch uses the shared craft-ui ones. craft-libs is on 0.37 now too, so craft-ui moves to the head of storytold/craft-libs#33 (61f7ab8, egui 0.37, whose value field is named like its slider) and the shared sliders stay. The fill and gradient-stop transparency sliders are named "Transparency" like their row, as main's tests expect. status_zoom_slider_is_named_without_growing_the_status_bar checked egui's own slider size (100x22); it now checks the ZoomBar's fixed slider (110 wide, no taller than a control row). start_screen_opens_the_palette_and_preferences fails the same way on main (no ⌥ glyph in the test fonts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preferences: main added the Measurement units row right after the Interface size slider; the shared slider stays and the units row follows it, without the rest of the plain slider's release handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only Cargo.lock conflicted (main's self-updater, storytold#1377); main's lockfile is kept and cargo adds back this branch's craft-ui entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants