Skip to content

Commit

Permalink
fix(partition): fix safari highlight bug on single slice (opensearch-…
Browse files Browse the repository at this point in the history
…project#1132)

fix opensearch-project#1085

Co-authored-by: Nick Partridge <[email protected]>
  • Loading branch information
markov00 and nickofthyme authored Apr 23, 2021
1 parent dde7bdb commit 729c179
Showing 1 changed file with 18 additions and 4 deletions.
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

0 comments on commit 729c179

Please sign in to comment.