Middlemarker bug

This commit is contained in:
portree_kid 2020-01-11 19:17:28 +01:00
parent cfebb2bea3
commit 357c1a56b8
5 changed files with 64 additions and 5 deletions

18
package-lock.json generated
View File

@ -11474,11 +11474,29 @@
"resolved": "https://registry.npmjs.org/leaflet-editable/-/leaflet-editable-1.2.0.tgz",
"integrity": "sha512-wG11JwpL8zqIbypTop6xCRGagMuWw68ihYu4uqrqc5Ep0wnEJeyob7NB2Rt5t74Oih4rwJ3OfwaGbzdowOGfYQ=="
},
"leaflet-polylinedecorator": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/leaflet-polylinedecorator/-/leaflet-polylinedecorator-1.6.0.tgz",
"integrity": "sha1-nvef0bUwLWe3Lv6Vmo7NJVPycmY=",
"requires": {
"leaflet-rotatedmarker": "^0.2.0"
}
},
"leaflet-rotatedmarker": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz",
"integrity": "sha1-RGf0n5jRv9VpWb2cZwUgPdJgEnc="
},
"leaflet-sidebar-v2": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/leaflet-sidebar-v2/-/leaflet-sidebar-v2-3.2.1.tgz",
"integrity": "sha512-PT+kq8wZh5nJ2clyPYg42l7XB4ywiFRgQzNt+RcxCE5UFIpj1PkbQzUvUXjyydPZRft8nAf5Y7gEgH3PhIOsSg=="
},
"leaflet-textpath": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/leaflet-textpath/-/leaflet-textpath-1.2.0.tgz",
"integrity": "sha512-anLGWptWb916MhEXi4WewYe08YKCawRvEXsMGj9fuYnUGd+irV3VG4UXcdW1l+Oa/TZoCTLQsg3LNwvFcroVog=="
},
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",

View File

@ -68,7 +68,9 @@
"jquery": "^3.4.1",
"leaflet": "^1.5.1",
"leaflet-editable": "^1.2.0",
"leaflet-polylinedecorator": "^1.6.0",
"leaflet-sidebar-v2": "^3.2.1",
"leaflet-textpath": "^1.2.0",
"lokijs": "^1.5.8",
"mathjs": "^6.2.5",
"path": "^0.12.7",

View File

@ -25,6 +25,36 @@ L.ParkingSpot = L.Circle.extend({
this.direction.addTo(this.editor.editLayer);
}
},
updateMiddleMarker: function() {
if (this.editEnabled()) {
try {
console.log("Update Middle ", this.editor.editLayer._layers[0]);
var o = this.editor.editLayer._layers;
console.log(o);
for (var key in o) {
if (o.hasOwnProperty(key)) {
console.log(key, o[key]);
console.log(this.editor._resizeLatLng.__vertex==o[key]);
// console.log(this.editor._resizeLatLng.__vertex._icon);
console.log(o[key] == this.direction);
if (this.editor._resizeLatLng.__vertex!=o[key] &&
o[key] != this.direction) {
o[key].setLatLng(this.getLatLng());
}
}
}
//Object.values(o);
/*
.forEach(vertex => {
console.log(this.editor._resizeLatLng.__vertex==vertex);
});
*/
} catch (error) {
console.log(error);
}
}
},
removeDirection: function () {
this.direction = undefined;
},
@ -66,9 +96,11 @@ L.ParkingSpot = L.Circle.extend({
console.log(event);
}
});
/*
this.on('editable:vertex:drag', function (event) {
console.log("Drag : ", event);
});
*/
this.on('click', function (event) {
console.log("Click : " + event.target);
store.default.dispatch('setParking', event.target.options.attributes);

View File

@ -32,5 +32,8 @@ L.TaxiwaySegment = L.Polyline.extend({
style.color = 'magenta';
}
this.setStyle(style);
if (!this.bidirectional) {
this.setText(' ► ', {repeat: true, attributes: {fill: 'red', size: 20}})
}
}
});

View File

@ -150,7 +150,7 @@ exports.readGroundnetXML = function (fDir, icao) {
}
});
polyline.on('editable:vertex:dragend', function (event) {
console.log(event.vertex);
console.log("Dragend : ", event.vertex);
if (dragIndex > 0) {
featureLookup[dragIndex].forEach(element => {
if (element instanceof L.ParkingSpot) {
@ -187,14 +187,19 @@ exports.readGroundnetXML = function (fDir, icao) {
return layerGroup;
}
/**
*
*/
follow = function (dragIndex, event) {
featureLookup[dragIndex].forEach(element => {
if(element !== event.target){
if (element instanceof L.ParkingSpot) {
element.disableEdit();
// element.disableEdit();
element.setLatLng(event.latlng);
element.enableEdit();
element.extensions();
// element.enableEdit();
// element.extensions();
element.updateMiddleMarker();
element.updateVertexFromDirection();
}
else if (element instanceof L.TaxiwaySegment) {
@ -210,7 +215,6 @@ follow = function (dragIndex, event) {
element.updateEndVertex(event.latlng);
element.updateMiddle();
}
}
}
});