-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scroll-canvas behavior (#5606)
* feat: add scroll-canvas behavior --------- Co-authored-by: liujiangyu <[email protected]>
- Loading branch information
1 parent
acf90c1
commit d4891f7
Showing
9 changed files
with
3,332 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.