You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2017/07/01 01:39:51 UTC

qpid-dispatch git commit: DISPATCH-792 Fix freezing/unfreezing nodes and moving nodes on top of each other

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master b5acca6df -> a5bb8051b


DISPATCH-792 Fix freezing/unfreezing nodes and moving nodes on top of each other


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/a5bb8051
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/a5bb8051
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/a5bb8051

Branch: refs/heads/master
Commit: a5bb8051b96da65832c58311841f28835afd71e6
Parents: b5acca6
Author: Ernest Allen <ea...@redhat.com>
Authored: Fri Jun 30 21:39:38 2017 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Fri Jun 30 21:39:38 2017 -0400

----------------------------------------------------------------------
 .../src/main/webapp/plugin/js/qdrTopology.js    | 24 +++++++++++---------
 console/stand-alone/plugin/js/qdrTopology.js    | 12 ++++++----
 2 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a5bb8051/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
index e5ce187..643f518 100644
--- a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
+++ b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
@@ -857,8 +857,8 @@ QDR.log.debug("attr.description " + attr.description)
             if (d3.select('#svg_context_menu').style('display') !== 'block')
               $(document).click();
             d3.select('#svg_context_menu')
-              .style('left', (mouseX + $(document).scrollLeft()) + "px")
-              .style('top', (mouseY + $(document).scrollTop()) + "px")
+              .style('left', (mouseX -1 + $(document).scrollLeft()) + "px")
+              .style('top', (mouseY -1 + $(document).scrollTop()) + "px")
               .style('display', 'block');
           })
           .on('click', function(d) {
@@ -1149,9 +1149,11 @@ QDR.log.debug("attr.description " + attr.description)
 
           var deltaX = dtx - dsx,
             deltaY = dty - dsy,
-            dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY),
-            normX = deltaX / dist,
-            normY = deltaY / dist;
+            dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+          if (dist == 0)
+            dist = 0.001;
+          var normX = deltaX / dist,
+              normY = deltaY / dist;
           var sourceX = dsx + (sourcePadding * normX),
             sourceY = dsy + (sourcePadding * normY),
             targetX = dtx - (targetPadding * normX),
@@ -1385,8 +1387,8 @@ QDR.log.debug("attr.description " + attr.description)
 
             mousedown_link = d;
             d3.select('#link_context_menu')
-              .style('left', (mouseX + $(document).scrollLeft()) + "px")
-              .style('top', (mouseY + $(document).scrollTop()) + "px")
+              .style('left', (mouseX -1 + $(document).scrollLeft()) + "px")
+              .style('top', (mouseY -1 + $(document).scrollTop()) + "px")
               .style('display', 'block');
           })
           // left click a path
@@ -1580,7 +1582,7 @@ QDR.log.debug("attr.description " + attr.description)
               d3.select(this).attr('transform', 'scale(1.1)');
               return;
             }
-            if (!selected_node) {
+            if (!selected_node && !mousedown_node) {
               if (d.nodeType === 'inter-router') {
                 //QDR.log.debug("showing general form");
                 updateForm(d.key, 'router', 0);
@@ -1597,7 +1599,7 @@ QDR.log.debug("attr.description " + attr.description)
             // enlarge target node
             d3.select(this).attr('transform', 'scale(1.1)');
             // highlight the next-hop route from the selected node to this node
-            mousedown_node = null;
+            //mousedown_node = null;
 
             if (!selected_node) {
               return;
@@ -1695,8 +1697,8 @@ QDR.log.debug("attr.description " + attr.description)
             d3.event.preventDefault();
             $timeout(function () {$scope.contextNode = d})
             d3.select('#node_context_menu')
-              .style('left', (mouseX + $(document).scrollLeft()) + "px")
-              .style('top', (mouseY + $(document).scrollTop()) + "px")
+              .style('left', (mouseX -1 + $(document).scrollLeft()) + "px")
+              .style('top', (mouseY -1 + $(document).scrollTop()) + "px")
               .style('display', 'block');
           })
           .on("click", function(d) {  // circle

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a5bb8051/console/stand-alone/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js
index 8d48306..a3368b4 100644
--- a/console/stand-alone/plugin/js/qdrTopology.js
+++ b/console/stand-alone/plugin/js/qdrTopology.js
@@ -1159,9 +1159,11 @@ var QDR = (function(QDR) {
 
           var deltaX = dtx - dsx,
             deltaY = dty - dsy,
-            dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY),
-            normX = deltaX / dist,
-            normY = deltaY / dist;
+            dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+          if (dist == 0)
+            dist = 0.001;
+          var normX = deltaX / dist,
+              normY = deltaY / dist;
           var sourceX = dsx + (sourcePadding * normX),
             sourceY = dsy + (sourcePadding * normY),
             targetX = dtx - (targetPadding * normX),
@@ -1591,7 +1593,7 @@ var QDR = (function(QDR) {
               d3.select(this).attr('transform', 'scale(1.1)');
               return;
             }
-            if (!selected_node) {
+            if (!selected_node && !mousedown_node) {
               if (d.nodeType === 'inter-router') {
                 //QDR.log.debug("showing general form");
                 updateForm(d.key, 'router', 0);
@@ -1608,7 +1610,7 @@ var QDR = (function(QDR) {
             // enlarge target node
             d3.select(this).attr('transform', 'scale(1.1)');
             // highlight the next-hop route from the selected node to this node
-            mousedown_node = null;
+            //mousedown_node = null;
 
             if (!selected_node) {
               return;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org