From cf1c829c1187095549c90ea6319299e8bf459db4 Mon Sep 17 00:00:00 2001 From: Keith Paterson Date: Wed, 21 Apr 2021 10:53:11 +0200 Subject: [PATCH] Improved Tooltips --- src/renderer/components/EditLayer.vue | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 31c63e2..9494f50 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -246,11 +246,23 @@ You should have received a copy of the GNU General Public License along with FG this.groundnetLayerGroup.eachLayer(l => { if (l instanceof L.Polyline) { l.getLatLngs().forEach(l => { - if (l.__vertex && !l.__vertex.getTooltip()) { - l.__vertex.bindTooltip(l.glueindex, {permanent: true}); + if (this.$parent.mapObject.getBounds().contains(l)) { + if (l.__vertex && !l.__vertex.getTooltip()) { + 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); }, @@ -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 () {