mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 06:34:13 +00:00
fix: return 0 in canvas size if no blocks are present
This commit is contained in:
parent
8e8c568002
commit
c8edd54f4f
2 changed files with 9 additions and 3 deletions
|
|
@ -44,6 +44,15 @@ export const CanvasProvider = ({ children }: Props) => {
|
|||
if (coord.y > maxY) maxY = coord.y;
|
||||
});
|
||||
|
||||
if (minX == Infinity || maxX == Infinity || minY == Infinity || maxY == Infinity) {
|
||||
return {
|
||||
minX: 0,
|
||||
minY: 0,
|
||||
maxX: 0,
|
||||
maxY: 0,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
minX,
|
||||
minY,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue