diff --git a/data/core/view.lua b/data/core/view.lua index b204afdc..bab75b01 100644 --- a/data/core/view.lua +++ b/data/core/view.lua @@ -287,12 +287,16 @@ end function View:update_scrollbar() local v_scrollable = self:get_scrollable_size() self.v_scrollbar:set_size(self.position.x, self.position.y, self.size.x, self.size.y, v_scrollable) - self.v_scrollbar:set_percent(self.scroll.y/(v_scrollable - self.size.y)) + local v_percent = self.scroll.y/(v_scrollable - self.size.y) + -- Avoid setting nan percent + self.v_scrollbar:set_percent(v_percent == v_percent and v_percent or 0) self.v_scrollbar:update() local h_scrollable = self:get_h_scrollable_size() self.h_scrollbar:set_size(self.position.x, self.position.y, self.size.x, self.size.y, h_scrollable) - self.h_scrollbar:set_percent(self.scroll.x/(h_scrollable - self.size.x)) + local h_percent = self.scroll.x/(h_scrollable - self.size.x) + -- Avoid setting nan percent + self.h_scrollbar:set_percent(h_percent == h_percent and h_percent or 0) self.h_scrollbar:update() end