aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/Map.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/Map.js')
-rw-r--r--web/app/view/Map.js41
1 files changed, 39 insertions, 2 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index 9a032e79f..7d81699a3 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -27,9 +27,21 @@ Ext.define('Traccar.view.Map', {
title: Strings.mapTitle,
layout: 'fit',
+ getMap: function () {
+ return this.map;
+ },
+
+ getMapView: function () {
+ return this.mapView;
+ },
+
+ getVectorSource: function () {
+ return this.vectorSource;
+ },
+
listeners: {
afterrender: function () {
- var user, server, layer, type, bingKey, vectorLayer, lat, lon, zoom;
+ var user, server, layer, type, bingKey, vectorLayer, lat, lon, zoom, target;
user = Traccar.app.getUser();
server = Traccar.app.getServer();
@@ -40,7 +52,10 @@ Ext.define('Traccar.view.Map', {
if (type === 'custom') {
layer = new ol.layer.Tile({
source: new ol.source.XYZ({
- url: server.get('mapUrl')
+ url: server.get('mapUrl'),
+ attributions: [new ol.Attribution({
+ html: ''
+ })]
})
});
} else if (type === 'bingRoad') {
@@ -83,6 +98,28 @@ Ext.define('Traccar.view.Map', {
layers: [layer, vectorLayer],
view: this.mapView
});
+
+ target = this.map.getTarget();
+ if (typeof target === 'string') {
+ target = Ext.get(target).dom;
+ }
+
+ this.map.on('pointermove', function (e) {
+ var hit = this.forEachFeatureAtPixel(e.pixel, function (feature, layer) {
+ return true;
+ });
+ if (hit) {
+ target.style.cursor = 'pointer';
+ } else {
+ target.style.cursor = '';
+ }
+ });
+
+ this.map.on('click', function (e) {
+ this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) {
+ this.fireEvent('selectFeature', feature);
+ }, this);
+ }, this);
},
resize: function () {