Skip to content

Commit e77bcff

Browse files
committed
Update demo with example of cluster dragging as a unit
1 parent e0ff40f commit e77bcff

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

demo.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
{ data: { source: 'h', target: 'i' } },
8787

8888
{ data: { id: 'j' } },
89+
90+
{ data: { id: 'k' } },
91+
{ data: { id: 'm' } },
92+
{ data: { id: 'n' } },
93+
{ data: { source: 'k', target: 'm' } },
94+
{ data: { source: 'k', target: 'n' } },
95+
{ data: { source: 'm', target: 'n' } },
8996
]
9097
});
9198

@@ -159,7 +166,6 @@
159166
when: 'matching'
160167
});
161168

162-
163169
// g kept in viewport
164170

165171
cy.$('#g').position({ x: 400, y: 350 });
@@ -194,6 +200,20 @@
194200
});
195201

196202

203+
// k, m, n all move together on drag as a unit (e.g. cluster)
204+
205+
cy.$('#k').position({ x: 430, y: -20 });
206+
cy.$('#m').position({ x: 490, y: -110 });
207+
cy.$('#n').position({ x: 550, y: -20 });
208+
209+
cy.automove({
210+
nodesMatching: cy.$('#k, #m, #n'),
211+
reposition: 'drag',
212+
dragWith: cy.$('#k, #m, #n')
213+
});
214+
215+
216+
197217
cy.fit( 100 ); // fit to all the layouts
198218

199219

0 commit comments

Comments
 (0)