Skip to content

Commit

Permalink
toolbarview: Remove tooltip when hidden (lite-xl#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guldoman authored Dec 20, 2022
1 parent 3c64c32 commit 213dc71
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/plugins/toolbarview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ end

function ToolbarView:toggle_visible()
self.visible = not self.visible
if self.tooltip then
core.status_view:remove_tooltip()
self.tooltip = false
end
self.hovered_item = nil
end

function ToolbarView:get_icon_width()
Expand Down Expand Up @@ -73,6 +78,7 @@ end


function ToolbarView:draw()
if not self.visible then return end
self:draw_background(style.background2)

for item, x, y, w, h in self:each_item() do
Expand All @@ -83,6 +89,7 @@ end


function ToolbarView:on_mouse_pressed(button, x, y, clicks)
if not self.visible then return end
local caught = ToolbarView.super.on_mouse_pressed(self, button, x, y, clicks)
if caught then return caught end
core.set_active_view(core.last_active_view)
Expand All @@ -94,6 +101,7 @@ end


function ToolbarView:on_mouse_moved(px, py, ...)
if not self.visible then return end
ToolbarView.super.on_mouse_moved(self, px, py, ...)
self.hovered_item = nil
local x_min, x_max, y_min, y_max = self.size.x, 0, self.size.y, 0
Expand Down

0 comments on commit 213dc71

Please sign in to comment.