Fix Flexbox offset

Was off by one, leading to the outer pixel getting cut off at the boundary
This commit is contained in:
Sabine Lim
2023-05-08 17:47:44 +10:00
committed by GitHub
parent 9b932704e6
commit 6cd8e0ebb0

View File

@@ -25,11 +25,11 @@ return function(name, basalt)
local availableSpace = (flexDirection == "row" and width or height) - totalChildSize - (spacing * (totalElements - 1)) local availableSpace = (flexDirection == "row" and width or height) - totalChildSize - (spacing * (totalElements - 1))
local currentOffset = 0 local currentOffset = 1
if justifyContent == "center" then if justifyContent == "center" then
currentOffset = availableSpace / 2 currentOffset = 1 + availableSpace / 2
elseif justifyContent == "flex-end" then elseif justifyContent == "flex-end" then
currentOffset = availableSpace currentOffset = 1 + availableSpace
end end
for _, obj in ipairs(objects) do for _, obj in ipairs(objects) do