Skip to content

Commit

Permalink
Fixed autofocusing
Browse files Browse the repository at this point in the history
  • Loading branch information
ponlawat-w committed Dec 15, 2023
1 parent 6cae7f0 commit abfc6bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,9 @@ export default class OSMWaySnap extends PointerInteraction {
p => (lastCoordinate[0] === p[0] && lastCoordinate[1] === p[1])
|| !this.activeFeature!.getGeometry()!.intersectsCoordinate(p)
);
if (fitCoordinates.length > 1) {
map.getView().fit(boundingExtent(fitCoordinates), {
padding: Array(4).fill(this.focusPadding)
});
const extent = boundingExtent(fitCoordinates);
if (fitCoordinates.length > 1 && extent[0] !== extent[2] && extent[1] !== extent[3]) {
map.getView().fit(extent, { padding: Array(4).fill(this.focusPadding) });
}
}
}
Expand Down

0 comments on commit abfc6bf

Please sign in to comment.