parent
28cdd3cabe
commit
9fc185af2f
|
@ -127,7 +127,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function DocView:get_scrollable_size()
|
function DocView:get_scrollable_size()
|
||||||
return self:get_line_height() * #self.doc.lines + style.padding.y * 2
|
return self:get_line_height() * (#self.doc.lines - 1) + self.size.y
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ function LogView:update()
|
||||||
self.yoffset = -(style.font:get_height() + style.padding.y)
|
self.yoffset = -(style.font:get_height() + style.padding.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.scroll.to.y = math.max(0, self.scroll.to.y)
|
|
||||||
self:move_towards("yoffset", 0)
|
self:move_towards("yoffset", 0)
|
||||||
|
|
||||||
LogView.super.update(self)
|
LogView.super.update(self)
|
||||||
|
|
|
@ -45,13 +45,13 @@ end
|
||||||
|
|
||||||
|
|
||||||
function View:get_scrollable_size()
|
function View:get_scrollable_size()
|
||||||
return 0
|
return math.huge
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function View:get_scrollbar_rect()
|
function View:get_scrollbar_rect()
|
||||||
local sz = self:get_scrollable_size()
|
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
|
return 0, 0, 0, 0
|
||||||
end
|
end
|
||||||
local h = math.max(20, self.size.y * self.size.y / sz)
|
local h = math.max(20, self.size.y * self.size.y / sz)
|
||||||
|
@ -117,7 +117,14 @@ function View:get_content_offset()
|
||||||
end
|
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()
|
function View:update()
|
||||||
|
self:clamp_scroll_position()
|
||||||
self:move_towards(self.scroll, "x", self.scroll.to.x, 0.3)
|
self:move_towards(self.scroll, "x", self.scroll.to.x, 0.3)
|
||||||
self:move_towards(self.scroll, "y", self.scroll.to.y, 0.3)
|
self:move_towards(self.scroll, "y", self.scroll.to.y, 0.3)
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,7 +102,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
function ResultsView:update()
|
function ResultsView:update()
|
||||||
self.scroll.to.y = math.max(0, self.scroll.to.y)
|
|
||||||
ResultsView.super.update(self)
|
ResultsView.super.update(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -118,7 +117,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
function ResultsView:get_scrollable_size()
|
function ResultsView:get_scrollable_size()
|
||||||
local rh = style.padding.y + style.font:get_height()
|
|
||||||
return self:get_results_yoffset() + #self.results * self:get_line_height()
|
return self:get_results_yoffset() + #self.results * self:get_line_height()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
function TreeView:update()
|
function TreeView:update()
|
||||||
self.scroll.to.y = math.max(0, self.scroll.to.y)
|
|
||||||
|
|
||||||
-- update width
|
-- update width
|
||||||
local dest = self.visible and config.treeview_size or 0
|
local dest = self.visible and config.treeview_size or 0
|
||||||
self:move_towards(self.size, "x", dest)
|
self:move_towards(self.size, "x", dest)
|
||||||
|
|
Loading…
Reference in a new issue