Skip to content

Commit

Permalink
feat(behavior): add click focus element(node/combo) (#5595)
Browse files Browse the repository at this point in the history
* feat(behavior): add click focus element

---------

Co-authored-by: wb-xcf804241 <[email protected]>
  • Loading branch information
ai-qing-hai and wb-xcf804241 authored Mar 28, 2024
1 parent f5ec528 commit 72c5e74
Show file tree
Hide file tree
Showing 26 changed files with 2,171 additions and 238 deletions.
32 changes: 32 additions & 0 deletions packages/g6/__tests__/demo/case/behavior-focus-element.ts
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;
};
1 change: 1 addition & 0 deletions packages/g6/__tests__/demo/case/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './behavior-drag-canvas';
export * from './behavior-drag-element';
export * from './behavior-focus-element';
export * from './behavior-hover-element';
export * from './behavior-zoom-canvas';
export * from './combo';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 72c5e74

Please sign in to comment.