# Keep text and images in place when resized on defense \(\#226\) · dara/icarus

[View on GitCafe](https://git.cafe/dara/icarus/commit/4bb00504507ddcde13cccdd0c0a10fff52caeb3a)

Repository: [dara/icarus](https://git.cafe/dara/icarus)

Visibility: public

Requested revision: 4bb00504507ddcde13cccdd0c0a10fff52caeb3a

Requested commit: 4bb00504507ddcde13cccdd0c0a10fff52caeb3a

Commit: 4bb00504507ddcde13cccdd0c0a10fff52caeb3a

Tree: 62f998468538b8d9a1c4d9e469bca0987193b3c8

Author: Dara Adedeji

Committer: GitHub

## Message

```
Keep text and images in place when resized on defense (#226)

* Keep text and images in place when resized on defense

On defense a text box or image mirrors attack, so it hangs from its
bottom-right corner. Dragging the right-hand resize handle moved the
left edge instead, and because the width was measured from that moving
edge, the box ran away from the pointer.

A resize now pins the box's on-screen top-left, and on release stores
the size together with the canonical position that keeps it there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Pass the side into text and image builders

The lists already know which side is showing, so hand it down instead of
reading mapProvider in each builder. On main, mapProvider reads Hive-backed
preferences, which widget tests of the builders do not open.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Move the resize pin with a mid-drag side switch

Switching sides while holding a resize handle left the pin at the old
side's screen position, and release read it on the new side, so the
stored position landed hundreds of pixels off. The pin now moves to
where the box shows on the new side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Keep the resize width tracking the pointer after a side switch

A side switch mid-resize mirrors the box away from the held pointer, and
the next drag update measured the width from the new left edge, so the
box jumped hundreds of pixels wide. The builders now remember how far
the left edge moved and measure from where it was.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
```

## Parents

- [6f29281aa13c0716483e7ff90000554547619004](https://git.cafe/dara/icarus/commit/6f29281aa13c0716483e7ff90000554547619004?format=markdown)

[Source at this commit](https://git.cafe/dara/icarus/tree/4bb00504507ddcde13cccdd0c0a10fff52caeb3a?format=markdown)
