aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapMarkerController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-30 19:50:14 +1300
committerGitHub <noreply@github.com>2016-12-30 19:50:14 +1300
commitf5030b90ecde5a50e05cd81ed8d08b6387b8dead (patch)
treeba77288ff1d7f9750e6583139dc62b823a4cd5c6 /web/app/view/MapMarkerController.js
parent3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8 (diff)
parentc6ba6502a41bfcb894245bee935006b3afb37d17 (diff)
downloadtrackermap-web-f5030b90ecde5a50e05cd81ed8d08b6387b8dead.tar.gz
trackermap-web-f5030b90ecde5a50e05cd81ed8d08b6387b8dead.tar.bz2
trackermap-web-f5030b90ecde5a50e05cd81ed8d08b6387b8dead.zip
Merge pull request #377 from Abyss777/selecting_improvement
Bring markers to front and deselect on empty space click
Diffstat (limited to 'web/app/view/MapMarkerController.js')
-rw-r--r--web/app/view/MapMarkerController.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index f8f0e43f..907451b6 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -52,7 +52,8 @@ Ext.define('Traccar.view.MapMarkerController', {
},
component: {
'#': {
- selectfeature: 'selectFeature'
+ selectfeature: 'selectFeature',
+ deselectfeature: 'deselectFeature'
}
}
}
@@ -111,7 +112,7 @@ Ext.define('Traccar.view.MapMarkerController', {
for (i = 0; i < data.length; i++) {
deviceId = data[i].get('id');
if (this.latestMarkers[deviceId]) {
- this.getView().getLatestSource().removeFeature(this.latestMarkers[deviceId]);
+ this.getView().getMarkersSource().removeFeature(this.latestMarkers[deviceId]);
}
}
},
@@ -158,7 +159,7 @@ Ext.define('Traccar.view.MapMarkerController', {
style.getText().setText(device.get('name'));
marker.setStyle(style);
this.latestMarkers[deviceId] = marker;
- this.getView().getLatestSource().addFeature(marker);
+ this.getView().getMarkersSource().addFeature(marker);
}
@@ -247,7 +248,7 @@ Ext.define('Traccar.view.MapMarkerController', {
Ext.Date.format(position.get('fixTime'), Traccar.Style.dateTimeFormat24));*/
marker.setStyle(style);
this.reportMarkers[position.get('id')] = marker;
- this.getView().getReportSource().addFeature(marker);
+ this.getView().getMarkersSource().addFeature(marker);
}
if (minx !== maxx || miny !== maxy) {
this.getView().getMapView().fit([minx, miny, maxx, maxy], this.getView().getMap().getSize());
@@ -269,7 +270,7 @@ Ext.define('Traccar.view.MapMarkerController', {
if (this.reportMarkers) {
for (key in this.reportMarkers) {
if (this.reportMarkers.hasOwnProperty(key)) {
- this.getView().getReportSource().removeFeature(this.reportMarkers[key]);
+ this.getView().getMarkersSource().removeFeature(this.reportMarkers[key]);
}
}
this.reportMarkers = {};
@@ -346,11 +347,13 @@ Ext.define('Traccar.view.MapMarkerController', {
selectMarker: function (marker, center) {
if (this.selectedMarker) {
this.resizeMarker(this.selectedMarker.getStyle(), false);
+ this.selectedMarker.getStyle().setZIndex(0);
this.selectedMarker.changed();
}
if (marker) {
this.resizeMarker(marker.getStyle(), true);
+ marker.getStyle().setZIndex(1);
marker.changed();
if (center) {
this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates());
@@ -379,5 +382,10 @@ Ext.define('Traccar.view.MapMarkerController', {
this.fireEvent('selectreport', record, false);
}
}
+ },
+
+ deselectFeature: function () {
+ this.selectMarker(null, false);
+ this.fireEvent('deselectfeature');
}
});