From: Javier Sagredo Date: Wed, 6 May 2026 23:53:17 +0000 (+0200) Subject: Disable cytoscape node grabbing so taps fire reliably X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=42bdd3fcca89d8f06dd5547078a52c027fa9c54b;p=classgraph.git Disable cytoscape node grabbing so taps fire reliably 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) --- diff --git a/data/viewer.js b/data/viewer.js index e972479..4208694 100644 --- a/data/viewer.js +++ b/data/viewer.js @@ -73,6 +73,14 @@ 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, }); // ---------------------------------------------------------------------------