Skip to content

Floating objects slide under frozen panes instead of covering them - #1333

Open
marcoarnulfo wants to merge 1 commit into
storytold:mainfrom
marcoarnulfo:fix/objects-clipped-to-pane
Open

marcoarnulfo wants to merge 1 commit into
storytold:mainfrom
marcoarnulfo:fix/objects-clipped-to-pane

Conversation

@marcoarnulfo

Copy link
Copy Markdown
Contributor

Fixes #1328.

The cells are painted pane by pane with their own clip (paint_panes), but chartview::paint_objects painted every floating object (shapes, pictures, charts, slicers) with a single clip over the whole cell area, so an object in the scrolling pane was drawn on top of the frozen rows and columns once scrolled under them. This adds Geo::object_area, which clips each object to the pane its anchor sits in, as Excel does: objects in the scrolling pane slide under the frozen panes. An object anchored in the frozen rows/columns isn't cut at the freeze line, so it keeps the part that reaches into the scrolling pane (that part stays put instead of scrolling; happy to switch to drawing it per pane if you'd rather match Excel more closely there). hit and slicer_click use the same area, so a click on a frozen heading over a hidden picture selects the cell instead of the picture. The chart source-data highlight keeps its cell-space clip, the same range_panes approach as #217 for the selection.

Validation:

  • cell_pictures::floating_pictures_slide_under_the_frozen_top_row (freezes row 1, scrolls a picture anchored at B5 half under it, checks the picture's clip, the hit test and a picture anchored in the frozen row): fails on main (the picture's clip starts at the top of the cell area, over the frozen row), passes here
  • cargo test -p gridcraft-ui-egui --test cell_pictures --test right_to_left --test freeze_handles --test chart_resize
  • cargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings, cargo fmt --all -- --check
  • I left the docs alone (no ui-parity.md revision row) to avoid conflicts on the shared header line; happy to add one.
  • (macOS, Apple silicon)

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: floating objects slide under frozen panes and no longer cover them. Charts, pictures, shapes and slicers are drawn through painters clipped to the object area of the pane they are anchored in, and a slicer's hit test requires the pointer to be inside that area too. Excel clips floating objects at the frozen pane boundary in the same way, so the oracle matches. The clipping must apply to selection handles as well, or a selected object shows handles over the frozen area, and the hit test change for the slicer should be applied to the other object kinds. A screenshot with a frozen row and a chart scrolled under it is the proof. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@adifiedio

Copy link
Copy Markdown
Contributor

Related: #3142 reports the same bug (images scrolling over frozen panes), and #2544 / #3237 fix a similar frozen-pane clipping bug for cell text, gridlines and borders.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images float above frozen cells

3 participants