mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Add optional uninstall function to tools
This commit is contained in:
@@ -127,5 +127,16 @@ export function uiToolNotes(context) {
|
||||
}
|
||||
};
|
||||
|
||||
tool.uninstall = function() {
|
||||
context
|
||||
.on('enter.editor.notes', null)
|
||||
.on('exit.editor.notes', null)
|
||||
.on('enter.notes', null);
|
||||
|
||||
context.map()
|
||||
.on('move.notes', null)
|
||||
.on('drawn.notes', null);
|
||||
};
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ export function uiTopToolbar(context) {
|
||||
});
|
||||
|
||||
toolbarItems.exit()
|
||||
.each(function(d) {
|
||||
if (d.uninstall) {
|
||||
d.uninstall();
|
||||
}
|
||||
})
|
||||
.remove();
|
||||
|
||||
var itemsEnter = toolbarItems
|
||||
|
||||
Reference in New Issue
Block a user