mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 08:52:19 -07:00
Optimize setMinimumHeight to skip geometry updates when effective height unchanged
This commit is contained in:
parent
d42b7c8003
commit
7a092677c7
1 changed files with 9 additions and 8 deletions
|
|
@ -51,20 +51,21 @@ void CommandZone::setMinimumHeight(int height)
|
||||||
if (minimumHeight == height) {
|
if (minimumHeight == height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Only meaningful while minimized, where currentHeight() depends on minimumHeight.
|
// The floor only affects height while minimized; skip relayout if the displayed
|
||||||
|
// height is unchanged (e.g. a tax counter toggled while expanded).
|
||||||
const qreal oldEffectiveHeight = currentHeight();
|
const qreal oldEffectiveHeight = currentHeight();
|
||||||
minimumHeight = height;
|
minimumHeight = height;
|
||||||
|
if (qFuzzyCompare(currentHeight(), oldEffectiveHeight)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
updateClipRect();
|
updateClipRect();
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
update();
|
update();
|
||||||
// Do NOT emit minimizedChanged: the minimized STATE is unchanged, and that signal
|
// effectiveHeightChanged repositions neighbouring zones; that path re-enters with the
|
||||||
// feeds rearrangeZones -> rearrangeCounters -> setMinimumHeight (infinite loop).
|
// same floor and early-returns above, so it converges.
|
||||||
// effectiveHeightChanged repositions neighbouring zones and converges instead: the
|
emit effectiveHeightChanged();
|
||||||
// rearrange re-enters setMinimumHeight with the same height and early-returns above.
|
|
||||||
if (!qFuzzyCompare(currentHeight(), oldEffectiveHeight)) {
|
|
||||||
emit effectiveHeightChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandZone::isMinimized() const
|
bool CommandZone::isMinimized() const
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue