AnchorLayout: Allow centering separately for horizontal and vertical

This commit is contained in:
Henrik Rydgård committed 2025-11-10 12:10:08 +01:00
1 parent 0453fb5449
commit 9de8e75709
16 files changed
+71 -61

No files matched your search

+2 -2
View File
@@ -44,7 +44,7 @@ static u32 GetButtonColor() {
class DragDropButton : public MultiTouchButton {
public:
DragDropButton(ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img, const Bounds &screenBounds)
: MultiTouchButton(key, bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, true)),
: MultiTouchButton(key, bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, UI::Centering::Both)),
x_(pos.x), y_(pos.y), theScale_(pos.scale), screenBounds_(screenBounds) {
scale_ = theScale_;
}
@@ -412,7 +412,7 @@ bool ControlLayoutView::Touch(const TouchInput &touch) {
}
newPos = ClampTo(newPos, validRange);
pickedControl_->ReplaceLayoutParams(new AnchorLayoutParams(newPos.x, newPos.y, NONE, NONE, true));
pickedControl_->ReplaceLayoutParams(new AnchorLayoutParams(newPos.x, newPos.y, NONE, NONE, Centering::Both));
} else if (mode_ == 1) {
// Resize. Vertical = scaling, horizontal = spacing;
// Up should be bigger so let's negate in that direction