kopia lustrzana https://github.com/FacilMap/facilmap
Fix error when deleting line (introduced with elevation feature)
rodzic
ed10477f7e
commit
050cd16737
|
@ -198,7 +198,7 @@ module.exports = function(Database) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLinePoints(padId, lineId, trackPoints, _noEvent) {
|
_setLinePoints(padId, lineId, trackPoints, _noEvent, _noUpdateLine) {
|
||||||
// First get elevation, so that if that fails, we don't update anything
|
// First get elevation, so that if that fails, we don't update anything
|
||||||
let ascentDescent;
|
let ascentDescent;
|
||||||
return this._updateElevation(trackPoints).then((a) => {
|
return this._updateElevation(trackPoints).then((a) => {
|
||||||
|
@ -216,17 +216,15 @@ module.exports = function(Database) {
|
||||||
if(!_noEvent)
|
if(!_noEvent)
|
||||||
this.emit("linePoints", padId, lineId, points);
|
this.emit("linePoints", padId, lineId, points);
|
||||||
|
|
||||||
return this._updatePadObject("Line", padId, lineId, ascentDescent, true);
|
if(!_noUpdateLine) // When deleting the line, we don't want to set this
|
||||||
}).then((newLine) => {
|
return this._updatePadObject("Line", padId, lineId, ascentDescent, true);
|
||||||
if(!_noEvent)
|
|
||||||
this.emit("line", padId, newLine);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteLine(padId, lineId) {
|
deleteLine(padId, lineId) {
|
||||||
return utils.promiseAuto({
|
return utils.promiseAuto({
|
||||||
line: this._deletePadObject("Line", padId, lineId),
|
line: this._deletePadObject("Line", padId, lineId),
|
||||||
points: this._setLinePoints(padId, lineId, [ ], true)
|
points: this._setLinePoints(padId, lineId, [ ], true, true)
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.emit("deleteLine", padId, { id: lineId });
|
this.emit("deleteLine", padId, { id: lineId });
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue