Add additional parameters for number badge
This commit is contained in:
@@ -36,17 +36,25 @@ local logger = require("logger")
|
|||||||
--========================== [[ Folder Cover Tuning ]] ==========================
|
--========================== [[ Folder Cover Tuning ]] ==========================
|
||||||
|
|
||||||
-- Edge bars (above cover)
|
-- Edge bars (above cover)
|
||||||
local EDGE_THICKNESS = Screen:scaleBySize(4.5)
|
local EDGE_THICKNESS = Screen:scaleBySize(4.5) -- thickness of the top/bottom edge bars
|
||||||
local EDGE_MARGIN = Size.line.medium
|
local EDGE_MARGIN = Size.line.medium -- space between edge bars and other elements
|
||||||
local EDGE_COLOR = Blitbuffer.COLOR_GRAY_4
|
local EDGE_COLOR = Blitbuffer.COLOR_GRAY_4 -- color of the edge bars
|
||||||
local EDGE_WIDTH_RATIO = 0.97
|
local EDGE_WIDTH_RATIO = 0.97 -- width of the edge bars relative to the cover width
|
||||||
|
|
||||||
-- Cover face
|
-- Cover face
|
||||||
local COVER_BORDER_SIZE = Size.border.thin
|
local COVER_BORDER_SIZE = Size.border.thin -- thickness of the cover border around the image
|
||||||
local COVER_BANNER_ALPHA = 0.6
|
local COVER_BANNER_ALPHA = 0.6 -- transparency of the folder name banner overlay
|
||||||
local NB_ITEMS_FONT_SIZE = 18
|
local DIR_MAX_FONT_SIZE = 20 -- maximum font size for the folder name text
|
||||||
local NB_ITEMS_MARGIN = Screen:scaleBySize(5)
|
|
||||||
local DIR_MAX_FONT_SIZE = 20
|
--========================== [[ Number Badge Tuning ]] ==========================
|
||||||
|
|
||||||
|
local NB_ITEMS_FONT_SIZE = 18 -- font size of the number badge text
|
||||||
|
local NB_ITEMS_MARGIN = Screen:scaleBySize(5) -- inset distance of number badge from right & bottom edges
|
||||||
|
local NB_BADGE_SIZE = Screen:scaleBySize(18) -- default size of the badge (width and height)
|
||||||
|
local NB_BADGE_PADDING = Screen:scaleBySize(2) -- padding inside the badge frame
|
||||||
|
local NB_BADGE_RADIUS = 6 -- corner radius for the badge
|
||||||
|
local NB_BADGE_BG_COLOR = Blitbuffer.COLOR_WHITE -- background color of the badge
|
||||||
|
local NB_BADGE_MARGIN = Screen:scaleBySize(5) -- inset from right and bottom edges
|
||||||
|
|
||||||
--===============================================================================
|
--===============================================================================
|
||||||
|
|
||||||
@@ -244,7 +252,7 @@ local function patchCoverBrowser(plugin)
|
|||||||
folder_name_widget = (settings.name_centered.get() and CenterContainer or TopContainer):new {
|
folder_name_widget = (settings.name_centered.get() and CenterContainer or TopContainer):new {
|
||||||
dimen = dimen,
|
dimen = dimen,
|
||||||
FrameContainer:new {
|
FrameContainer:new {
|
||||||
padding = 0,
|
padding = 0, -- Makes text container larger than image if expanded
|
||||||
bordersize = Folder.face.border_size,
|
bordersize = Folder.face.border_size,
|
||||||
AlphaContainer:new { alpha = Folder.face.alpha, directory },
|
AlphaContainer:new { alpha = Folder.face.alpha, directory },
|
||||||
},
|
},
|
||||||
@@ -257,24 +265,25 @@ local function patchCoverBrowser(plugin)
|
|||||||
local nbitems_widget
|
local nbitems_widget
|
||||||
if tonumber(nbitems.text) ~= 0 then
|
if tonumber(nbitems.text) ~= 0 then
|
||||||
-- Inset from edges (right AND bottom) using the same margin value
|
-- Inset from edges (right AND bottom) using the same margin value
|
||||||
local inset = Folder.face.nb_items_margin
|
local inset = NB_BADGE_MARGIN
|
||||||
|
|
||||||
nbitems_widget = BottomContainer:new {
|
nbitems_widget = BottomContainer:new {
|
||||||
-- shrink bottom anchoring area so the badge sits inset upward by `inset`
|
dimen = {
|
||||||
dimen = { w = dimen.w, h = dimen.h - inset },
|
w = dimen.w,
|
||||||
|
h = dimen.h
|
||||||
|
},
|
||||||
|
|
||||||
RightContainer:new {
|
RightContainer:new {
|
||||||
-- shrink right anchoring area so the badge sits inset leftward by `inset`
|
|
||||||
dimen = {
|
dimen = {
|
||||||
w = dimen.w - inset,
|
w = dimen.w - inset,
|
||||||
h = nb_size + inset * 2 + math.ceil(nb_size * 0.125),
|
h = NB_BADGE_SIZE + inset * 2 + math.ceil(NB_BADGE_SIZE * 0.125),
|
||||||
},
|
},
|
||||||
|
|
||||||
FrameContainer:new {
|
FrameContainer:new {
|
||||||
padding = Screen:scaleBySize(2),
|
padding = NB_BADGE_PADDING,
|
||||||
radius = 6,
|
radius = NB_BADGE_RADIUS,
|
||||||
background = Blitbuffer.COLOR_WHITE,
|
background = NB_BADGE_BG_COLOR,
|
||||||
CenterContainer:new { dimen = { w = nb_size, h = nb_size }, nbitems },
|
CenterContainer:new { dimen = { w = NB_BADGE_SIZE, h = NB_BADGE_SIZE }, nbitems },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user