aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapMarkerController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-21 23:59:16 +1300
committerGitHub <noreply@github.com>2016-12-21 23:59:16 +1300
commit19d6e1c9cc916ed4c1ed72fe168909770a657db2 (patch)
treec802adb481ee39ad5bb31c479bbf6266d2d23099 /web/app/view/MapMarkerController.js
parent77e45e57c92cb03688a2494b81dfe66969c6edbd (diff)
parentd3d8e6aed0f880a0077a5aa0b5bd2fcd189a5525 (diff)
downloadtrackermap-web-19d6e1c9cc916ed4c1ed72fe168909770a657db2.tar.gz
trackermap-web-19d6e1c9cc916ed4c1ed72fe168909770a657db2.tar.bz2
trackermap-web-19d6e1c9cc916ed4c1ed72fe168909770a657db2.zip
Merge pull request #364 from Abyss777/ol_3.20.0
Migrate to openlayers 3.20.0
Diffstat (limited to 'web/app/view/MapMarkerController.js')
-rw-r--r--web/app/view/MapMarkerController.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index 5fa9f4ca..b978aafd 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -92,7 +92,8 @@ Ext.define('Traccar.view.MapMarkerController', {
style = marker.getStyle();
if (style.getImage().fill !== this.getDeviceColor(device) ||
style.getImage().category !== device.get('category')) {
- marker.setStyle(this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category')));
+ this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category'));
+ marker.changed();
}
if (style.getText().getText() !== device.get('name')) {
style.getText().setText(device.get('name'));
@@ -144,7 +145,7 @@ Ext.define('Traccar.view.MapMarkerController', {
marker = this.latestMarkers[deviceId];
style = marker.getStyle();
if (style.getImage().angle !== position.get('course')) {
- Traccar.DeviceImages.rotateImageIcon(style.getImage(), position.get('course'));
+ this.rotateMarker(style, position.get('course'));
}
marker.setGeometry(geometry);
} else {
@@ -327,10 +328,15 @@ Ext.define('Traccar.view.MapMarkerController', {
style.getImage().category);
text = style.getText();
text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset);
- return new ol.style.Style({
- image: image,
- text: text
- });
+ style.setText(text);
+ style.setImage(image);
+ },
+
+ rotateMarker: function (style, angle) {
+ style.setImage(Traccar.DeviceImages.getImageIcon(style.getImage().fill,
+ style.getImage().zoom,
+ angle,
+ style.getImage().category));
},
updateDeviceMarker: function (style, color, category) {
@@ -341,21 +347,19 @@ Ext.define('Traccar.view.MapMarkerController', {
category);
text = style.getText();
text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset);
- return new ol.style.Style({
- image: image,
- text: text
- });
+ style.setText(text);
+ style.setImage(image);
},
selectMarker: function (marker, center) {
if (this.selectedMarker) {
- this.selectedMarker.setStyle(
- this.resizeMarker(this.selectedMarker.getStyle(), false));
+ this.resizeMarker(this.selectedMarker.getStyle(), false);
+ this.selectedMarker.changed();
}
if (marker) {
- marker.setStyle(
- this.resizeMarker(marker.getStyle(), true));
+ this.resizeMarker(marker.getStyle(), true);
+ marker.changed();
if (center) {
this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates());
}