G6
G6 copied to clipboard
fixCollapseSize is not respected when combo type is circle
Describe the bug
When you create a combo with type circle
the property fixCollapseSize
is not respected. If you change the type of the combo to rect
you can see the property fixCollapseSize
working.
Your Example Website or App
https://codesandbox.io/s/awesome-mahavira-kuk9g4?file=/src/App.vue
Steps to Reproduce the Bug or Issue
- Go to https://codesandbox.io/s/awesome-mahavira-kuk9g4?file=/src/App.vue
- Observe the combo default type is
rect
- Update the
fixCollapseSize
value from 5 -> 20 -> 50 - Observe the collapsed rect combo is growing in size
- Revert
fixCollapseSize
back to 5 - Change
type
tocircle
- Update the
fixCollapseSize
value from 5 -> 20 -> 50 - Observe the collapsed circle combo is NOT growing in size
Expected behavior
As a user, I expected the combo with type circle
to act the same as the combo type of rect
Screenshots or Videos
https://user-images.githubusercontent.com/16868336/179812220-ca2bbfcb-4ced-4643-9759-94e6ebf88153.mov
Platform
- OS: macOS
- Browser: Chrome
- Version: Chrome 103.0.5060.114 (Official Build) (arm64) macOS Monterey 12.4
Additional context
The documentation shows this as a property available https://g6.antv.vision/en/docs/manual/middle/elements/combos/built-in/circle#property
I see this code in /packages/core/src/element/combos/rect.ts
https://github.com/antvis/G6/blob/778720cc89866ba150ad6aeeb8695d5b41b4636f/packages/core/src/element/combos/rect.ts#L136
but the same code does not exist in /packages/core/src/element/combos/circle.ts
fixCollapseSize
in circle combo is ignored.
if (cfg.fixSize) {
r = isNumber(cfg.fixSize) ? cfg.fixSize : cfg.fixSize[0];
} else {
const size = (this as ShapeOptions).getSize!(cfg);
if (!isNumber(style.r) || isNaN(style.r)) r = size[0] / 2 || Global.defaultCombo.style.r;
else r = Math.max(style.r, size[0] / 2) || size[0] / 2;
}
maybe we can create a PR to fix it! 😄
fixCollapseSize
in circle combo is ignored.if (cfg.fixSize) { r = isNumber(cfg.fixSize) ? cfg.fixSize : cfg.fixSize[0]; } else { const size = (this as ShapeOptions).getSize!(cfg); if (!isNumber(style.r) || isNaN(style.r)) r = size[0] / 2 || Global.defaultCombo.style.r; else r = Math.max(style.r, size[0] / 2) || size[0] / 2; }
maybe we can create a PR to fix it! 😄
Great! Looking forward to it!