Cancel throttled hover events when exiting hover modes

possibly related to #2736, as a source of "Uncaught Error Entity xxxx not found" errors
This commit is contained in:
Bryan Housel
2015-12-22 16:23:18 -05:00
parent 226b73fd48
commit 902c122383
4 changed files with 8 additions and 4 deletions
+1
View File
@@ -116,6 +116,7 @@ iD.behavior.Draw = function(context) {
}
draw.off = function(selection) {
context.ui().sidebar.hover.cancel();
context.uninstall(hover);
context.uninstall(edit);
+1
View File
@@ -32,6 +32,7 @@ iD.modes.Browse = function(context) {
};
mode.exit = function() {
context.ui().sidebar.hover.cancel();
behaviors.forEach(function(behavior) {
context.uninstall(behavior);
});
+1
View File
@@ -186,6 +186,7 @@ iD.modes.DragNode = function(context) {
};
mode.exit = function() {
context.ui().sidebar.hover.cancel();
context.uninstall(hover);
context.uninstall(edit);
+5 -4
View File
@@ -12,8 +12,8 @@ iD.ui.Sidebar = function(context) {
var inspectorWrap = selection.append('div')
.attr('class', 'inspector-hidden inspector-wrap fr');
sidebar.hover = function(id) {
if (!current && id) {
function hover(id) {
if (!current && context.hasEntity(id)) {
featureListWrap.classed('inspector-hidden', true);
inspectorWrap.classed('inspector-hidden', false)
.classed('inspector-hover', true);
@@ -30,9 +30,9 @@ iD.ui.Sidebar = function(context) {
inspectorWrap.classed('inspector-hidden', true);
inspector.state('hide');
}
};
}
sidebar.hover = _.throttle(sidebar.hover, 200);
sidebar.hover = _.throttle(hover, 200);
sidebar.select = function(id, newFeature) {
if (!current && id) {
@@ -73,6 +73,7 @@ iD.ui.Sidebar = function(context) {
}
sidebar.hover = function() {};
sidebar.hover.cancel = function() {};
sidebar.select = function() {};
sidebar.show = function() {};
sidebar.hide = function() {};