diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-15 20:53:08 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-15 20:53:08 -0700 |
commit | eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd (patch) | |
tree | ff8e7a14b24720a29e9b60521633cf5f786abf39 | |
parent | b7928f760ab557be29ade8c4b8e1605feed6fd7f (diff) | |
download | etbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.tar.gz etbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.tar.bz2 etbsa-traccar-web-eda73a4305647e60ea3b06cd76cfa0a78dc0d3fd.zip |
Fit geofence on edit (fix #862)
-rw-r--r-- | web/app/view/map/GeofenceMap.js | 13 |
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'); } |