Skip to content

Commit

Permalink
feat: add scroll-canvas behavior (#5606)
Browse files Browse the repository at this point in the history
* feat: add scroll-canvas behavior

---------

Co-authored-by: liujiangyu <[email protected]>
  • Loading branch information
k644606347 and liujiangyu authored Apr 28, 2024
1 parent acf90c1 commit d4891f7
Show file tree
Hide file tree
Showing 9 changed files with 3,332 additions and 1 deletion.
35 changes: 35 additions & 0 deletions packages/g6/__tests__/demos/behavior-scroll-canvas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Graph } from '@/src';
import data from '@@/dataset/cluster.json';

export const behaviorScrollCanvas: TestCase = async (context) => {
const graph = new Graph({
...context,
data,
layout: {
type: 'd3force',
},
node: {
style: {
size: 20,
},
},
behaviors: [
{
type: 'scroll-canvas',
// direction: 'x',
// direction: 'y',
// sensitivity: 5,
// trigger: {
// up: ['ArrowUp'],
// down: ['ArrowDown'],
// right: ['ArrowRight'],
// left: ['ArrowLeft'],
// },
},
],
});

await graph.render();

return graph;
};
1 change: 1 addition & 0 deletions packages/g6/__tests__/demos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './behavior-drag-element';
export * from './behavior-focus-element';
export * from './behavior-hover-element';
export * from './behavior-lasso-select';
export * from './behavior-scroll-canvas';
export * from './behavior-zoom-canvas';
export * from './combo';
export * from './combo-expand-collapse';
Expand Down
Loading

0 comments on commit d4891f7

Please sign in to comment.