mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-15 20:52:35 +00:00
Fixed Slider element not working properly under mruby (attempts to slide would jump between min/max values)
This commit is contained in:
@@ -76,7 +76,7 @@ module CyberarmEngine
|
||||
def update
|
||||
super
|
||||
|
||||
@tip = value.to_s
|
||||
@tip = format("%.2f", value.to_f)
|
||||
@handle.tip = @tip
|
||||
end
|
||||
|
||||
@@ -87,7 +87,7 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
def handle_dragged_to(x, _y)
|
||||
@ratio = ((x - @handle.width / 2) - @x) / (content_width - @handle.outer_width)
|
||||
@ratio = ((x - @handle.width / 2.0) - @x) / (content_width - @handle.outer_width.to_f)
|
||||
|
||||
self.value = @ratio.clamp(0.0, 1.0) * (@range.max - @range.min) + @range.min
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user