Moved position of percentages on Token Arranger
This commit is contained in:
parent
52e91a72c6
commit
5688f26edd
@ -235,13 +235,19 @@ end
|
|||||||
|
|
||||||
-- creates percentage representation buttons
|
-- creates percentage representation buttons
|
||||||
function createPercentageButton(token_count, value_count, data, cumulative_percentage)
|
function createPercentageButton(token_count, value_count, data, cumulative_percentage)
|
||||||
local cumulative_percentage = cumulative_percentage or false
|
local offset = -2.675
|
||||||
local offset = 2.2
|
|
||||||
local label_string = string.format("%s", string.format("%05.2f", math.floor((token_count / #data) * 10000) / 100) .. "%")
|
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
|
if cumulative_percentage then
|
||||||
offset = 3.8
|
offset = -2.5
|
||||||
label_string = string.format("%s", "(" .. string.format("%05.2f", cumulative_percentage) .. "%)")
|
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
|
end
|
||||||
|
|
||||||
self.createButton({
|
self.createButton({
|
||||||
@ -249,9 +255,9 @@ function createPercentageButton(token_count, value_count, data, cumulative_perce
|
|||||||
click_function = "print",
|
click_function = "print",
|
||||||
width = 0,
|
width = 0,
|
||||||
height = 0,
|
height = 0,
|
||||||
scale = {2, 2, 2},
|
scale = buttonScale,
|
||||||
font_color = {r=1,g=1,b=1},
|
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
|
end
|
||||||
|
|
||||||
@ -304,6 +310,9 @@ function layout(_, _, isRightClick)
|
|||||||
|
|
||||||
-- laying out the tokens
|
-- laying out the tokens
|
||||||
local pos = self.getPosition() + Vector(3.55, -0.05, -3.95)
|
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 location = { x = pos.x, y = pos.y, z = pos.z }
|
||||||
local current_value = data[1].value
|
local current_value = data[1].value
|
||||||
local token_count = 0
|
local token_count = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user