Skip to content

Commit

Permalink
refactor: minimap wont override specified container style (#6693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca authored Jan 3, 2025
1 parent 1cc8cf2 commit ea4bae0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/g6/src/plugins/utils/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,8 @@ interface Options {
* @returns <zh/> [容器, 画布] | <en/> [container, canvas]
*/
export function createPluginCanvas(options: Options): [HTMLElement, GCanvas] {
const { width, height, renderer, containerStyle } = options;
const { width, height, renderer } = options;
const $container = getContainer(options);
const [x, y] = computePosition(options);

Object.assign($container.style, {
position: 'absolute',
left: x + 'px',
top: y + 'px',
width: width + 'px',
height: height + 'px',
...containerStyle,
});

const canvas = new GCanvas({
width,
Expand All @@ -70,6 +60,19 @@ function getContainer(options: Options) {
}

const $container = createPluginContainer(className, false);

const { width, height, containerStyle } = options;
const [x, y] = computePosition(options);

Object.assign($container.style, {
position: 'absolute',
left: x + 'px',
top: y + 'px',
width: width + 'px',
height: height + 'px',
...containerStyle,
});

graphCanvas.getContainer()?.appendChild($container);
return $container;
}
Expand Down

0 comments on commit ea4bae0

Please sign in to comment.