-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #6: Add draw compatibility for recent Leaflet version
- Loading branch information
1 parent
a2a3507
commit 0e7b8fa
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @file | ||
* Override methods from Leaflet.draw for compatibility with Leaflet 1.9+. | ||
* | ||
* Prevent deprecation warnings: | ||
* "Deprecated use of _flat, please use L.LineUtil.isFlat instead." | ||
* Deprecated since 2017, (will be) removed in 2.x. | ||
*/ | ||
L.Edit.Poly.include({ | ||
_defaultShape: function () { | ||
if (!L.LineUtil.isFlat) { | ||
return this._latlngs; | ||
} | ||
return L.LineUtil.isFlat(this._poly._latlngs) ? this._poly._latlngs : this._poly._latlngs[0]; | ||
} | ||
}); | ||
|
||
L.Edit.PolyVerticesEdit.include({ | ||
_defaultShape: function () { | ||
if (!L.LineUtil.isFlat) { | ||
return this._poly._latlngs; | ||
} | ||
return L.LineUtil.isFlat(this._latlngs) ? this._latlngs : this._latlngs[0]; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters