aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/map/GeofenceMap.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/web/app/view/map/GeofenceMap.js b/web/app/view/map/GeofenceMap.js
index 18c33862..347b1a9f 100644
--- a/web/app/view/map/GeofenceMap.js
+++ b/web/app/view/map/GeofenceMap.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -79,16 +79,21 @@ Ext.define('Traccar.view.map.GeofenceMap', {
},
initMap: function () {
- var map, featureOverlay, geometry, fillColor;
+ var map, mapView, featureOverlay, geometry, fillColor;
this.callParent();
map = this.map;
+ mapView = this.mapView;
this.features = new ol.Collection();
if (this.area) {
- geometry = Traccar.GeofenceConverter.wktToGeometry(this.mapView, this.area);
+ geometry = Traccar.GeofenceConverter.wktToGeometry(mapView, this.area);
this.features.push(new ol.Feature(geometry));
- this.mapView.fit(geometry);
+ this.map.once('postrender', function (event) {
+ mapView.fit(geometry, {
+ padding: [20, 20, 20, 20]
+ });
+ });
} else {
this.controller.fireEvent('mapstaterequest');
}