diff options
Diffstat (limited to 'web/app/view/GeofenceMapController.js')
-rw-r--r-- | web/app/view/GeofenceMapController.js | 13 |
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()); } }); |