You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2014/12/11 19:41:06 UTC

[04/25] incubator-nifi git commit: NIFI-146: - Using shift instead of ctrl to drive group selection. - Added support for metaKey for keyboard shortcuts.

NIFI-146:
- Using shift instead of ctrl to drive group selection.
- Added support for metaKey for keyboard shortcuts.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/61c5cb37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/61c5cb37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/61c5cb37

Branch: refs/heads/bootstrap
Commit: 61c5cb377370e7d5265cce405b42adeafecb1018
Parents: 457787c
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Dec 9 15:18:52 2014 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Dec 9 15:18:52 2014 -0500

----------------------------------------------------------------------
 .../src/main/webapp/js/nf/canvas/nf-canvas.js   | 66 ++++++++++----------
 .../main/webapp/js/nf/canvas/nf-connectable.js  |  8 +--
 .../main/webapp/js/nf/canvas/nf-selectable.js   |  6 +-
 3 files changed, 40 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/61c5cb37/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
----------------------------------------------------------------------
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 2aa274f..3b71088 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
@@ -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);
-
-                // prevent further propagation (to parents)
-                d3.event.stopPropagation();
-            }
-        })
+                    // 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();
+                    }
+                })
                 .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();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/61c5cb37/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js
index 42c175d..31370b8 100644
--- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js
+++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js
@@ -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 () {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/61c5cb37/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-selectable.js
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-selectable.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-selectable.js
index 8ad3154..47ac477 100644
--- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-selectable.js
+++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-selectable.js
@@ -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);
                 }
             }