aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 15:30:35 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 15:30:35 +1200
commit6606ad80f189da772687c6092618b19a46f83394 (patch)
treedf80c72c28db27eed6a9d272a08c80347d1a3efd /web/app/view
parent79f8c34319053236ee03359b1ecf38e065206485 (diff)
downloadtraccar-server-6606ad80f189da772687c6092618b19a46f83394.tar.gz
traccar-server-6606ad80f189da772687c6092618b19a46f83394.tar.bz2
traccar-server-6606ad80f189da772687c6092618b19a46f83394.zip
Add toolbar to geozone editor
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/GeofenceMap.js78
-rw-r--r--web/app/view/GeofenceMapController.js10
2 files changed, 53 insertions, 35 deletions
diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js
index 8ec5ac224..2538a8b16 100644
--- a/web/app/view/GeofenceMap.js
+++ b/web/app/view/GeofenceMap.js
@@ -23,61 +23,71 @@ Ext.define('Traccar.view.GeofenceMap', {
],
controller: 'geofenceMap',
+ bodyBorder: true,
+
+ tbar: {
+ items: [{
+ xtype: 'combobox',
+ store: 'GeozoneTypes',
+ valueField: 'id',
+ displayField: 'name'
+ }, {
+ xtype: 'tbfill'
+ }, {
+ text: Strings.sharedSave,
+ handler: 'onSaveClick'
+ }, {
+ text: Strings.sharedCancel,
+ handler: 'onCancelClick'
+ }]
+ },
initMap: function () {
+ var map, featureOverlay;
this.callParent();
- var map = this.map;
+ map = this.map;
- var features = new ol.Collection();
- var featureOverlay = new ol.layer.Vector({
- source: new ol.source.Vector({features: features}),
+ this.features = new ol.Collection();
+ featureOverlay = new ol.layer.Vector({
+ source: new ol.source.Vector({
+ features: this.features
+ }),
style: new ol.style.Style({
fill: new ol.style.Fill({
- color: 'rgba(255, 255, 255, 0.2)'
+ color: Traccar.Style.mapColorOverlay
}),
stroke: new ol.style.Stroke({
- color: '#ffcc33',
- width: 2
+ color: Traccar.Style.mapColorReport,
+ width: Traccar.Style.mapRouteWidth
}),
image: new ol.style.Circle({
- radius: 7,
+ radius: Traccar.Style.mapRadiusNormal,
fill: new ol.style.Fill({
- color: '#ffcc33'
+ color: Traccar.Style.mapColorReport
})
})
})
});
featureOverlay.setMap(map);
- var modify = new ol.interaction.Modify({
- features: features,
- // the SHIFT key must be pressed to delete vertices, so
- // that new vertices can be drawn at the same position
- // of existing vertices
+ map.addInteraction(new ol.interaction.Modify({
+ features: this.features,
deleteCondition: function(event) {
- return ol.events.condition.shiftKeyOnly(event) &&
- ol.events.condition.singleClick(event);
+ return ol.events.condition.shiftKeyOnly(event) && ol.events.condition.singleClick(event);
}
- });
- map.addInteraction(modify);
-
- var draw; // global so we can remove it later
- //var typeSelect = document.getElementById('type');
+ }));
+ },
- function addInteraction() {
- draw = new ol.interaction.Draw({
- features: features,
- type: 'Polygon' // (typeSelect.value)
- });
- map.addInteraction(draw);
- }
-
- /*typeSelect.onchange = function() {
- map.removeInteraction(draw);
- addInteraction();
- };*/
+ addInteraction: function () {
+ this.draw = new ol.interaction.Draw({
+ features: this.features,
+ type: 'Polygon' // (typeSelect.value)
+ });
+ this.map.addInteraction(this.draw);
+ },
- addInteraction();
+ removeInteraction: function () {
+ this.map.removeInteraction(this.draw);
}
});
diff --git a/web/app/view/GeofenceMapController.js b/web/app/view/GeofenceMapController.js
index bc0fbfe1b..d3915fd46 100644
--- a/web/app/view/GeofenceMapController.js
+++ b/web/app/view/GeofenceMapController.js
@@ -16,5 +16,13 @@
Ext.define('Traccar.view.GeofenceMapController', {
extend: 'Ext.app.ViewController',
- alias: 'controller.geofenceMap'
+ alias: 'controller.geofenceMap',
+
+ onSaveClick: function (button) {
+ button.up('window').close();
+ },
+
+ onCancelClick: function (button) {
+ button.up('window').close();
+ }
});