Skip to content

Commit

Permalink
fix: update freeze incorrect when insert row and insert column
Browse files Browse the repository at this point in the history
  • Loading branch information
semmywong committed Jun 14, 2024
1 parent bd9aef7 commit cdef4f3
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { ICommandInfo, IFreeze, IRange, IStyleSheet, IWorksheetData, Nullab
import {
ColorKit,
createInterceptorKey,
Direction,
Disposable,
ICommandService,
InterceptorManager,
Expand Down Expand Up @@ -1151,9 +1152,9 @@ export class HeaderFreezeRenderController extends Disposable implements IRenderM

if (command.id === InsertRowCommand.id) {
const params = command.params as IInsertRowCommandParams;
const range = params.range;
const { range, direction } = params;
const insertCount = range.endRow - range.startRow + 1;
if (range.startRow < freeze.startRow) {
if (range.startRow + 1 < freeze.startRow || (range.startRow + 1 === freeze.startRow && direction === Direction.UP)) {
const newFreeze: IFreeze = {
...freeze,
startRow: Math.max(1, freeze.startRow + insertCount),
Expand All @@ -1166,9 +1167,9 @@ export class HeaderFreezeRenderController extends Disposable implements IRenderM

if (command.id === InsertColCommand.id) {
const params = command.params as IInsertColCommandParams;
const range = params.range;
const { range, direction } = params;
const insertCount = range.endColumn - range.startColumn + 1;
if (range.startColumn <= freeze.startColumn) {
if (range.startColumn + 1 < freeze.startColumn || (range.startColumn + 1 === freeze.startColumn && direction === Direction.LEFT)) {
const newFreeze: IFreeze = {
...freeze,
startColumn: Math.max(1, freeze.startColumn + insertCount),
Expand Down

0 comments on commit cdef4f3

Please sign in to comment.