airports/issues/85
This commit is contained in:
portree_kid 2020-08-01 09:08:15 +02:00
parent 0499ee82c2
commit 02433ac77c

View File

@ -11,11 +11,13 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
taxiwaySegment.__proto__.updateBeginVertex = function (latlng) { taxiwaySegment.__proto__.updateBeginVertex = function (latlng) {
if (this._latlngs[0].__vertex) { if (this._latlngs[0].__vertex) {
this._latlngs[0].__vertex.setLatLng(latlng); this._latlngs[0].__vertex.setLatLng(latlng);
this.selectVertex(Number(this._latlngs[0].glueindex));
} }
}; };
taxiwaySegment.__proto__.updateEndVertex = function (latlng) { taxiwaySegment.__proto__.updateEndVertex = function (latlng) {
if (this._latlngs[1].__vertex) { if (this._latlngs[1].__vertex) {
this._latlngs[1].__vertex.setLatLng(latlng); this._latlngs[1].__vertex.setLatLng(latlng);
this.selectVertex(Number(this._latlngs[1].glueindex));
} }
}; };
@ -49,9 +51,9 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
this.options.attributes.selected = true; this.options.attributes.selected = true;
this.updateStyle(); this.updateStyle();
}; };
taxiwaySegment.__proto__.selectVertex = function () { taxiwaySegment.__proto__.selectVertex = function (index) {
this.getLatLngs().forEach( element => { this.getLatLngs().forEach( element => {
if (Number(element.glueindex) === store.default.state.Editable.index) { if (Number(element.glueindex) === index) {
if (element.__vertex._icon != null) { if (element.__vertex._icon != null) {
element.__vertex.__proto__.deselect = function () { element.__vertex.__proto__.deselect = function () {
if (this._icon != null) { if (this._icon != null) {
@ -137,12 +139,13 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
}); });
this.on('editable:drawing:move', function (event) { this.on('editable:drawing:move', function (event) {
if (dragIndex >= 0) { if (dragIndex >= 0) {
this.selectVertex(dragIndex);
console.log('GlueDrag : '+ dragIndex + '\t' + event.target.dragIndex); console.log('GlueDrag : '+ dragIndex + '\t' + event.target.dragIndex);
this.follow(dragIndex, event); this.follow(dragIndex, event);
} }
}); });
this.on('editable:vertex:new', event => { this.on('editable:vertex:new', event => {
console.log(event) console.debug('Vertex Move ' + event)
// Find nearest node // Find nearest node
let closest = this.editLayer.closestLayerSnap(event.latlng, 5) let closest = this.editLayer.closestLayerSnap(event.latlng, 5)
let taxiwaySegment = event.latlng.__vertex.editor.feature; let taxiwaySegment = event.latlng.__vertex.editor.feature;
@ -213,7 +216,7 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
} else { } else {
this.editLayer.featureLookup[event.vertex.latlng.glueindex].forEach this.editLayer.featureLookup[event.vertex.latlng.glueindex].forEach
store.default.dispatch('setNode', event.vertex.latlng) store.default.dispatch('setNode', event.vertex.latlng)
this.selectVertex() this.selectVertex(store.default.state.Editable.index)
} }
} }
}); });
@ -225,6 +228,26 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
return; return;
console.log("Drag Start : ", event.vertex.latlng.glueindex); console.log("Drag Start : ", event.vertex.latlng.glueindex);
dragIndex = event.vertex.latlng.glueindex; dragIndex = event.vertex.latlng.glueindex;
if (Number(store.default.state.Editable.index) >= 0 &&
this.featureLookup[store.default.state.Editable.index] !== undefined) {
this.featureLookup[store.default.state.Editable.index].forEach(element => {
if(element.deselect !== undefined) {
element.deselect();
}
});
}
if (!this.editor.map.editTools.drawing()) {
var hold = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.HoldNode);
if (hold.length > 0) {
hold[0].select();
}
var parking = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.ParkingSpot);
if (parking.length > 0) {
parking[0].selectParking();
} else {
this.selectVertex(Number(dragIndex))
}
}
}); });
this.on('editable:vertex:dragend', function (event) { this.on('editable:vertex:dragend', function (event) {
console.log("Dragend : ", event.vertex); console.log("Dragend : ", event.vertex);
@ -255,7 +278,7 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
var lines = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.Polyline); var lines = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.Polyline);
Vue.default.nextTick(function () { Vue.default.nextTick(function () {
lines.forEach( line => { lines.forEach( line => {
line.selectVertex() line.selectVertex(store.default.state.Editable.index)
}); });
}) })
} }