Skip to content

Commit fd203ef

Browse files
committed
Merge pull request jacomyal#499 from qinfchen/one_node
fix drag node issue where there is only one node exists in the graph
2 parents bba80f8 + 0a802dc commit fd203ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/sigma.plugins.dragNodes/sigma.plugins.dragNodes.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@
149149
function nodeMouseDown(event) {
150150
_isMouseDown = true;
151151
var size = _s.graph.nodes().length;
152-
if (_node && size > 0) {
152+
153+
// when there is only node in the graph, the plugin cannot apply
154+
// linear interpolation. So treat it as if a user is dragging
155+
// the graph
156+
if (_node && size > 1) {
153157
_mouse.removeEventListener('mousedown', nodeMouseDown);
154158
_body.addEventListener('mousemove', nodeMouseMove);
155159
_body.addEventListener('mouseup', nodeMouseUp);

0 commit comments

Comments
 (0)