From 7c32f9572f4d29fbf2f5d6d3f775c5dbe2d0ba8b Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Wed, 8 Nov 2023 21:58:45 +0800 Subject: [PATCH] feat: collapsed selection rect information --- src/editor/core/command/CommandAdapt.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/editor/core/command/CommandAdapt.ts b/src/editor/core/command/CommandAdapt.ts index 25e8c61b8..ca7a2f28b 100644 --- a/src/editor/core/command/CommandAdapt.ts +++ b/src/editor/core/command/CommandAdapt.ts @@ -1811,10 +1811,10 @@ export class CommandAdapt { const endPageNo = positionList[endIndex].pageNo // 坐标信息(相对编辑器书写区) const rangeRects: RangeRect[] = [] + const height = this.draw.getOriginalHeight() + const pageGap = this.draw.getOriginalPageGap() const selectionPositionList = this.position.getSelectionPositionList() if (selectionPositionList) { - const height = this.draw.getOriginalHeight() - const pageGap = this.draw.getOriginalPageGap() // 起始信息及x坐标 let currentRowNo: number | null = null let currentX = 0 @@ -1847,6 +1847,20 @@ export class CommandAdapt { rangeRects.push(rangeRect) } } + } else { + const positionList = this.position.getPositionList() + const position = positionList[endIndex] + const { + coordinate: { rightTop }, + pageNo, + lineHeight + } = position + rangeRects.push({ + x: rightTop[0], + y: rightTop[1] + pageNo * (height + pageGap), + width: 0, + height: lineHeight + }) } return deepClone({ isCollapsed,