aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-11-14 17:41:45 +0500
committerAbyss777 <abyss@fox5.ru>2016-11-14 17:41:45 +0500
commitfcd47ae26b362891514d58a02377d7fbf696b961 (patch)
treee5c6bff81c7a600341ed677a94f1a0fe729725b4 /web/app/view
parentcac80442ee6ce9ed72007733346f17fa410d1674 (diff)
downloadetbsa-traccar-web-fcd47ae26b362891514d58a02377d7fbf696b961.tar.gz
etbsa-traccar-web-fcd47ae26b362891514d58a02377d7fbf696b961.tar.bz2
etbsa-traccar-web-fcd47ae26b362891514d58a02377d7fbf696b961.zip
Remove marker style recreation on marker rotate and color change
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/MapController.js29
1 files changed, 4 insertions, 25 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index c29c490..13d3c8b 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -86,17 +86,6 @@ Ext.define('Traccar.view.MapController', {
}
},
- changeMarkerColor: function (style, color, category) {
- var newStyle = new ol.style.Style({
- image: Traccar.DeviceImages.getImageIcon(color,
- style.getImage().zoom,
- style.getImage().angle,
- category),
- text: style.getText()
- });
- return newStyle;
- },
-
updateDevice: function (store, data) {
var i, device, deviceId, marker, style;
@@ -113,8 +102,9 @@ Ext.define('Traccar.view.MapController', {
style = marker.getStyle();
if (style.getImage().fill !== this.getDeviceColor(device) ||
style.getImage().category !== device.get('category')) {
- marker.setStyle(
- this.changeMarkerColor(style, this.getDeviceColor(device), device.get('category')));
+ Traccar.DeviceImages.changeImageColor(style.getImage(),
+ this.getDeviceColor(device), device.get('category'));
+ marker.changed();
}
}
}
@@ -157,7 +147,7 @@ Ext.define('Traccar.view.MapController', {
marker = this.latestMarkers[deviceId];
style = marker.getStyle();
if (style.getImage().angle !== position.get('course')) {
- marker.setStyle(this.rotateMarker(marker.getStyle(), position.get('course')));
+ Traccar.DeviceImages.rotateImageIcon(style.getImage(), position.get('course'));
}
marker.setGeometry(geometry);
} else {
@@ -329,17 +319,6 @@ Ext.define('Traccar.view.MapController', {
});
},
- rotateMarker: function (style, angle) {
- var newStyle = new ol.style.Style({
- image: Traccar.DeviceImages.getImageIcon(style.getImage().fill,
- style.getImage().zoom,
- angle,
- style.getImage().category),
- text: style.getText()
- });
- return newStyle;
- },
-
selectMarker: function (marker, center) {
if (this.selectedMarker) {
this.selectedMarker.setStyle(