mirror of
https://github.com/dream-num/univer.git
synced 2026-09-24 15:32:18 +08:00
fix(sheets): fix the issue of double-clicking automatically filling boundaries (#6448)
This commit is contained in:
@@ -275,24 +275,23 @@ export class AutoFillController extends Disposable {
|
||||
return source;
|
||||
}
|
||||
const matrix = worksheet.getCellMatrix();
|
||||
const maxRow = worksheet.getMaxRows() - 1;
|
||||
const maxColumn = worksheet.getMaxColumns() - 1;
|
||||
let detectEndRow = endRow;
|
||||
const maxRow = worksheet.getMaxRows();
|
||||
const maxColumn = worksheet.getMaxColumns();
|
||||
let detectEndRow = endRow + 1;
|
||||
// left column first, or consider right column.
|
||||
if (startColumn > 0 && matrix.getValue(startRow, startColumn - 1)?.v != null) {
|
||||
let cur = startRow;
|
||||
while (matrix.getValue(cur, startColumn - 1)?.v != null && cur < maxRow) {
|
||||
cur += 1;
|
||||
if (startColumn > 0 && matrix.getValue(detectEndRow, startColumn - 1)?.v != null) {
|
||||
while (matrix.getValue(detectEndRow + 1, startColumn - 1)?.v != null && detectEndRow < maxRow) {
|
||||
detectEndRow += 1;
|
||||
}
|
||||
detectEndRow = cur - 1;
|
||||
} else if (endColumn < maxColumn && matrix.getValue(endRow, endColumn + 1)?.v != null) {
|
||||
let cur = startRow;
|
||||
while (matrix.getValue(cur, endColumn + 1)?.v != null && cur < maxRow) {
|
||||
cur += 1;
|
||||
} else if (endColumn < maxColumn - 1 && matrix.getValue(detectEndRow, endColumn + 1)?.v != null) {
|
||||
while (matrix.getValue(detectEndRow + 1, endColumn + 1)?.v != null && detectEndRow < maxRow) {
|
||||
detectEndRow += 1;
|
||||
}
|
||||
detectEndRow = cur - 1;
|
||||
} else {
|
||||
detectEndRow = endRow;
|
||||
}
|
||||
|
||||
// If the fill range contains data, stop filling at the first row of data.
|
||||
for (let i = endRow + 1; i <= detectEndRow; i++) {
|
||||
for (let j = startColumn; j <= endColumn; j++) {
|
||||
if (matrix.getValue(i, j)?.v != null) {
|
||||
|
||||
Reference in New Issue
Block a user