From b6b1859475eadc7d2802b2da29863878f77d54cd Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Mon, 12 Jan 2015 12:56:37 -0500 Subject: [PATCH] NIFI-247: - Preventing zoom/pan events which was throwing off the selection when the cursor left the canvas when using the selection box to select multiple components. - Preventing default browser behavior which was changing the cursor to text-selection when using the selection box to select multiple components. --- .../src/main/webapp/js/nf/canvas/nf-canvas.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index c367860b77..5c1cbb8faf 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -372,8 +372,12 @@ nf.Canvas = (function () { }) .datum(position); - // prevent further propagation (to parents) - d3.event.stopPropagation(); + // prevent further propagation (to parents and others handlers + // on the same element to prevent zoom behavior) + d3.event.stopImmediatePropagation(); + + // prevents the browser from changing to a text selection cursor + d3.event.preventDefault(); } }) .on('mousemove.selection', function () { @@ -385,7 +389,7 @@ nf.Canvas = (function () { // get the original position var originalPosition = selectionBox.datum(); var position = d3.mouse(canvas.node()); - + var d = {}; if (originalPosition[0] < position[0]) { d.x = originalPosition[0]; @@ -407,6 +411,7 @@ nf.Canvas = (function () { selectionBox.attr(d); } + // prevent further propagation (to parents) d3.event.stopPropagation(); } })