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

fix(partition): fix safari highlight bug on single slice #1132

Merged
Merged
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
22 changes: 18 additions & 4 deletions src/chart_types/partition_chart/renderer/dom/highlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,25 @@ function renderRectangles(
/**
* Render an SVG path or circle from a partition chart QuadViewModel
*/
function renderSector(geometry: QuadViewModel, key: string, style: SVGStyle) {
function renderSector(geometry: QuadViewModel, key: string, { color, fillClassName, strokeClassName }: SVGStyle) {
const { x0, x1, y0px, y1px } = geometry;
if ((Math.abs(x0 - x1) + TAU) % TAU < EPSILON) {
const props = style.color ? { stroke: style.color } : { className: style.strokeClassName };
return <circle key={key} r={(y0px + y1px) / 2} {...props} fill="none" strokeWidth={y1px - y0px} />;
const props =
y0px === 0
? {
key,
r: y1px,
stroke: 'none',
...(color ? { fill: color } : { className: fillClassName }),
}
: {
key,
r: (y0px + y1px) / 2,
strokeWidth: y1px - y0px,
fill: 'none',
...(color ? { stroke: color } : { className: strokeClassName }),
};
return <circle {...props} />;
}
const X0 = x0 - TAU / 4;
const X1 = x1 - TAU / 4;
Expand All @@ -110,7 +124,7 @@ function renderSector(geometry: QuadViewModel, key: string, style: SVGStyle) {
getSectorShapeFromCanvasArc(0, 0, y1px, X1, X0, true),
'Z',
].join(' ');
const props = style.color ? { fill: style.color } : { className: style.fillClassName };
const props = color ? { fill: color } : { className: fillClassName };
return <path key={key} d={path} {...props} />;
}

Expand Down