From 44086c309cfb02aecaaad9b075628576ddd6ff2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BA=91=E9=A3=9E?= Date: Wed, 13 Apr 2022 17:45:58 +0800 Subject: [PATCH 1/2] fix:control actived error at table boundary --- src/editor/core/range/RangeManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/core/range/RangeManager.ts b/src/editor/core/range/RangeManager.ts index 34d6507..4d8e778 100644 --- a/src/editor/core/range/RangeManager.ts +++ b/src/editor/core/range/RangeManager.ts @@ -59,7 +59,7 @@ export class RangeManager { if (~startIndex && ~endIndex && startIndex === startIndex) { const elementList = this.draw.getElementList() const element = elementList[startIndex] - if (element.type === ElementType.CONTROL) { + if (element?.type === ElementType.CONTROL) { control.initControl() return } From 72770fc2e07c5636cb81d524a73f2e255ec54199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BA=91=E9=A3=9E?= Date: Wed, 13 Apr 2022 17:46:16 +0800 Subject: [PATCH 2/2] fix:table 1px border width --- .../core/draw/particle/table/TableParticle.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/editor/core/draw/particle/table/TableParticle.ts b/src/editor/core/draw/particle/table/TableParticle.ts index 657d91b..9444b75 100644 --- a/src/editor/core/draw/particle/table/TableParticle.ts +++ b/src/editor/core/draw/particle/table/TableParticle.ts @@ -15,10 +15,14 @@ export class TableParticle { private _drawBorder(ctx: CanvasRenderingContext2D, startX: number, startY: number, width: number, height: number) { ctx.beginPath() - ctx.moveTo(startX, startY + height) - ctx.lineTo(startX, startY) - ctx.lineTo(startX + width, startY) + const x = Math.round(startX) + const y = Math.round(startY) + ctx.translate(0.5, 0.5) + ctx.moveTo(x, y + height) + ctx.lineTo(x, y) + ctx.lineTo(x + width, y) ctx.stroke() + ctx.translate(-0.5, -0.5) } public computeRowColInfo(element: IElement) { @@ -170,14 +174,16 @@ export class TableParticle { const td = tr.tdList[d] const width = td.width! * scale const height = td.height! * scale - const x = td.x! * scale + startX + width - const y = td.y! * scale + startY + const x = Math.round(td.x! * scale + startX + width) + const y = Math.round(td.y! * scale + startY) + ctx.translate(0.5, 0.5) // 绘制线条 ctx.beginPath() ctx.moveTo(x, y) ctx.lineTo(x, y + height) ctx.lineTo(x - width, y + height) ctx.stroke() + ctx.translate(-0.5, -0.5) } } ctx.restore()