From 3df0b740cb1cabd03a992d912d938ad3fc96880c Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Jun 2024 20:31:42 +0200 Subject: [PATCH] ProgressWidget: Add a white outline to help visibility At least for standard progress bars. It makes it even more invisible for the thin style ;p. --- frontend/ui/widget/progresswidget.lua | 27 ++++++++++--------- resources/icons/mdlight/position.marker.svg | 14 ++++++---- .../icons/mdlight/position.marker.top.svg | 12 ++++++--- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/frontend/ui/widget/progresswidget.lua b/frontend/ui/widget/progresswidget.lua index 166164565823..0377fc91a0b1 100644 --- a/frontend/ui/widget/progresswidget.lua +++ b/frontend/ui/widget/progresswidget.lua @@ -37,7 +37,7 @@ local Widget = require("ui/widget/widget") local Screen = require("device").screen -- Somewhat empirically chosen threshold to switch between the two designs ;o) -local INITIAL_MARKER_HEIGHT_THRESHOLD = Screen:scaleBySize(12) +local INITIAL_MARKER_HEIGHT_THRESHOLD = Screen:scaleBySize(11) local ProgressWidget = Widget:extend{ width = nil, @@ -90,8 +90,8 @@ function ProgressWidget:renderMarkerIcon() if self.height <= INITIAL_MARKER_HEIGHT_THRESHOLD then self.initial_pos_icon = IconWidget:new{ icon = "position.marker.top", - width = Math.round(self.height / 2), - height = Math.round(self.height / 2), + width = Math.round(self.height / 1.5), + height = Math.round(self.height / 1.5), alpha = true, } else @@ -168,8 +168,9 @@ function ProgressWidget:paintTo(bb, x, y) end -- Main fill bar for the specified percentage. + local fill_x if self.percentage >= 0 and self.percentage <= 1 then - local fill_x = x + self.margin_h + self.bordersize + fill_x = x + self.margin_h + self.bordersize if self.fill_from_right or (_mirroredUI and not self.fill_from_right) then fill_x = fill_x + (fill_width * (1 - self.percentage)) fill_x = math.floor(fill_x) @@ -180,15 +181,6 @@ function ProgressWidget:paintTo(bb, x, y) math.ceil(fill_width * self.percentage), math.ceil(fill_height), self.fillcolor) - - -- Overlay the initial position marker on top of that - if self.initial_pos_marker and self.initial_percentage >= 0 then - if self.height <= INITIAL_MARKER_HEIGHT_THRESHOLD then - self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 4), y - Math.round(self.height / 6)) - else - self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 2), y) - end - end end -- ...then the tick(s). @@ -207,6 +199,15 @@ function ProgressWidget:paintTo(bb, x, y) self.bordercolor) end end + + -- Overlay the initial position marker on top of everything + if self.initial_pos_marker and self.initial_percentage >= 0 and fill_x then + if self.height <= INITIAL_MARKER_HEIGHT_THRESHOLD then + self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 3), y - Math.round(self.height / 6)) + else + self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 2), y) + end + end end function ProgressWidget:setPercentage(percentage) diff --git a/resources/icons/mdlight/position.marker.svg b/resources/icons/mdlight/position.marker.svg index d017ed851e27..95a5f987eea2 100644 --- a/resources/icons/mdlight/position.marker.svg +++ b/resources/icons/mdlight/position.marker.svg @@ -10,7 +10,7 @@ sodipodi:docname="position.marker.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96" - inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -31,7 +31,7 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="2560" - inkscape:window-height="1381" + inkscape:window-height="1382" id="namedview6" showgrid="true" inkscape:zoom="21" @@ -49,11 +49,15 @@ type="xygrid" id="grid835" originx="0" - originy="0" /> + originy="0" + spacingy="1" + spacingx="1" + units="px" + visible="true" /> + originy="0" + spacingy="1" + spacingx="1" + units="px" + visible="true" />