Fix scaling issue in touch control layout screen, thanks @iota97

See #19573
This commit is contained in:
Henrik Rydgård 2024-11-02 19:53:29 +01:00
parent d20bde8a1f
commit 6b753c1d63

View File

@ -261,7 +261,7 @@ public:
dc.Draw()->DrawImageRotated(dirImage, x, y, scale_, angle + PI, colorBg, false); dc.Draw()->DrawImageRotated(dirImage, x, y, scale_, angle + PI, colorBg, false);
dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), x2, y2, scale_, angle + PI, color); dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), x2, y2, scale_, angle + PI, color);
} }
scale_ = theScale_/layoutAreaScale; scale_ = theScale_ / layoutAreaScale;
} }
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override { void GetContentDimensions(const UIContext &dc, float &w, float &h) const override {
@ -284,6 +284,8 @@ public:
} }
void Draw(UIContext &dc) override { void Draw(UIContext &dc) override {
scale_ = theScale_ * layoutAreaScale;
float opacity = GamepadGetOpacity(); float opacity = GamepadGetOpacity();
uint32_t colorBg = colorAlpha(GetButtonColor(), opacity); uint32_t colorBg = colorAlpha(GetButtonColor(), opacity);
@ -292,6 +294,8 @@ public:
dc.Draw()->DrawImage(stickBg, bounds_.centerX(), bounds_.centerY(), scale_, colorBg, ALIGN_CENTER); dc.Draw()->DrawImage(stickBg, bounds_.centerX(), bounds_.centerY(), scale_, colorBg, ALIGN_CENTER);
dc.Draw()->DrawImage(stickImage, bounds_.centerX(), bounds_.centerY(), scale_ * spacing_, colorBg, ALIGN_CENTER); dc.Draw()->DrawImage(stickImage, bounds_.centerX(), bounds_.centerY(), scale_ * spacing_, colorBg, ALIGN_CENTER);
scale_ = theScale_ / layoutAreaScale;
} }
float GetSpacing() const override { return spacing_ * 3; } float GetSpacing() const override { return spacing_ * 3; }