-
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(behavior): add click focus element(node/combo) (#5595)
* feat(behavior): add click focus element --------- Co-authored-by: wb-xcf804241 <[email protected]>
- Loading branch information
1 parent
f5ec528
commit 72c5e74
Showing
26 changed files
with
2,171 additions
and
238 deletions.
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,32 @@ | ||
import { Graph } from '@/src'; | ||
import type { STDTestCase } from '../types'; | ||
|
||
export const behaviorFocusElement: STDTestCase = async (context) => { | ||
const graph = new Graph({ | ||
...context, | ||
data: { | ||
nodes: [ | ||
{ id: 'node-1', style: { x: 100, y: 100 } }, | ||
{ id: 'node-2', style: { x: 200, y: 100, parentId: 'combo-1' } }, | ||
{ id: 'node-3', style: { x: 100, y: 200 } }, | ||
{ id: 'node-4', style: { x: 200, y: 200, parentId: 'combo-1' } }, | ||
], | ||
edges: [ | ||
{ source: 'node-1', target: 'node-2' }, | ||
{ source: 'node-2', target: 'node-4' }, | ||
{ source: 'node-1', target: 'node-3' }, | ||
{ source: 'node-3', target: 'node-4' }, | ||
], | ||
combos: [{ id: 'combo-1' }], | ||
}, | ||
node: { style: { size: 20 } }, | ||
edge: { | ||
style: { endArrow: true }, | ||
}, | ||
behaviors: [{ type: 'focus-element' }], | ||
}); | ||
|
||
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
307 changes: 307 additions & 0 deletions
307
packages/g6/__tests__/snapshots/behaviors/behavior-focus-element/default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.