From ceb641ddd988a26069a8314b2ffb52b326bf9b64 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Thu, 25 May 2023 23:03:33 +0530 Subject: [PATCH] slider fix --- src/gui/GuiSlider.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/GuiSlider.hx b/src/gui/GuiSlider.hx index b656f0e5..89c140ab 100644 --- a/src/gui/GuiSlider.hx +++ b/src/gui/GuiSlider.hx @@ -1,5 +1,6 @@ package gui; +import h2d.Scene; import hxd.snd.Channel; import hxd.res.Sound; import hxd.Key; @@ -33,4 +34,13 @@ class GuiSlider extends GuiImage { this.bmp.width = this.bmp.tile.width * Settings.uiScale; super.update(dt, mouseState); } + + public override function render(scene2d:Scene) { + super.render(scene2d); + var renderRect = getRenderRectangle(); + this.bmp.width = this.bmp.tile.width * Settings.uiScale; + this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue; + this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2); + this.bmp.width = this.bmp.tile.width * Settings.uiScale; + } }