]> Repositorios git - classgraph.git/commitdiff
Disable cytoscape node grabbing so taps fire reliably
authorJavier Sagredo <[email protected]>
Wed, 6 May 2026 23:53:17 +0000 (01:53 +0200)
committerJavier Sagredo <[email protected]>
Wed, 6 May 2026 23:53:17 +0000 (01:53 +0200)
By default cytoscape lets the user drag nodes around. The drag
detector kicks in if the pointer moves more than a few pixels
between mousedown and mouseup, and when that happens cytoscape
suppresses the corresponding 'tap' event — which is what our
hand-rolled double-click handler listens to. So a slightly-jittery
double-click on a class node looked like the node was being dragged
without ever drilling into the instance view.

Set autoungrabify: true at init. Dagre re-runs the layout every time
loadGraph is invoked, so user repositioning of individual nodes was
already throwaway — disabling grabbing is a clean improvement on
both axes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
data/viewer.js

index e97247975f3fae72a40b91a83f98bfc26dc1609a..4208694bd4e04e8d0d9d0d1976177801b1e25a7e 100644 (file)
     container: document.getElementById('cy'),
     elements: [],
     style: cyStyles(),
+    // Disable per-node grabbing. Without this, cytoscape interprets a
+    // click that moves even a couple of pixels between mousedown and
+    // mouseup as a drag — and `tap` never fires, so our double-click
+    // detector misses it (the user sees the node "drift" instead of
+    // drilling in). dagre re-runs the layout after every loadGraph
+    // anyway, so dragging individual nodes only ever produced
+    // throwaway repositioning.
+    autoungrabify: true,
   });
 
   // ---------------------------------------------------------------------------