Moved position of percentages on Token Arranger

This commit is contained in:
Jorge Parra 2023-03-23 10:42:46 -04:00
parent 52e91a72c6
commit 5688f26edd

View File

@ -235,13 +235,19 @@ end
-- creates percentage representation buttons
function createPercentageButton(token_count, value_count, data, cumulative_percentage)
local cumulative_percentage = cumulative_percentage or false
local offset = 2.2
local offset = -2.675
local label_string = string.format("%s", string.format("%05.2f", math.floor((token_count / #data) * 10000) / 100) .. "%")
local buttonScale = {2, 2, 2}
if percentage == "cumulative" then
buttonScale = {1.5, 1.5, 1.5}
offset = -2.9
end
if cumulative_percentage then
offset = 3.8
offset = -2.5
label_string = string.format("%s", "(" .. string.format("%05.2f", cumulative_percentage) .. "%)")
if cumulative_percentage == 100 then
label_string = string.format("%s", "(" .. string.format("%05.1f", cumulative_percentage) .. "%)")
end
end
self.createButton({
@ -249,9 +255,9 @@ function createPercentageButton(token_count, value_count, data, cumulative_perce
click_function = "print",
width = 0,
height = 0,
scale = {2, 2, 2},
scale = buttonScale,
font_color = {r=1,g=1,b=1},
position = (Vector(offset, -0.05, -2.675) + Vector((0.875 * token_count) + 0.1, 0, 0.875 * value_count))
position = (Vector(2.2, -0.05, offset) + Vector(0.1, 0, 0.875 * value_count))
})
end
@ -304,6 +310,9 @@ function layout(_, _, isRightClick)
-- laying out the tokens
local pos = self.getPosition() + Vector(3.55, -0.05, -3.95)
if percentage then
pos.z = self.getPosition().z - 7
end
local location = { x = pos.x, y = pos.y, z = pos.z }
local current_value = data[1].value
local token_count = 0