Repository navigation
Grid: mirror right-to-left sheets (#146) - #310
Merged
Merged
Conversation
Sheet Right-to-Left (view.rightToLeft, XLSX rightToLeft) was stored and round-tripped but never rendered. The grid now lays out in logical left-to-right coordinates and mirrors on screen: painted shapes are reflected (text and pictures only moved), floating objects move as a whole, pointer input is mirrored back for hit-testing, Left/Right arrows follow the screen, and the cell editor, text box editor, popups and the vertical scrollbar are placed on the mirrored side. Page Layout gets a Sheet Right-to-Left button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Merged — thank you for the contribution! (I resolved a conflict with the freeze-handle drag from #309 in grid.rs: the press origin is mirrored first, then the freeze handles are checked.) If you haven't already, come join us on the ArtCraft Discord: https://discord.gg/artcraft |
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Oct 11, 2026
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.
Part of #146 (the sheet layout part; Arabic letter joining / bidi is separate text-shaping work, see #260).
Root cause
view.rightToLeft(Page Layout › Sheet Options), theSheet::right_to_leftflag and the XLSX<sheetView rightToLeft="1">round trip already existed on main, but the grid ignored the flag: an RTL sheet still drew column A on the left, and there was no ribbon control for it.What changed
crates/ui-egui/src/grid.rs): the grid still computes its layout in logical left-to-right coordinates (Geo::x,cell_rect,col_at…) and then mirrors it across the grid's vertical centre line on screen:mirror_painted/mirror_shape). Rects, lines, paths and circles are flipped. Text galleys and meshes (pictures in cells) are only moved, so glyphs and images keep their direction. Default alignment therefore comes out as text on the right and numbers on the left, overflow runs to the left, and filter buttons, data bars, CF icons and the fill handle sit on the mirrored side;chartview::paint_objectsnow reports the shape range each object painted), so a chart keeps its axes;Geo::mirror_pos) before hit-testing, so clicks, drags, header selection/resize, fill, move, object drag and context menus hit the right cells. Popup positions are converted back to screen coordinates;Icon::SheetRtl). The label is translated in all catalogs (ja, zh, ko, ru, pt).docs/localization-parity.mdupdated.Tests and commands run
crates/ui-egui/tests/right_to_left.rs: column A is drawn right of B and next to the right-hand row headers, a drag between the on-screen positions of C3 and F7 selectsC3:F7, and Left/Right arrows move to the next/previous column.cargo test -p gridcraft-ui-egui --test right_to_left,--test selection,--test interaction,--test header_autofit,--test text_box_editing,--test popup_dismissal,--test cell_pictures,--lib(all pass)cargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings,cargo fmt -p gridcraft-ui-egui -- --check,cargo check --target wasm32-unknown-unknown -p gridcraft-ui-egui--example snapshot -- --sample sales --tab "Page Layout" --cmd 'view.rightToLeft={"on":true}' --cmd 'view.freezePanes={"cell":"B2"}'): column A and the row numbers are on the right, the frozen pane and select-all corner are on the right, the scrollbar is on the left, table filter buttons and data bars are mirrored, and charts are moved but not flipped.Not done
Unverified assumptions (needs confirmation in Excel)
🤖 Generated with Claude Code