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.
This commit is contained in:
Matt Gilman 2015-01-12 12:56:37 -05:00
parent 1da5339a2a
commit b6b1859475
1 changed files with 8 additions and 3 deletions

View File

@ -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();
}
})