+9
-2
@@ -45,13 +45,13 @@ end
|
||||
|
||||
|
||||
function View:get_scrollable_size()
|
||||
return 0
|
||||
return math.huge
|
||||
end
|
||||
|
||||
|
||||
function View:get_scrollbar_rect()
|
||||
local sz = self:get_scrollable_size()
|
||||
if sz <= self.size.y then
|
||||
if sz <= self.size.y or sz == math.huge then
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
local h = math.max(20, self.size.y * self.size.y / sz)
|
||||
@@ -117,7 +117,14 @@ function View:get_content_offset()
|
||||
end
|
||||
|
||||
|
||||
function View:clamp_scroll_position()
|
||||
local max = self:get_scrollable_size() - self.size.y
|
||||
self.scroll.to.y = common.clamp(self.scroll.to.y, 0, max)
|
||||
end
|
||||
|
||||
|
||||
function View:update()
|
||||
self:clamp_scroll_position()
|
||||
self:move_towards(self.scroll, "x", self.scroll.to.x, 0.3)
|
||||
self:move_towards(self.scroll, "y", self.scroll.to.y, 0.3)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user