Skip to content

Commit 2861a4d

Browse files
committed
Draw dashed lines through ratios
1 parent 58bb7fc commit 2861a4d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/browser/renderer/shared/TextureAtlas.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,14 @@ export class TextureAtlas implements ITextureAtlas {
613613
nextOffset = computeNextVariantOffset(xChRight - xChLeft, lineWidth, nextOffset);
614614
break;
615615
case UnderlineStyle.DASHED:
616-
this._tmpCtx.setLineDash([this._config.devicePixelRatio * 4, this._config.devicePixelRatio * 3]);
616+
const lineRatio = 0.6;
617+
const gapRatio = 0.3;
618+
// End line ratio is approximately equal to 0.1
619+
const xChWidth = xChRight - xChLeft;
620+
const line = Math.floor(lineRatio * xChWidth);
621+
const gap = Math.floor(gapRatio * xChWidth);
622+
const end = xChWidth - line - gap;
623+
this._tmpCtx.setLineDash([line, gap, end]);
617624
this._tmpCtx.moveTo(xChLeft, yTop);
618625
this._tmpCtx.lineTo(xChRight, yTop);
619626
break;

0 commit comments

Comments
 (0)