feat:draw line feed selection

pr675
黄云飞 4 years ago
parent 3418083438
commit 847207fa64

@ -714,25 +714,36 @@ export class Draw {
} }
// 选区记录 // 选区记录
const { startIndex, endIndex } = this.range.getRange() const { startIndex, endIndex } = this.range.getRange()
if (startIndex !== endIndex && startIndex < index && index <= endIndex) { if (startIndex !== endIndex && startIndex <= index && index <= endIndex) {
const positionContext = this.position.getPositionContext() // 从行尾开始-绘制最小宽度
// 表格需限定上下文 if (startIndex === index) {
if ( const nextElement = this.elementList[startIndex + 1]
(!positionContext.isTable && !element.tdId) if (nextElement && nextElement.value === ZERO) {
|| positionContext.tdId === element.tdId rangeRecord.x = x + metrics.width
) {
let rangeWidth = metrics.width
// 最小选区宽度
if (rangeWidth === 0 && curRow.elementList.length === 1) {
rangeWidth = this.options.rangeMinWidth
}
// 记录第一次位置、行高
if (!rangeRecord.width) {
rangeRecord.x = x
rangeRecord.y = y rangeRecord.y = y
rangeRecord.height = curRow.height rangeRecord.height = curRow.height
rangeRecord.width += this.options.rangeMinWidth
}
} else {
const positionContext = this.position.getPositionContext()
// 表格需限定上下文
if (
(!positionContext.isTable && !element.tdId)
|| positionContext.tdId === element.tdId
) {
let rangeWidth = metrics.width
// 最小选区宽度
if (rangeWidth === 0 && curRow.elementList.length === 1) {
rangeWidth = this.options.rangeMinWidth
}
// 记录第一次位置、行高
if (!rangeRecord.width) {
rangeRecord.x = x
rangeRecord.y = y
rangeRecord.height = curRow.height
}
rangeRecord.width += rangeWidth
} }
rangeRecord.width += rangeWidth
} }
} }
index++ index++

Loading…
Cancel
Save