mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Probably fixed scrolling for real this time, added scroll_top and scroll_top = n methods
This commit is contained in:
@@ -205,7 +205,8 @@ module CyberarmEngine
|
||||
|
||||
def mouse_wheel_up(sender, x, y)
|
||||
return unless @style.scroll
|
||||
return if height < max_scroll_height
|
||||
|
||||
return unless height < scroll_height
|
||||
|
||||
if @scroll_position.y < 0
|
||||
@scroll_position.y += @scroll_speed
|
||||
@@ -218,7 +219,8 @@ module CyberarmEngine
|
||||
|
||||
def mouse_wheel_down(sender, x, y)
|
||||
return unless @style.scroll
|
||||
return if height < max_scroll_height
|
||||
|
||||
return unless height < scroll_height
|
||||
|
||||
if @scroll_position.y.abs < max_scroll_height
|
||||
@scroll_position.y -= @scroll_speed
|
||||
@@ -229,6 +231,16 @@ module CyberarmEngine
|
||||
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
|
||||
@children.map { |c| c.class }.join(", ")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user