mirror of https://github.com/Hilbis/Hilbish
fix(nature/greenhouse): add limit to text offset for scrolling
parent
45eb3d17e3
commit
e368ba3e0a
|
@ -35,9 +35,9 @@ end
|
||||||
|
|
||||||
function Greenhouse:scroll(direction)
|
function Greenhouse:scroll(direction)
|
||||||
if direction == 'down' then
|
if direction == 'down' then
|
||||||
self.offset = self.offset + 1
|
self.offset = math.min(self.offset + 1, #self.lines)
|
||||||
elseif direction == 'up' then
|
elseif direction == 'up' then
|
||||||
self.offset = self.offset - 1
|
self.offset = math.max(self.offset - 1, 1)
|
||||||
end
|
end
|
||||||
self:draw()
|
self:draw()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue