aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-15 20:53:08 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-15 20:53:08 -0700
commiteda73a4305647e60ea3b06cd76cfa0a78dc0d3fd (patch)
treeff8e7a14b24720a29e9b60521633cf5f786abf39 /web/app
parentb7928f760ab557be29ade8c4b8e1605feed6fd7f (diff)
downloadetbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.tar.gz
etbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.tar.bz2
etbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.zip
Fit geofence on edit (fix #862)
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 18c3386..347b1a9 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');
}