From 1f93d4f2856b123fb5fdc9fcd780e6d85d12b290 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Sat, 7 Sep 2024 19:44:20 -0400 Subject: [PATCH] Added arrows to GoogleMaps call lines. --- htdocs/lib/GoogleMaps.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/lib/GoogleMaps.js b/htdocs/lib/GoogleMaps.js index 50fc5d16..40d91e74 100644 --- a/htdocs/lib/GoogleMaps.js +++ b/htdocs/lib/GoogleMaps.js @@ -169,6 +169,14 @@ function GCall() { const dash = { path : 'M 0,-1 0,1', scale : 2, + strokeColor : '#000000', + strokeWeight : 1, + strokeOpacity : 0.5 + }; + const arrow = { + path : google.maps.SymbolPath.FORWARD_CLOSED_ARROW, + scale : 2, + strokeColor : '#000000', strokeWeight : 1, strokeOpacity : 0.5 }; @@ -178,7 +186,11 @@ function GCall() { strokeColor : '#000000', strokeOpacity : 0, strokeWeight : 0, - icons : [{ icon: dash, offset: 0, repeat: '8px' }] + icons : [ + { icon: dash, offset: '0%', repeat: '8px' }, + { icon: arrow, offset: '25px' }, + { icon: arrow, offset: '100%' } + ] }); } @@ -195,13 +207,13 @@ GCall.prototype.setEnds = function(lat1, lon1, lat2, lon2) { }; GCall.prototype.setColor = function(color) { - this.line.icons[0].icon.strokeColor = color; + this.line.icons.forEach((x) => { x.icon.strokeColor = color; }); this.line.setOptions({ icons: this.line.icons }); // this.line.setOptions({ strokeColor: color }); }; GCall.prototype.setOpacity = function(opacity) { - this.line.icons[0].icon.strokeOpacity = opacity; + this.line.icons.forEach((x) => { x.icon.strokeOpacity = opacity; }); this.line.setOptions({ icons: this.line.icons }); // this.line.setOptions({ strokeOpacity : opacity }); };