Update Scrollbar

This commit is contained in:
Sabine Lim
2023-05-16 02:54:55 +10:00
parent 9d9947073a
commit f304c98ce8
2 changed files with 34 additions and 2 deletions

View File

@@ -62,6 +62,26 @@ return function(name, basalt)
return self return self
end, end,
setSymbolBG = function(self, bg)
return self:setSymbol(symbol, bg, nil)
end,
setSymbolFG = function(self, fg)
return self:setSymbol(symbol, nil, fg)
end,
getSymbol = function(self)
return symbol
end,
getSymbolBG = function(self)
return symbolBG
end,
getSymbolFG = function(self)
return symbolFG
end,
setIndex = function(self, _index) setIndex = function(self, _index)
index = _index index = _index
if (index < 1) then if (index < 1) then
@@ -81,6 +101,10 @@ return function(name, basalt)
return self return self
end, end,
getScrollAmount = function(self)
return scrollAmount
end,
getIndex = function(self) getIndex = function(self)
local w,h = self:getSize() local w,h = self:getSize()
return scrollAmount > (barType=="vertical" and h or w) and math.floor(scrollAmount/(barType=="vertical" and h or w) * index) or index return scrollAmount > (barType=="vertical" and h or w) and math.floor(scrollAmount/(barType=="vertical" and h or w) * index) or index
@@ -94,6 +118,10 @@ return function(name, basalt)
return self return self
end, end,
getSymbolSize = function(self)
return symbolSize
end,
setBarType = function(self, _typ) setBarType = function(self, _typ)
barType = _typ:lower() barType = _typ:lower()
updateSymbolSize() updateSymbolSize()
@@ -101,6 +129,10 @@ return function(name, basalt)
return self return self
end, end,
getBarType = function(self)
return barType
end,
mouseHandler = function(self, button, x, y, ...) mouseHandler = function(self, button, x, y, ...)
if (base.mouseHandler(self, button, x, y, ...)) then if (base.mouseHandler(self, button, x, y, ...)) then
mouseEvent(self, button, x, y) mouseEvent(self, button, x, y)

View File

@@ -590,11 +590,11 @@ return {
base.setValuesByXMLData(self, data, renderContext) base.setValuesByXMLData(self, data, renderContext)
self:updateSpecifiedValuesByXMLData(data, { self:updateSpecifiedValuesByXMLData(data, {
"symbol", "symbol",
"symbolColor", "symbolBG",
"symbolFG",
"symbolSize", "symbolSize",
"scrollAmount", "scrollAmount",
"index", "index",
"maxValue",
"barType" "barType"
}) })
return self return self