Probably fixed scrolling for real this time, added scroll_top and scroll_top = n methods

This commit is contained in:
2021-02-13 20:03:10 -06:00
parent 20970e5aa9
commit 92dd63dc1d

View File

@@ -205,7 +205,8 @@ module CyberarmEngine
def mouse_wheel_up(sender, x, y) def mouse_wheel_up(sender, x, y)
return unless @style.scroll return unless @style.scroll
return if height < max_scroll_height
return unless height < scroll_height
if @scroll_position.y < 0 if @scroll_position.y < 0
@scroll_position.y += @scroll_speed @scroll_position.y += @scroll_speed
@@ -218,7 +219,8 @@ module CyberarmEngine
def mouse_wheel_down(sender, x, y) def mouse_wheel_down(sender, x, y)
return unless @style.scroll return unless @style.scroll
return if height < max_scroll_height
return unless height < scroll_height
if @scroll_position.y.abs < max_scroll_height if @scroll_position.y.abs < max_scroll_height
@scroll_position.y -= @scroll_speed @scroll_position.y -= @scroll_speed
@@ -229,6 +231,16 @@ module CyberarmEngine
end end
end end
def scroll_top
@scroll_position.y
end
def scroll_top=(n)
n = 0 if n <= 0
@scroll_position.y = -n
@scroll_position.y = -max_scroll_height if @scroll_position.y.abs > max_scroll_height
end
def value def value
@children.map { |c| c.class }.join(", ") @children.map { |c| c.class }.join(", ")
end end