Add nogo button to routing bar
This commit is contained in:
parent
512c0cc712
commit
ce32c0da71
2 changed files with 9 additions and 6 deletions
|
|
@ -89,8 +89,6 @@
|
||||||
'Clear route'
|
'Clear route'
|
||||||
);
|
);
|
||||||
|
|
||||||
drawToolbar = L.easyBar([drawButton, deleteButton]).addTo(map);
|
|
||||||
|
|
||||||
function updateRoute(evt) {
|
function updateRoute(evt) {
|
||||||
router.setOptions(evt.options);
|
router.setOptions(evt.options);
|
||||||
|
|
||||||
|
|
@ -233,6 +231,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
nogos.addTo(map);
|
nogos.addTo(map);
|
||||||
|
drawToolbar = L.easyBar([drawButton, nogos.getButton(), deleteButton]).addTo(map);
|
||||||
nogos.preventRoutePointOnCreate(routing);
|
nogos.preventRoutePointOnCreate(routing);
|
||||||
|
|
||||||
map.addControl(new BR.OpacitySlider({
|
map.addControl(new BR.OpacitySlider({
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ BR.NogoAreas = L.Control.extend({
|
||||||
featuresLayer: this.drawnItems
|
featuresLayer: this.drawnItems
|
||||||
});
|
});
|
||||||
|
|
||||||
var button = L.easyButton({
|
this.button = L.easyButton({
|
||||||
states: [{
|
states: [{
|
||||||
stateName: BR.NogoAreas.STATE_CREATE,
|
stateName: BR.NogoAreas.STATE_CREATE,
|
||||||
icon: 'fa-ban',
|
icon: 'fa-ban',
|
||||||
|
|
@ -66,10 +66,10 @@ BR.NogoAreas = L.Control.extend({
|
||||||
control.state('no-go-create');
|
control.state('no-go-create');
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}).addTo(map);
|
});
|
||||||
|
|
||||||
this.editTools.on('editable:drawing:end', function (e) {
|
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 () {
|
setTimeout(L.bind(function () {
|
||||||
// turn editing off after create; async to still fire 'editable:vertex:dragend'
|
// 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);
|
e.layer.setStyle(this.style);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.tooltip = new BR.EditingTooltip(map, editTools, button);
|
this.tooltip = new BR.EditingTooltip(map, editTools, this.button);
|
||||||
this.tooltip.enable();
|
this.tooltip.enable();
|
||||||
|
|
||||||
// dummy, no own representation, delegating to EasyButton
|
// dummy, no own representation, delegating to EasyButton
|
||||||
|
|
@ -148,6 +148,10 @@ BR.NogoAreas = L.Control.extend({
|
||||||
|
|
||||||
getEditGroup: function() {
|
getEditGroup: function() {
|
||||||
return this.editTools.editLayer;
|
return this.editTools.editLayer;
|
||||||
|
},
|
||||||
|
|
||||||
|
getButton: function() {
|
||||||
|
return this.button;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue