Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): minimap #5603

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"repository": "https://github.com/antvis/G6.git",
"scripts": {
"dev": "pnpm --stream --filter=@antv/g6 run dev ",
"site": "pnpm -r --stream --filter=./packages/site run dev",
"watch": "pnpm -r --stream --filter=!./site run start",
"postinstall": "husky install",
Expand Down
1 change: 1 addition & 0 deletions packages/g6/__tests__/demos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export * from './plugin-camera-setting';
export * from './plugin-contextmenu';
export * from './plugin-grid-line';
export * from './plugin-legend';
export * from './plugin-minimap';
export * from './plugin-toolbar-build-in';
export * from './plugin-toolbar-iconfont';
export * from './plugin-tooltip';
Expand Down
20 changes: 20 additions & 0 deletions packages/g6/__tests__/demos/plugin-minimap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Graph, register } from '@/src';
import data from '@@/dataset/cluster.json';
import { Minimap } from '../../src/plugins';

export const pluginMinimap: TestCase = async (context) => {
const graph = new Graph({
...context,
autoResize: true,
data,
layout: { type: 'd3force' },
behaviors: ['drag-canvas'],
plugins: [{ type: 'minimap', mode: 'delegate' }],
});
register('plugin', 'minimap', Minimap);

await graph.render();
return graph;
};

pluginMinimap.form = () => [];
9 changes: 9 additions & 0 deletions packages/g6/src/elements/edges/base-edge.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
BaseStyleProps,
DisplayObject,
DisplayObjectConfig,
Group,
ImageStyleProps,
Expand Down Expand Up @@ -238,6 +239,14 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {

return result;
}

/**
* Get the key shape for the node.
* @returns Key shape.
*/
public getKey(): DisplayObject {
return this.shapeMap.key;
}
}

type SymbolName = 'triangle' | 'circle' | 'diamond' | 'vee' | 'rect' | 'triangleRect' | 'simple';
Expand Down
2 changes: 2 additions & 0 deletions packages/g6/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { CameraSetting } from './camera-setting';
export { Contextmenu } from './contextmenu';
export { GridLine } from './grid-line';
export { Legend } from './legend';
export { Minimap } from './minimap';
export { Toolbar } from './toolbar';
export { Tooltip } from './tooltip';
export { Watermark } from './watermark';
Expand All @@ -12,6 +13,7 @@ export type { CameraSettingOptions } from './camera-setting';
export type { ContextmenuOptions } from './contextmenu';
export type { GridLineOptions } from './grid-line';
export type { LegendOptions } from './legend';
export type { MinimapOptions } from './minimap';
export type { ToolbarOptions } from './toolbar';
export type { TooltipOptions } from './tooltip';
export type { WatermarkOptions } from './watermark';
Loading
Loading