aboutsummaryrefslogtreecommitdiff
path: root/plugins/minimap.lua
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2022-06-15 23:46:04 +0200
committerGuldoman <giulio.lettieri@gmail.com>2022-06-15 23:46:04 +0200
commit3eda1ddc31412623aa5c1d6ea829d07021e6e3d6 (patch)
tree93e72f1e1ed6ce3ebb151eaf6a9ea9eed2940a79 /plugins/minimap.lua
parentd8c30e18d21b38f34a1c4cb584014ca5911daa43 (diff)
downloadlite-xl-plugins-3eda1ddc31412623aa5c1d6ea829d07021e6e3d6.tar.gz
lite-xl-plugins-3eda1ddc31412623aa5c1d6ea829d07021e6e3d6.zip
`minimap`: align rects to pixel grid
Diffstat (limited to 'plugins/minimap.lua')
-rw-r--r--plugins/minimap.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/minimap.lua b/plugins/minimap.lua
index 4751ce6..3604458 100644
--- a/plugins/minimap.lua
+++ b/plugins/minimap.lua
@@ -199,8 +199,8 @@ local cached_settings = {
}
-- Configure size for rendering each char in the minimap
-local char_height
local char_spacing
+local char_height
local line_spacing
-- cache for the location of the rects for each Doc
@@ -214,9 +214,10 @@ local function reset_cache()
scale = config.plugins.minimap.scale,
width = config.plugins.minimap.width,
}
- char_height = 1 * SCALE * config.plugins.minimap.scale
char_spacing = 0.8 * SCALE * config.plugins.minimap.scale
- line_spacing = 2 * SCALE * config.plugins.minimap.scale
+ -- keep y aligned to pixels
+ char_height = math.max(1, math.floor(1 * SCALE * config.plugins.minimap.scale + 0.5))
+ line_spacing = math.max(1, math.floor(2 * SCALE * config.plugins.minimap.scale + 0.5))
end
reset_cache()