Add optional uninstall function to tools

This commit is contained in:
Quincy Morgan
2019-03-25 13:48:59 -04:00
parent daaab30d13
commit f8b8739855
2 changed files with 16 additions and 0 deletions
+11
View File
@@ -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;
}
+5
View File
@@ -51,6 +51,11 @@ export function uiTopToolbar(context) {
});
toolbarItems.exit()
.each(function(d) {
if (d.uninstall) {
d.uninstall();
}
})
.remove();
var itemsEnter = toolbarItems