Fix resize size for hex grids

This commit is contained in:
Mitchell McCaffrey 2021-08-04 07:20:30 +10:00
parent 518f6b3e5b
commit 879a23f81a

View File

@ -39,10 +39,14 @@ function Transformer({
return { x: 0, y: 0 };
}
// Use min side for hex grids
const minSize = Vector2.componentMin(gridCellPixelSize);
const size = new Vector2(minSize, minSize);
// Get grid cell size in screen coordinates
const mapTransform = mapImage.getAbsoluteTransform();
const gridCellAbsoluteSize = Vector2.subtract(
mapTransform.point(gridCellPixelSize),
mapTransform.point(size),
mapTransform.point({ x: 0, y: 0 })
);
return gridCellAbsoluteSize;