aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GeofenceMapController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 20:03:23 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 20:03:23 +1200
commitebb43a1d910595462b384e3d1bd6375672da5b84 (patch)
treec0cb06b37f1c9d3fb2260e7bd259a9141a4118f9 /web/app/view/GeofenceMapController.js
parentdbb2e88db2c5af22172ea3642b27899b8164b40a (diff)
downloadtraccar-server-ebb43a1d910595462b384e3d1bd6375672da5b84.tar.gz
traccar-server-ebb43a1d910595462b384e3d1bd6375672da5b84.tar.bz2
traccar-server-ebb43a1d910595462b384e3d1bd6375672da5b84.zip
Implement geofence saving
Diffstat (limited to 'web/app/view/GeofenceMapController.js')
-rw-r--r--web/app/view/GeofenceMapController.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/web/app/view/GeofenceMapController.js b/web/app/view/GeofenceMapController.js
index d3915fd46..1d20ba966 100644
--- a/web/app/view/GeofenceMapController.js
+++ b/web/app/view/GeofenceMapController.js
@@ -19,10 +19,21 @@ Ext.define('Traccar.view.GeofenceMapController', {
alias: 'controller.geofenceMap',
onSaveClick: function (button) {
- button.up('window').close();
+ var feature, formatter;
+ if (this.getView().getFeatures().getLength() > 0) {
+ feature = this.getView().getFeatures().pop();
+ formatter = new ol.format.WKT();
+ this.fireEvent('saveArea', formatter.writeFeature(feature));
+ button.up('window').close();
+ }
},
onCancelClick: function (button) {
button.up('window').close();
+ },
+
+ onTypeSelect: function (combo) {
+ this.getView().removeInteraction();
+ this.getView().addInteraction(combo.getValue());
}
});