Skip to content

Commit 798d555

Browse files
committed
fix: character typesetting boundary error #1280
1 parent 7f87a6e commit 798d555

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/editor/core/draw/Draw.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,9 +1795,9 @@ export class Draw {
17951795
elementList,
17961796
i
17971797
)
1798-
// 单词宽度大于行可用宽度,无需折行
1798+
// 后面存在元素 && 单词宽度大于行可用宽度,无需折行
17991799
const wordWidth = width * scale
1800-
if (wordWidth <= availableWidth) {
1800+
if (endElement && wordWidth <= availableWidth) {
18011801
curRowWidth += wordWidth
18021802
nextElement = endElement
18031803
}

src/editor/core/draw/particle/TextParticle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Draw } from '../Draw'
1010

1111
export interface IMeasureWordResult {
1212
width: number
13-
endElement: IElement
13+
endElement: IElement | null
1414
}
1515

1616
export class TextParticle {
@@ -56,7 +56,7 @@ export class TextParticle {
5656
): IMeasureWordResult {
5757
const LETTER_REG = this.draw.getLetterReg()
5858
let width = 0
59-
let endElement: IElement = elementList[curIndex]
59+
let endElement: IElement | null = null
6060
let i = curIndex
6161
while (i < elementList.length) {
6262
const element = elementList[i]

0 commit comments

Comments
 (0)