From 4f077390348cb9d28fc27759c69b921a4177a9ee Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 30 Aug 2017 16:18:34 +0500 Subject: Add scale line to map --- web/app/view/map/BaseMap.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index a0d346e..ea7b58d 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -175,6 +175,21 @@ Ext.define('Traccar.view.map.BaseMap', { view: this.mapView }); + switch (Traccar.app.getPreference('distanceUnit', 'km')) { + case 'mi': + this.map.addControl(new ol.control.ScaleLine({ + units: 'us' + })); + break; + case 'nmi': + this.map.addControl(new ol.control.ScaleLine({ + units: 'nautical' + })); + break; + default: + this.map.addControl(new ol.control.ScaleLine()); + } + target = this.map.getTarget(); if (typeof target === 'string') { target = Ext.get(target).dom; -- cgit v1.2.3 From 3ad848939c559c10f1d77de8f75c19c588f4f22d Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 30 Aug 2017 16:23:41 +0500 Subject: Add break to default --- web/app/view/map/BaseMap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index ea7b58d..0559e0c 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -188,6 +188,7 @@ Ext.define('Traccar.view.map.BaseMap', { break; default: this.map.addControl(new ol.control.ScaleLine()); + break; } target = this.map.getTarget(); -- cgit v1.2.3