mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +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
|
def update
|
||||||
super
|
super
|
||||||
|
|
||||||
@tip = value.to_s
|
@tip = format("%.2f", value.to_f)
|
||||||
@handle.tip = @tip
|
@handle.tip = @tip
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def handle_dragged_to(x, _y)
|
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
|
self.value = @ratio.clamp(0.0, 1.0) * (@range.max - @range.min) + @range.min
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user