Add nogo button to routing bar

This commit is contained in:
Norbert Renner 2018-06-27 09:17:45 +02:00
parent 512c0cc712
commit ce32c0da71
2 changed files with 9 additions and 6 deletions

View file

@ -45,7 +45,7 @@ BR.NogoAreas = L.Control.extend({
featuresLayer: this.drawnItems
});
var button = L.easyButton({
this.button = L.easyButton({
states: [{
stateName: BR.NogoAreas.STATE_CREATE,
icon: 'fa-ban',
@ -66,10 +66,10 @@ BR.NogoAreas = L.Control.extend({
control.state('no-go-create');
}
}]
}).addTo(map);
});
this.editTools.on('editable:drawing:end', function (e) {
button.state(BR.NogoAreas.STATE_CREATE);
self.button.state(BR.NogoAreas.STATE_CREATE);
setTimeout(L.bind(function () {
// turn editing off after create; async to still fire 'editable:vertex:dragend'
@ -88,7 +88,7 @@ BR.NogoAreas = L.Control.extend({
e.layer.setStyle(this.style);
}, this);
this.tooltip = new BR.EditingTooltip(map, editTools, button);
this.tooltip = new BR.EditingTooltip(map, editTools, this.button);
this.tooltip.enable();
// dummy, no own representation, delegating to EasyButton
@ -148,6 +148,10 @@ BR.NogoAreas = L.Control.extend({
getEditGroup: function() {
return this.editTools.editLayer;
},
getButton: function() {
return this.button;
}
});