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
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 = {
{
tag = "Button",
@ -53,12 +60,12 @@ function createXml()
onClick = "addOrSubtract",
scale = "0.35 0.35 1",
colors = uiColor,
position = params.posX .. " " .. params.posY .. " -6",
rotation = "0 0 180",
position = pos,
rotation = rot,
height = params.size,
width = params.size
},
children = {
children = {
{
tag = "Text",
attributes = {
@ -77,7 +84,7 @@ end
function onRotate(_, flip, _, _, oldFlip)
if flip == oldFlip then return end
if flip == 180 then
self.UI.setAttribute("xmlBtn", "position", params.posX .. " " .. params.posY .. " 6")
self.UI.setAttribute("xmlBtn", "rotation", "0 180 180")
@ -99,7 +106,7 @@ function getUiColorSizeAndVal()
end
function getColorBlock(hexColor)
return table.concat({hexColor, hexColor, hexColor}, "|")
return table.concat({ hexColor, hexColor, hexColor }, "|")
end
function updateLabel()