Skip to content

feat(tilegrid): a tile opened says where its picture is (onopen) - #29

Merged
adammharris merged 1 commit into
mainfrom
cc/practical-pasteur-evqtf1
Nov 18, 2026
Merged

adammharris merged 1 commit into
mainfrom
cc/practical-pasteur-evqtf1

Conversation

@adammharris

Copy link
Copy Markdown
Member

What

This follows on from #28. TileGrid can now report where a tile's picture is on screen when the tile is opened, so a photo viewer can fly the photo out of the actual thumbnail. Until now a host could only pass the point where the press went down.

  • New prop onopen: Option<EventHandler<(String, Option<Spot>)>>, which is called in place of onactivate when it's given. It receives:
    • the opened tile's key;
    • the window box of that tile's picture (.unit-tile-face), as a Spot::rect. This is what Photo::from takes.
  • Every way of opening a tile gives it a box: a tap, a click, a double click, and Return on the tile the keys are on.
  • How it's measured: each tile keeps its picture's MountedData from onmounted, held in the grid's Faces and released when the tile drops. When a tile opens, the grid asks the renderer for that picture's client rect.
  • Timing: that answer arrives on a later turn, so onopen fires a moment after the press. The spot is None where the renderer can't say.
  • Tables and plain onactivate are unchanged.

Gallery

The Photos grid uses onopen. A photo now flies out of its own tile instead of out of the point where it was pressed. The press-recording wrapper is gone.

Tests

The Blitz flight test now checks that the photo:

  • starts in the tile's picture box, whether opened by a click or by Return;
  • returns to that box before the viewer is gone, whether closed by Close or by a drag down.

All ship ci lanes pass locally: fmt, clippy (native and wasm), tests light and dark, and docs.


Generated by Claude Code

TileGrid takes onopen, in place of onactivate: given the key of a tile
opened and where its picture is in the window, a Spot, for a photo viewer
to fly the photo out of and back into. A tile opened by a key says it as
one opened by a press does. Each tile keeps its picture as the renderer
mounted it, and the grid asks the renderer where it is as the tile opens,
so onopen is given a moment after the press; None where the renderer
cannot say.

The gallery's photos fly out of their tiles rather than out of where
they were pressed.
@adammharris
adammharris merged commit a36513a into main Nov 18, 2026
7 checks passed
@adammharris
adammharris deleted the cc/practical-pasteur-evqtf1 branch November 18, 2026 20:02
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