aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-04 16:55:40 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-04 16:55:40 +0500
commitdc8db55c8a74d26644d9dc449b4f35c76a2e031f (patch)
treead14c8fb44052b6e9c1fbeafcfb215995dfa7a69 /web
parent6e36522ed8aa7b4d1f6b4a7ac3fabb08de2d0387 (diff)
downloadtraccar-server-dc8db55c8a74d26644d9dc449b4f35c76a2e031f.tar.gz
traccar-server-dc8db55c8a74d26644d9dc449b4f35c76a2e031f.tar.bz2
traccar-server-dc8db55c8a74d26644d9dc449b4f35c76a2e031f.zip
Center view to editing geofence
Diffstat (limited to 'web')
-rw-r--r--web/app/view/GeofenceMap.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js
index 70584f41d..165daf40d 100644
--- a/web/app/view/GeofenceMap.js
+++ b/web/app/view/GeofenceMap.js
@@ -51,14 +51,20 @@ Ext.define('Traccar.view.GeofenceMap', {
},
initMap: function () {
- var map, featureOverlay;
+ var map, featureOverlay, geometry;
this.callParent();
map = this.map;
this.features = new ol.Collection();
if (this.area !== "") {
- this.features.push(new ol.Feature(Traccar.GeofenceConverter.wktToGeometry(this.mapView, 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]);
+ }
}
featureOverlay = new ol.layer.Vector({
source: new ol.source.Vector({