diff options
author | jgmdev <jgmdev@gmail.com> | 2022-09-16 00:41:38 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-09-16 00:41:38 -0400 |
commit | 02778eed3d6b1262ef2a08e84392309fadff803c (patch) | |
tree | c7e332b89836917ec10810d32307f5e5d2d939a9 | |
parent | 534ed6e53c5775fffffdb73860881e95386bfdd2 (diff) | |
download | lite-xl-plugins-02778eed3d6b1262ef2a08e84392309fadff803c.tar.gz lite-xl-plugins-02778eed3d6b1262ef2a08e84392309fadff803c.zip |
nonicons: support dynamic scaling
-rw-r--r-- | plugins/nonicons.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/nonicons.lua b/plugins/nonicons.lua index efbe3b4..b8b01bc 100644 --- a/plugins/nonicons.lua +++ b/plugins/nonicons.lua @@ -51,6 +51,7 @@ config.plugins.nonicons = common.merge({ local icon_font = renderer.font.load(USERDIR.."/fonts/nonicons.ttf", 15 * SCALE) local chevron_width = icon_font:get_width("") +local previous_scale = SCALE local extension_icons = { [".lua"] = { "#51a0cf", "" }, [".md"] = { "#519aba", "" }, -- Markdown @@ -117,6 +118,13 @@ end local TreeView_get_item_icon = TreeView.get_item_icon function TreeView:get_item_icon(item, active, hovered) local icon, font, color = TreeView_get_item_icon(self, item, active, hovered) + if previous_scale ~= SCALE then + icon_font:set_size( + icon_font:get_size() * (SCALE / previous_scale) + ) + chevron_width = icon_font:get_width("") + previous_scale = SCALE + end if not config.plugins.nonicons.use_default_dir_icons then icon = "" -- unicode 61766 font = icon_font |