mirror of https://github.com/apache/nifi.git
NIFI-146:
- Using shift instead of ctrl to drive group selection. - Added support for metaKey for keyboard shortcuts.
This commit is contained in:
parent
457787cde0
commit
61c5cb3773
|
@ -332,41 +332,41 @@ nf.Canvas = (function () {
|
|||
|
||||
// handle canvas events
|
||||
svg.on('mousedown.selection', function () {
|
||||
canvasClicked = true;
|
||||
canvasClicked = true;
|
||||
|
||||
if (d3.event.button !== 0) {
|
||||
// prevent further propagation (to parents and others handlers
|
||||
// on the same element to prevent zoom behavior)
|
||||
d3.event.stopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
if (d3.event.button !== 0) {
|
||||
// prevent further propagation (to parents and others handlers
|
||||
// on the same element to prevent zoom behavior)
|
||||
d3.event.stopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
// show selection box if control is held down
|
||||
if (d3.event.ctrlKey) {
|
||||
var position = d3.mouse(canvas.node());
|
||||
canvas.append('rect')
|
||||
.attr('rx', 6)
|
||||
.attr('ry', 6)
|
||||
.attr('x', position[0])
|
||||
.attr('y', position[1])
|
||||
.attr('class', 'selection')
|
||||
.attr('width', 0)
|
||||
.attr('height', 0)
|
||||
.attr('stroke-width', function () {
|
||||
return 1 / nf.Canvas.View.scale();
|
||||
})
|
||||
.attr('stroke-dasharray', function () {
|
||||
return 4 / nf.Canvas.View.scale();
|
||||
})
|
||||
.datum(position);
|
||||
// show selection box if shift is held down
|
||||
if (d3.event.shiftKey) {
|
||||
var position = d3.mouse(canvas.node());
|
||||
canvas.append('rect')
|
||||
.attr('rx', 6)
|
||||
.attr('ry', 6)
|
||||
.attr('x', position[0])
|
||||
.attr('y', position[1])
|
||||
.attr('class', 'selection')
|
||||
.attr('width', 0)
|
||||
.attr('height', 0)
|
||||
.attr('stroke-width', function () {
|
||||
return 1 / nf.Canvas.View.scale();
|
||||
})
|
||||
.attr('stroke-dasharray', function () {
|
||||
return 4 / nf.Canvas.View.scale();
|
||||
})
|
||||
.datum(position);
|
||||
|
||||
// prevent further propagation (to parents)
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
})
|
||||
// prevent further propagation (to parents)
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
})
|
||||
.on('mousemove.selection', function () {
|
||||
// update selection box if control is held down
|
||||
if (d3.event.ctrlKey) {
|
||||
// update selection box if shift is held down
|
||||
if (d3.event.shiftKey) {
|
||||
// get the selection box
|
||||
var selectionBox = d3.select('rect.selection');
|
||||
if (!selectionBox.empty()) {
|
||||
|
@ -492,7 +492,7 @@ nf.Canvas = (function () {
|
|||
return;
|
||||
}
|
||||
|
||||
if (evt.ctrlKey === true) {
|
||||
if (evt.ctrlKey || evt.metaKey) {
|
||||
if (evt.keyCode === 82) {
|
||||
// ctrl-r
|
||||
nf.Actions.reloadStatus();
|
||||
|
|
|
@ -160,7 +160,7 @@ nf.Connectable = (function () {
|
|||
activate: function (components) {
|
||||
components
|
||||
.on('mouseenter.connectable', function (d) {
|
||||
if (!d3.event.ctrlKey && d3.select('rect.drag-selection').empty()) {
|
||||
if (!d3.event.shiftKey && d3.select('rect.drag-selection').empty()) {
|
||||
var selection = d3.select(this);
|
||||
|
||||
// ensure the current component supports connection source
|
||||
|
@ -192,12 +192,12 @@ nf.Connectable = (function () {
|
|||
connector.remove();
|
||||
}
|
||||
})
|
||||
//Using mouseover/out to workaround chrom issue #122746
|
||||
// Using mouseover/out to workaround chrome issue #122746
|
||||
.on('mouseover.connectable', function () {
|
||||
//mark that we are hovering when appropriate
|
||||
// mark that we are hovering when appropriate
|
||||
var selection = d3.select(this);
|
||||
selection.classed('hover', function () {
|
||||
return !d3.event.ctrlKey && !selection.classed('hover') && d3.select('rect.drag-selection').empty();
|
||||
return !d3.event.shiftKey && !selection.classed('hover') && d3.select('rect.drag-selection').empty();
|
||||
});
|
||||
})
|
||||
.on('mouseout.connection', function () {
|
||||
|
|
|
@ -27,15 +27,15 @@ nf.Selectable = (function () {
|
|||
// only need to update selection if necessary
|
||||
if (!g.classed('selected')) {
|
||||
// since we're not appending, deselect everything else
|
||||
if (!d3.event.ctrlKey) {
|
||||
if (!d3.event.shiftKey) {
|
||||
d3.selectAll('g.selected').classed('selected', false);
|
||||
}
|
||||
|
||||
// update the selection
|
||||
g.classed('selected', true);
|
||||
} else {
|
||||
// we are currently selected, if control key the deselect
|
||||
if (d3.event.ctrlKey) {
|
||||
// we are currently selected, if shift key the deselect
|
||||
if (d3.event.shiftKey) {
|
||||
g.classed('selected', false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue