Skip to content

Commit 325378d

Browse files
authored
Added fallback for font height in Google Chrome (#1023)
1 parent 09b65ca commit 325378d

File tree

1 file changed

+2
-1
lines changed
  • src/ui/segments/workflows/simulate/single-neuron/shared/steps/webgl-neuron-selector/legend-overlay

1 file changed

+2
-1
lines changed

src/ui/segments/workflows/simulate/single-neuron/shared/steps/webgl-neuron-selector/legend-overlay/legend-painter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ function drawLabel(ctx: CanvasRenderingContext2D, label: LabelToDraw) {
157157
ctx.font = `bold ${FONTSIZE}px sans-serif`;
158158
const measure = ctx.measureText(text);
159159
ctx.fillStyle = '#000';
160-
ctx.fillText(text, boxX + PADDING, boxY + PADDING + measure.emHeightAscent);
160+
const fontHeight = measure.emHeightAscent ?? measure.actualBoundingBoxAscent ?? FONTSIZE;
161+
ctx.fillText(text, boxX + PADDING, boxY + PADDING + fontHeight);
161162
}
162163

163164
/**

0 commit comments

Comments
 (0)