qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eal...@apache.org
Subject qpid-dispatch git commit: DISPATCH-1169 Avoid popup appearing after mouseout event
Date Tue, 11 Dec 2018 17:54:39 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master ff60b36af -> 716214b2d


DISPATCH-1169 Avoid popup appearing after mouseout event


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

Branch: refs/heads/master
Commit: 716214b2dd5ebf9467414af2c881269c798a9c0f
Parents: ff60b36
Author: Ernest Allen <eallen@redhat.com>
Authored: Tue Dec 11 12:54:25 2018 -0500
Committer: Ernest Allen <eallen@redhat.com>
Committed: Tue Dec 11 12:54:25 2018 -0500

----------------------------------------------------------------------
 .../plugin/js/topology/qdrTopology.js           | 38 ++++++++++++++------
 1 file changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/716214b2/console/stand-alone/plugin/js/topology/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/qdrTopology.js b/console/stand-alone/plugin/js/topology/qdrTopology.js
index 4ada081..f7dccc9 100644
--- a/console/stand-alone/plugin/js/topology/qdrTopology.js
+++ b/console/stand-alone/plugin/js/topology/qdrTopology.js
@@ -484,6 +484,19 @@ export class TopologyController {
       forceData.links.clearHighlighted();
       forceData.nodes.clearHighlighted();
     }
+
+    let popupCancelled = true;
+    function handleMouseOutPath(d) {
+      // mouse out of a path
+      popupCancelled = true;
+      QDRService.management.topology.delUpdatedAction(
+        "connectionPopupHTML"
+      );
+      d3.select("#popover-div").style("display", "none");
+      d.selected = false;
+      connectionPopupHTML();
+    }
+
     // Takes the forceData.nodes and forceData.links array and creates svg elements
     // Also updates any existing svg elements based on the updated values in forceData.nodes
     // and forceData.links
@@ -535,6 +548,7 @@ export class TopologyController {
           // mouse over a path
           let event = d3.event;
           d.selected = true;
+          popupCancelled = false;
           let updateTooltip = function () {
             $timeout(function () {
               if (d.selected) {
@@ -545,9 +559,12 @@ export class TopologyController {
                   )
                 );
                 displayTooltip(event);
+              } else {
+                handleMouseOutPath(d);
               }
             });
           };
+
           // update the contents of the popup tooltip each time the data is polled
           QDRService.management.topology.addUpdatedAction(
             "connectionPopupHTML",
@@ -560,23 +577,14 @@ export class TopologyController {
               force: true
             }, {
               entity: "connection"
-            }],
-            function () {
-              updateTooltip();
-            }
+            }], updateTooltip
           );
           // just show the tooltip with whatever data we have
           updateTooltip();
           restart();
         })
         .on("mouseout", function (d) {
-          // mouse out of a path
-          QDRService.management.topology.delUpdatedAction(
-            "connectionPopupHTML"
-          );
-          d3.select("#popover-div").style("display", "none");
-          d.selected = false;
-          connectionPopupHTML();
+          handleMouseOutPath(d);
           restart();
         })
         // left click a path
@@ -640,6 +648,7 @@ export class TopologyController {
             "connectionPopupHTML"
           );
           let e = d3.event;
+          popupCancelled = false;
           d.toolTip(QDRService.management.topology).then(function (toolTip) {
             showToolTip(toolTip, e);
           });
@@ -669,6 +678,7 @@ export class TopologyController {
           $scope.current_node = null;
           // unenlarge target node
           d3.select("#popover-div").style("display", "none");
+          popupCancelled = true;
           d3.select(this).attr("transform", "");
           clearAllHighlights();
           mouseover_node = null;
@@ -816,14 +826,20 @@ export class TopologyController {
 
     function displayTooltip(event) {
       $timeout(function () {
+        if (popupCancelled) {
+          d3.select("#popover-div").style("display", "none");
+          return;
+        }
         let top = $("#topology").offset().top - 5;
         let width = $("#topology").width();
+        // hide popup while getting its width
         d3.select("#popover-div")
           .style("visibility", "hidden")
           .style("display", "block")
           .style("left", event.pageX + 5 + "px")
           .style("top", event.pageY - top + "px");
         let pwidth = $("#popover-div").width();
+        // show popup
         d3.select("#popover-div")
           .style("visibility", "visible")
           .style("left", Math.min(width - pwidth, event.pageX + 5) + "px")


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


Mime
View raw message