[FEAT] Calc. fixes

This commit is contained in:
2026-01-01 01:39:03 +01:00
parent e916c80d00
commit ab939c202e
2 changed files with 9 additions and 7 deletions

View File

@@ -20,10 +20,11 @@ export const useExportLayers = (layersRef: Ref<Layer[]>, columns: Ref<number>, n
};
}
// Otherwise, calculate from sprite dimensions
const visibleLayers = getVisibleLayers();
const { maxWidth, maxHeight } = getMaxDimensionsAcrossLayers(visibleLayers);
const negativeSpacing = calculateNegativeSpacing(getAllVisibleSprites(), negativeSpacingEnabled.value);
// Otherwise, calculate from sprite dimensions across ALL layers (same as canvas)
// This ensures export dimensions match what's shown in the canvas
const { maxWidth, maxHeight } = getMaxDimensionsAcrossLayers(layersRef.value);
const allSprites = getVisibleLayers().flatMap(l => l.sprites);
const negativeSpacing = calculateNegativeSpacing(allSprites, negativeSpacingEnabled.value);
return {
cellWidth: maxWidth + negativeSpacing,
cellHeight: maxHeight + negativeSpacing,