aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Application.js1
-rw-r--r--web/app/DeviceImages.js43
-rw-r--r--web/app/Style.js2
-rw-r--r--web/app/store/DeviceImages.js64
-rw-r--r--web/app/view/DeviceDialog.js8
-rw-r--r--web/app/view/MapController.js12
-rw-r--r--web/app/view/ReportController.js2
7 files changed, 71 insertions, 61 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index a92d148b..702a75a9 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -127,7 +127,6 @@ Ext.define('Traccar.Application', {
},
showError: function (response) {
- var data;
if (Ext.isString(response)) {
Ext.Msg.alert(Strings.errorTitle, response);
} else if (response.responseText) {
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js
index 87f2ca87..f96a3b06 100644
--- a/web/app/DeviceImages.js
+++ b/web/app/DeviceImages.js
@@ -18,24 +18,21 @@
Ext.define('Traccar.DeviceImages', {
singleton: true,
-
- getImageIcon: function(color, zoom, angle, category) {
- var image, device, svg, width, height, rotateTransform, scaleTransform, transform, fill;
- // Get right image or fallback to default arrow
+
+ getImageSvg: function (color, zoom, angle, category) {
+ var i, device, svg, width, height, rotateTransform, scaleTransform, fill;
+
if (category) {
- device = Ext.getStore('DeviceImages').findRecord('key', category);
+ device = Ext.getStore('DeviceImages').findRecord('key', category, 0, false, false, true);
}
if (device === undefined || device === null) {
- device = Ext.getStore('DeviceImages').findRecord('key', 'default');
+ device = Ext.getStore('DeviceImages').findRecord('key', 'default', 0, false, false, true);
}
-
- // Duplicate svg object to not brake origin
svg = Ext.clone(device.get('svg'));
- // Get original dimensions
width = parseFloat(svg.documentElement.getAttribute('width'));
height = parseFloat(svg.documentElement.getAttribute('height'));
- // Colorize
+
fill = device.get('fillId');
if (!Ext.isArray(fill)) {
fill = [fill];
@@ -43,11 +40,10 @@ Ext.define('Traccar.DeviceImages', {
for (i = 0; i < fill.length; i++) {
svg.getElementById(fill[i]).style.fill = color;
}
- // Prepare rotate transformation
+
rotateTransform = 'rotate(' + angle + ' ' + (width / 2) + ' ' + (height / 2) + ')';
svg.getElementById(device.get('rotateId')).setAttribute('transform', rotateTransform);
- // Adjust size and prepare scale transformation
width *= Traccar.Style.mapScaleNormal;
height *= Traccar.Style.mapScaleNormal;
if (zoom) {
@@ -63,23 +59,30 @@ Ext.define('Traccar.DeviceImages', {
} else {
svg.getElementById(device.get('scaleId')).setAttribute('transform', scaleTransform + ' ' + rotateTransform);
}
- //transform = scaleTransform + ' ' + rotateTransform;
-
- // Set dimension attributes
svg.documentElement.setAttribute('width', width);
svg.documentElement.setAttribute('height', height);
svg.documentElement.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
-
+
+ return svg;
+ },
+
+ getImageIcon: function (color, zoom, angle, category) {
+ var image, svg, width, height;
+
+ svg = this.getImageSvg(color, zoom, angle, category);
+ width = parseFloat(svg.documentElement.getAttribute('width'));
+ height = parseFloat(svg.documentElement.getAttribute('height'));
+
image = new ol.style.Icon({
- imgSize: [width, height], // Workaround for IE
+ imgSize: [width, height],
src: 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement))
});
image.fill = color;
image.zoom = zoom;
image.angle = angle;
image.category = category;
-
+
return image;
- }
-}); \ No newline at end of file
+ }
+});
diff --git a/web/app/Style.js b/web/app/Style.js
index b19584f0..a7fe1056 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -57,7 +57,7 @@ Ext.define('Traccar.Style', {
mapColorOnline: 'rgba(77, 250, 144, 1.0)',
mapColorUnknown: 'rgba(250, 190, 77, 1.0)',
- mapColorOffline: 'rgba(255, 84, 104, 1.0)',
+ mapColorOffline: 'rgba(255, 162, 173, 1.0)',
mapScaleNormal: 1,
mapScaleSelected: 1.5,
diff --git a/web/app/store/DeviceImages.js b/web/app/store/DeviceImages.js
index 64a78556..efe8606a 100644
--- a/web/app/store/DeviceImages.js
+++ b/web/app/store/DeviceImages.js
@@ -17,12 +17,12 @@
*/
Ext.define('Traccar.store.DeviceImages', {
extend: 'Ext.data.Store',
- fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId', 'scale'],
+ fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId'],
data: [{
- key: 'route',
- name: Strings.categoryRoute,
- svg: document.getElementById('routeSvg').contentDocument,
+ key: 'arrow',
+ name: Strings.categoryArrow,
+ svg: document.getElementById('arrowSvg').contentDocument,
fillId: 'arrow',
rotateId: 'arrow',
scaleId: 'arrow'
@@ -30,64 +30,64 @@ Ext.define('Traccar.store.DeviceImages', {
key: 'default',
name: Strings.categoryDefault,
svg: document.getElementById('defaultSvg').contentDocument,
- fillId: ['path4148', 'path4149'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'car',
name: Strings.categoryCar,
svg: document.getElementById('carSvg').contentDocument,
- fillId: ['path4148', 'path4157'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'bus',
name: Strings.categoryBus,
svg: document.getElementById('busSvg').contentDocument,
- fillId: ['path4148', 'path4200'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'truck',
name: Strings.categoryTruck,
svg: document.getElementById('truckSvg').contentDocument,
- fillId: ['path4148', 'path4336'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'ship',
name: Strings.categoryShip,
svg: document.getElementById('shipSvg').contentDocument,
- fillId: ['path4148', 'path4177'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'plane',
name: Strings.categoryPlane,
svg: document.getElementById('planeSvg').contentDocument,
- fillId: ['path4148', 'path4203'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'motorcycle',
name: Strings.categoryMotorcycle,
svg: document.getElementById('motorcycleSvg').contentDocument,
- fillId: ['path4148', 'path4256'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'bicycle',
name: Strings.categoryBicycle,
svg: document.getElementById('bicycleSvg').contentDocument,
- fillId: ['path4148', 'path4282'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}, {
key: 'person',
name: Strings.categoryPerson,
svg: document.getElementById('personSvg').contentDocument,
- fillId: ['path4148', 'path4308'],
- rotateId: 'path4148',
- scaleId: 'layer2'
+ fillId: 'path4724',
+ rotateId: 'path4724',
+ scaleId: 'layer1'
}]
-}); \ No newline at end of file
+});
diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js
index dea50749..d3f964ed 100644
--- a/web/app/view/DeviceDialog.js
+++ b/web/app/view/DeviceDialog.js
@@ -65,6 +65,14 @@ Ext.define('Traccar.view.DeviceDialog', {
queryMode: 'local',
displayField: 'name',
valueField: 'key',
+ listConfig: {
+ getInnerTpl: function () {
+ return '<table><tr valign="middle" ><td><div align="center" style="width:40px;height:40px;" >' +
+ '{[new XMLSerializer().serializeToString(Traccar.DeviceImages.getImageSvg(' +
+ 'Traccar.Style.mapColorOnline, false, 0, values.key))]}</div></td>' +
+ '<td>- {name}</td></tr></table>';
+ }
+ }
}]
}
});
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index a0e28671..103d62ed 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -71,7 +71,7 @@ Ext.define('Traccar.view.MapController', {
this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile());
},
- showReports: function() {
+ showReports: function () {
Traccar.app.showReports(true);
},
@@ -290,7 +290,7 @@ Ext.define('Traccar.view.MapController', {
color: Traccar.Style.mapTextStrokeColor,
width: Traccar.Style.mapTextStrokeWidth
}),
- offsetY: - image.getSize()[1] / 2 - Traccar.Style.mapTextOffset,
+ offsetY: -image.getSize()[1] / 2 - Traccar.Style.mapTextOffset,
font : Traccar.Style.mapTextFont
})
});
@@ -305,7 +305,7 @@ Ext.define('Traccar.view.MapController', {
if (deviceId !== undefined) {
index = deviceId % Traccar.Style.mapRouteColor.length;
}
- return this.getMarkerStyle(false, Traccar.Style.mapRouteColor[index], angle, 'route');
+ return this.getMarkerStyle(false, Traccar.Style.mapRouteColor[index], angle, 'arrow');
},
resizeMarker: function (style, zoom) {
@@ -315,13 +315,13 @@ Ext.define('Traccar.view.MapController', {
style.getImage().angle,
style.getImage().category);
text = style.getText();
- text.setOffsetY(- image.getSize()[1] / 2 - Traccar.Style.mapTextOffset);
- return newStyle = new ol.style.Style({
+ text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset);
+ return new ol.style.Style({
image: image,
text: text
});
},
-
+
rotateMarker: function (style, angle) {
var newStyle = new ol.style.Style({
image: Traccar.DeviceImages.getImageIcon(style.getImage().fill,
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 67fcf121..50eabaea 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -41,7 +41,7 @@ Ext.define('Traccar.view.ReportController', {
}
},
- hideReports: function() {
+ hideReports: function () {
Traccar.app.showReports(false);
},