refs #18 fix problem in elevation approx when approximating a new point between moved points

merge-requests/2/head
Julien Veyssier 2017-06-13 14:18:55 +02:00
parent 426b74b557
commit 8c76f7e3c3
1 changed files with 6 additions and 0 deletions

View File

@ -1872,8 +1872,12 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
_onMarkerDrag: function (e) {
var marker = e.target;
var poly = this._poly;
var origElevation = marker._origLatLng.alt;
L.extend(marker._origLatLng, marker._latlng);
if (origElevation) {
marker._latlng.alt = origElevation;
}
if (marker._middleLeft) {
marker._middleLeft.setLatLng(this._getMiddleLatLng(marker._prev, marker));
@ -2032,6 +2036,7 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
if (L.drawLocal.edit.approximateElevations) {
if (marker1._latlng.alt && marker2._latlng.alt) {
marker._latlng.alt = (marker1._latlng.alt + marker2._latlng.alt) / 2;
marker._origLatLng.alt = marker._latlng.alt;
}
}
};
@ -2046,6 +2051,7 @@ L.Edit.PolyVerticesEdit = L.Handler.extend({
if (L.drawLocal.edit.approximateElevations) {
if (marker1._latlng.alt && marker2._latlng.alt) {
marker._latlng.alt = (marker1._latlng.alt + marker2._latlng.alt) / 2;
marker._origLatLng.alt = marker._latlng.alt;
}
}
};