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
|
||||
let ascentDescent;
|
||||
return this._updateElevation(trackPoints).then((a) => {
|
||||
|
@ -216,17 +216,15 @@ module.exports = function(Database) {
|
|||
if(!_noEvent)
|
||||
this.emit("linePoints", padId, lineId, points);
|
||||
|
||||
if(!_noUpdateLine) // When deleting the line, we don't want to set this
|
||||
return this._updatePadObject("Line", padId, lineId, ascentDescent, true);
|
||||
}).then((newLine) => {
|
||||
if(!_noEvent)
|
||||
this.emit("line", padId, newLine);
|
||||
});
|
||||
},
|
||||
|
||||
deleteLine(padId, lineId) {
|
||||
return utils.promiseAuto({
|
||||
line: this._deletePadObject("Line", padId, lineId),
|
||||
points: this._setLinePoints(padId, lineId, [ ], true)
|
||||
points: this._setLinePoints(padId, lineId, [ ], true, true)
|
||||
}).then((res) => {
|
||||
this.emit("deleteLine", padId, { id: lineId });
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue