From 3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 18 Aug 2017 11:22:48 +1200 Subject: Fix various style issues --- web/app/view/map/BaseMap.js | 10 ++++------ web/app/view/map/MapController.js | 8 ++++---- web/app/view/map/MapMarkerController.js | 28 +++++++++++----------------- 3 files changed, 19 insertions(+), 27 deletions(-) (limited to 'web/app/view/map') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index c4297f6..5829cac 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -95,10 +95,10 @@ Ext.define('Traccar.view.map.BaseMap', { index = index < 0 ? index + urlsLength : index; if (x < 0) { - x = 'M' + (-x); + x = 'M' + -x; } if (y < 0) { - y = 'M' + (-y); + y = 'M' + -y; } return 'http://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl' .replace('{}', index).replace('{x}', x).replace('{y}', y).replace('{z}', z); @@ -171,7 +171,7 @@ Ext.define('Traccar.view.map.BaseMap', { } this.map.on('pointermove', function (e) { - var hit = this.forEachFeatureAtPixel(e.pixel, function (feature, layer) { + var hit = this.forEachFeatureAtPixel(e.pixel, function () { return true; }); if (hit) { @@ -187,7 +187,7 @@ Ext.define('Traccar.view.map.BaseMap', { return !layer.get('name'); } })) { - this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { + this.map.forEachFeatureAtPixel(e.pixel, function (feature) { this.fireEvent('selectfeature', feature); }.bind(this)); } else { @@ -206,9 +206,7 @@ Ext.define('Traccar.view.map.BaseMap', { } } }, function () { - proj4.defs('BD-MC', '+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs'); proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'); ol.proj.get('EPSG:3395').setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]); - }); diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index f2a561a..d8d2f04 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -79,10 +79,10 @@ Ext.define('Traccar.view.map.MapController', { this.getView().getGeofencesSource().clear(); if (this.lookupReference('showGeofencesButton').pressed) { Ext.getStore('Geofences').each(function (geofence) { - var feature = new ol.Feature(Traccar.GeofenceConverter - .wktToGeometry(this.getView().getMapView(), geofence.get('area'))); - feature.setStyle(this.getAreaStyle(geofence.get('name'), - geofence.get('attributes') ? geofence.get('attributes').color : null)); + var feature = new ol.Feature( + Traccar.GeofenceConverter.wktToGeometry(this.getView().getMapView(), geofence.get('area'))); + feature.setStyle(this.getAreaStyle( + geofence.get('name'), geofence.get('attributes') ? geofence.get('attributes').color : null)); this.getView().getGeofencesSource().addFeature(feature); return true; }, this); diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 24742ff..d3b813b 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -211,7 +211,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { projection = mapView.getProjection(); center = ol.proj.fromLonLat([position.get('longitude'), position.get('latitude')]); pointResolution = ol.proj.getPointResolution(projection, mapView.getResolution(), center); - radius = (position.get('accuracy') / ol.proj.METERS_PER_UNIT.m) * mapView.getResolution() / pointResolution; + radius = position.get('accuracy') / ol.proj.METERS_PER_UNIT.m * mapView.getResolution() / pointResolution; if (feature) { feature.getGeometry().setCenter(center); @@ -252,8 +252,8 @@ Ext.define('Traccar.view.map.MapMarkerController', { marker.set('record', device); style = this.getLatestMarker(this.getDeviceColor(device), - position.get('course'), - device.get('category')); + position.get('course'), + device.get('category')); style.getText().setText(device.get('name')); marker.setStyle(style); marker.setId(device.get('id')); @@ -405,7 +405,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { width: Traccar.Style.mapTextStrokeWidth }), offsetY: -image.getSize()[1] / 2 - Traccar.Style.mapTextOffset, - font : Traccar.Style.mapTextFont + font: Traccar.Style.mapTextFont }) }); }, @@ -420,10 +420,8 @@ Ext.define('Traccar.view.map.MapMarkerController', { resizeMarker: function (style, zoom) { var image, text; - image = Traccar.DeviceImages.getImageIcon(style.getImage().fill, - zoom, - style.getImage().angle, - style.getImage().category); + image = Traccar.DeviceImages.getImageIcon( + style.getImage().fill, zoom, style.getImage().angle, style.getImage().category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); style.setText(text); @@ -431,18 +429,14 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, rotateMarker: function (style, angle) { - style.setImage(Traccar.DeviceImages.getImageIcon(style.getImage().fill, - style.getImage().zoom, - angle, - style.getImage().category)); + style.setImage(Traccar.DeviceImages.getImageIcon( + style.getImage().fill, style.getImage().zoom, angle, style.getImage().category)); }, updateDeviceMarker: function (style, color, category) { var image, text; - image = Traccar.DeviceImages.getImageIcon(color, - style.getImage().zoom, - style.getImage().angle, - category); + image = Traccar.DeviceImages.getImageIcon( + color, style.getImage().zoom, style.getImage().angle, category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); style.setText(text); @@ -599,7 +593,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { } }, - filterDevices: function (store) { + filterDevices: function () { Ext.getStore('Devices').each(this.updateDeviceVisibility, this, false); } }); -- cgit v1.2.3