fix: reduce underline distance #247

pr675
Hufe921 3 years ago
parent fef6ddf7a8
commit 33bafbd427

@ -1443,7 +1443,8 @@ export class Draw {
const { rowList, pageNo, elementList, positionList, startIndex, zone } =
payload
const isPrintMode = this.mode === EditorMode.PRINT
const { scale, tdPadding } = this.options
const { scale, tdPadding, defaultBasicRowMarginHeight, defaultRowMargin } =
this.options
const { isCrossRowCol, tableId } = this.range.getRange()
let index = startIndex
for (let i = 0; i < rowList.length; i++) {
@ -1540,10 +1541,14 @@ export class Draw {
}
// 下划线记录
if (element.underline) {
const rowMargin =
defaultBasicRowMarginHeight *
(element.rowMargin || defaultRowMargin) *
scale
this.underline.recordFillInfo(
ctx,
x,
y + curRow.height,
y + curRow.height - rowMargin,
metrics.width,
0,
element.color

@ -16,7 +16,7 @@ export class Underline extends AbstractRichText {
const { x, y, width } = this.fillRect
ctx.save()
ctx.strokeStyle = this.fillColor || underlineColor
const adjustY = y + 0.5 // 从1处渲染避免线宽度等于3
const adjustY = Math.floor(y + 2 * ctx.lineWidth) + 0.5 // +0.5从1处渲染避免线宽度等于3
ctx.beginPath()
ctx.moveTo(x, adjustY)
ctx.lineTo(x + width, adjustY)

Loading…
Cancel
Save