Skip to content

Draw.Rectangle should use the same code to get the corners as Edit.Rectangle #1369

@Falke-Design

Description

@Falke-Design

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:

_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:

_findCorners() {
const latlngs = this._layer.getLatLngs()[0];
return L.PM.Utils._getRotatedRectangle(
latlngs[0],
latlngs[2],
this._angle || 0,
this._map
);
},

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions