Skip to content

Commit

Permalink
fix: ensure that project returns valid lat/lng when using resizable (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesLMilner committed Mar 10, 2024
1 parent 95dcccd commit 57f126c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,14 @@ export class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {
continue;
}

const bboxPixelCoordinate = this.config.project(bbox[i][0], bbox[i][1]);
// Projecting can sometimes cause invalid coordinates
let bboxPixelCoordinate;
try {
bboxPixelCoordinate = this.config.project(bbox[i][0], bbox[i][1]);
} catch (_) {
return false;
}

const distanceToOtherBboxCoordinate = this.pixelDistance.measure(
{
containerX: bboxPixelCoordinate.x,
Expand Down

0 comments on commit 57f126c

Please sign in to comment.