aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/map/GeofenceMap.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/map/GeofenceMap.js')
-rw-r--r--web/app/view/map/GeofenceMap.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/web/app/view/map/GeofenceMap.js b/web/app/view/map/GeofenceMap.js
index 37d3be74..6b06ae98 100644
--- a/web/app/view/map/GeofenceMap.js
+++ b/web/app/view/map/GeofenceMap.js
@@ -65,14 +65,12 @@ Ext.define('Traccar.view.map.GeofenceMap', {
map = this.map;
this.features = new ol.Collection();
- if (this.area !== '') {
+ if (this.area) {
geometry = Traccar.GeofenceConverter.wktToGeometry(this.mapView, this.area);
this.features.push(new ol.Feature(geometry));
- if (geometry instanceof ol.geom.Circle) {
- this.mapView.setCenter(geometry.getCenter());
- } else if (geometry instanceof ol.geom.Polygon) {
- this.mapView.setCenter(geometry.getCoordinates()[0][0]);
- }
+ this.mapView.fit(geometry);
+ } else {
+ this.controller.fireEvent('mapstaterequest');
}
fillColor = ol.color.asArray(Traccar.Style.mapGeofenceColor);
fillColor[3] = Traccar.Style.mapGeofenceOverlayOpacity;