Added grid inset to map snapping

This commit is contained in:
Mitchell McCaffrey
2020-10-09 14:50:51 +11:00
parent f851b01f47
commit e92a9acb5a
4 changed files with 42 additions and 12 deletions

View File

@@ -40,12 +40,13 @@ function MapGrid({ map, strokeWidth }) {
return null;
}
const gridSizeNormalized = {
x: 1 / gridX,
y: 1 / gridY,
};
const gridInset = map && map.grid.inset;
const gridSizeNormalized = {
x: (gridInset.bottomRight.x - gridInset.topLeft.x) / gridX,
y: (gridInset.bottomRight.y - gridInset.topLeft.y) / gridY,
};
const insetWidth = (gridInset.bottomRight.x - gridInset.topLeft.x) * mapWidth;
const insetHeight =
(gridInset.bottomRight.y - gridInset.topLeft.y) * mapHeight;