Updated XML to detect if object is flipped

This commit is contained in:
Chr1Z93 2024-11-17 23:18:03 +01:00
parent 2fce37b5b3
commit 337aa8a3d6

View File

@ -44,6 +44,13 @@ function createXml()
if not params then return end if not params then return end
local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal() local uiColor, uiFontSize, uiVal = getUiColorSizeAndVal()
local pos = params.posX .. " " .. params.posY .. " -6"
local rot = "0 0 180"
if self.is_face_down then
pos = params.posX .. " " .. params.posY .. " 6"
rot = "0 180 180"
end
local xml = { local xml = {
{ {
tag = "Button", tag = "Button",
@ -53,12 +60,12 @@ function createXml()
onClick = "addOrSubtract", onClick = "addOrSubtract",
scale = "0.35 0.35 1", scale = "0.35 0.35 1",
colors = uiColor, colors = uiColor,
position = params.posX .. " " .. params.posY .. " -6", position = pos,
rotation = "0 0 180", rotation = rot,
height = params.size, height = params.size,
width = params.size width = params.size
}, },
children = { children = {
{ {
tag = "Text", tag = "Text",
attributes = { attributes = {
@ -99,7 +106,7 @@ function getUiColorSizeAndVal()
end end
function getColorBlock(hexColor) function getColorBlock(hexColor)
return table.concat({hexColor, hexColor, hexColor}, "|") return table.concat({ hexColor, hexColor, hexColor }, "|")
end end
function updateLabel() function updateLabel()