fix: checkbox custom size rendering error #529

pr675
Hufe921 2 years ago
parent 34d59bbb58
commit 5a5fd64176

@ -61,11 +61,10 @@ export class CheckboxParticle {
// 勾选对号
ctx.beginPath()
ctx.strokeStyle = fontStyle
ctx.lineWidth = lineWidth * 2
ctx.moveTo(left + 2 * scale, top + 7 * scale)
ctx.lineTo(left + 7 * scale, top + 11 * scale)
ctx.moveTo(left + 6.5 * scale, top + 11 * scale)
ctx.lineTo(left + 12 * scale, top + 3 * scale)
ctx.lineWidth = lineWidth * 2 * scale
ctx.moveTo(left + 2 * scale, top + height / 2)
ctx.lineTo(left + width / 2, top + height - 3 * scale)
ctx.lineTo(left + width - 2 * scale, top + 3 * scale)
ctx.stroke()
} else {
ctx.lineWidth = lineWidth

@ -133,13 +133,16 @@ export class ListParticle {
ctx: CanvasRenderingContext2D,
listElementList: IElement[]
): number {
const { scale } = this.options
const { scale, checkbox } = this.options
const startElement = listElementList[0]
// 非递增样式返回固定值
if (
startElement.listStyle &&
startElement.listStyle !== ListStyle.DECIMAL
) {
if (startElement.listStyle === ListStyle.CHECKBOX) {
return (checkbox.width + this.LIST_GAP) * scale
}
return this.UN_COUNT_STYLE_WIDTH * scale
}
// 计算列表数量

Loading…
Cancel
Save