From 1043402b8890de4feade1634b841a178a7d1cebd Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 1 Nov 2016 21:42:37 -0400 Subject: [PATCH] Don't call behavior.off unless behaviors were actually added --- modules/ui/fields/restrictions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ui/fields/restrictions.js b/modules/ui/fields/restrictions.js index 77a3da820..8a473d88f 100644 --- a/modules/ui/fields/restrictions.js +++ b/modules/ui/fields/restrictions.js @@ -43,6 +43,7 @@ export function uiFieldRestrictions(field, context) { var dispatch = d3.dispatch('change'), breathe = behaviorBreathe(context), hover = behaviorHover(context), + initialized = false, vertexID, fromNodeID; @@ -100,6 +101,7 @@ export function uiFieldRestrictions(field, context) { var surface = wrap.selectAll('.surface'); if (!enter.empty()) { + initialized = true; surface .call(breathe) .call(hover); @@ -222,6 +224,8 @@ export function uiFieldRestrictions(field, context) { restrictions.off = function(selection) { + if (!initialized) return; + selection.selectAll('.surface') .call(hover.off) .call(breathe.off)