[Android] resize_android_corner_labels never refreshes Text2d content — stale rank/suit on resize #6

Closed
opened 2026-05-19 18:21:11 +00:00 by funman300 · 0 comments
Owner

Description

On Android (PNG card image path), each card has two child entities for the large-print corner overlay:

  • AndroidCornerBg — solid background sprite
  • AndroidCornerLabelText2d node showing rank + suit (e.g. A♥)

The system resize_android_corner_labels (fired when LayoutResource changes) updates the TextFont size and Transform position of every AndroidCornerLabel entity — but never updates the Text2d text content.

Affected file

solitaire_engine/src/card_plugin.rsresize_android_corner_labels (~line 2089)

Reproduction

  1. Start a game on Android.
  2. Trigger a layout change (rotate device / resize window) in the same frame as a card move that changes which card occupies a visual slot.
  3. The corner label will display the previous card's rank/suit text until the next full update_card_entity despawn/respawn cycle.

Root Cause

update_card_entity correctly despawns and re-spawns children (including AndroidCornerLabel) on every StateChangedEvent. resize_android_corner_labels runs on a separate trigger (LayoutResource change) and only mutates TextFont and Transform — it has no access to the parent card's identity and therefore cannot update the text.

In practice this race window is very narrow (layout change must coincide with a card move in the same frame), but it is a correctness bug.

Suggested Fix

Change resize_android_corner_labels to also query the parent CardEntity component (via ChildOf) and re-derive the label text from the card's rank and suit, ensuring the text content stays in sync even on the resize path.

## Description On Android (PNG card image path), each card has two child entities for the large-print corner overlay: - `AndroidCornerBg` — solid background sprite - `AndroidCornerLabel` — `Text2d` node showing rank + suit (e.g. `A♥`) The system `resize_android_corner_labels` (fired when `LayoutResource` changes) updates the `TextFont` size and `Transform` position of every `AndroidCornerLabel` entity — but **never updates the `Text2d` text content**. ## Affected file `solitaire_engine/src/card_plugin.rs` — `resize_android_corner_labels` (~line 2089) ## Reproduction 1. Start a game on Android. 2. Trigger a layout change (rotate device / resize window) *in the same frame* as a card move that changes which card occupies a visual slot. 3. The corner label will display the previous card's rank/suit text until the next full `update_card_entity` despawn/respawn cycle. ## Root Cause `update_card_entity` correctly despawns and re-spawns children (including `AndroidCornerLabel`) on every `StateChangedEvent`. `resize_android_corner_labels` runs on a separate trigger (`LayoutResource` change) and only mutates `TextFont` and `Transform` — it has no access to the parent card's identity and therefore cannot update the text. In practice this race window is very narrow (layout change must coincide with a card move in the same frame), but it is a correctness bug. ## Suggested Fix Change `resize_android_corner_labels` to also query the parent `CardEntity` component (via `ChildOf`) and re-derive the label text from the card's rank and suit, ensuring the text content stays in sync even on the resize path.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#6