-
Notifications
You must be signed in to change notification settings - Fork 444
Closed
Labels
Description
The corners will be not correct when the rectangle is drawn with rectangleAngle
.
- Update
_findCorners
in Draw.Rectangle - add
rectangleAngle: 0
to the default Draw options: src/js/Draw/L.PM.Draw.js
Current:
leaflet-geoman/src/js/Draw/L.PM.Draw.Rectangle.js
Lines 248 to 257 in 932d4a9
_findCorners() { | |
const corners = this._layer.getBounds(); | |
const northwest = corners.getNorthWest(); | |
const northeast = corners.getNorthEast(); | |
const southeast = corners.getSouthEast(); | |
const southwest = corners.getSouthWest(); | |
return [northwest, northeast, southeast, southwest]; | |
}, |
New & correct one:
leaflet-geoman/src/js/Edit/L.PM.Edit.Rectangle.js
Lines 199 to 207 in 932d4a9
_findCorners() { | |
const latlngs = this._layer.getLatLngs()[0]; | |
return L.PM.Utils._getRotatedRectangle( | |
latlngs[0], | |
latlngs[2], | |
this._angle || 0, | |
this._map | |
); | |
}, |