Improved Tooltips

This commit is contained in:
Keith Paterson 2021-04-21 10:53:11 +02:00
parent cfa7a1bf3b
commit cf1c829c11

View File

@ -246,11 +246,23 @@ You should have received a copy of the GNU General Public License along with FG
this.groundnetLayerGroup.eachLayer(l => { this.groundnetLayerGroup.eachLayer(l => {
if (l instanceof L.Polyline) { if (l instanceof L.Polyline) {
l.getLatLngs().forEach(l => { l.getLatLngs().forEach(l => {
if (this.$parent.mapObject.getBounds().contains(l)) {
if (l.__vertex && !l.__vertex.getTooltip()) { if (l.__vertex && !l.__vertex.getTooltip()) {
l.__vertex.bindTooltip(l.glueindex, {permanent: true}); l.__vertex.bindTooltip(l.glueindex, {permanent: true});
} }
}
}); });
} }
if (l instanceof L.ParkingSpot) {
if (this.$parent.mapObject.getBounds().contains(l.getLatLng())) {
var parkingHub = l.glueindex + " " + l.options.attributes.name + " " + l.options.attributes.number;
if(l.box) {
l.box.bindTooltip(parkingHub, {permanent: true, direction: 'right'});
} else {
l.bindTooltip(parkingHub, {permanent: true, direction: 'right'});
}
}
}
}); });
setTimeout(this.closeTooltips.bind(this), 2000); setTimeout(this.closeTooltips.bind(this), 2000);
}, },
@ -263,6 +275,13 @@ You should have received a copy of the GNU General Public License along with FG
} }
}); });
} }
if (l instanceof L.ParkingSpot) {
if(l.box) {
l.box.unbindTooltip();
} else {
l.unbindTooltip();
}
}
}); });
}, },
disableEdit () { disableEdit () {