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 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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__/demo/case/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export * from './layout-radial-prevent-overlap-unstrict';
export * from './layout-radial-sort';
export * from './plugin-contextmenu';
export * from './plugin-grid-line';
export * from './plugin-minimap';
export * from './plugin-toolbar-build-in';
export * from './plugin-toolbar-iconfont';
export * from './plugin-tooltip';
Expand Down
21 changes: 21 additions & 0 deletions packages/g6/__tests__/demo/case/plugin-minimap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Graph, register } from '@/src';
import data from '@@/dataset/cluster.json';
import { Minimap } from '../../../src/plugins';
import type { STDTestCase } from '../types';

export const pluginMinimap: STDTestCase = 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 = () => [];
5 changes: 3 additions & 2 deletions packages/g6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@
"@antv/g-plugin-dragndrop": "^1.8.22",
"@antv/graphlib": "^2.0.2",
"@antv/hierarchy": "latest",
"@antv/layout": "^1.2.14-beta.1",
"@antv/util": "^3.3.7"
"@antv/util": "^3.3.7",
"moveable": "^0.53.0",
"@antv/layout": "^1.2.14-beta.1"
},
"devDependencies": {
"@antv/g-plugin-3d": "^1.9.34",
Expand Down
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
@@ -1,13 +1,15 @@
export { BasePlugin } from './base-plugin';
export { Contextmenu } from './contextmenu';
export { GridLine } from './grid-line';
export { Minimap } from './minimap';
export { Toolbar } from './toolbar';
export { Tooltip } from './tooltip';
export { Watermark } from './watermark';

export type { BasePluginOptions } from './base-plugin';
export type { ContextmenuOptions } from './contextmenu';
export type { GridLineOptions } from './grid-line';
export type { MinimapOptions } from './minimap';
export type { ToolbarOptions } from './toolbar';
export type { TooltipOptions } from './tooltip';
export type { WatermarkOptions } from './watermark';