Skip to content

Commit

Permalink
fix: better code
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Feb 15, 2025
1 parent 2d4adae commit 8780277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const MoveSelectionCommand: ICommand<IMoveSelectionCommandParams> = {
selections,
type: SelectionMoveType.MOVE_END,
extra,
reveal: true,
} as ISetSelectionsOperationParams);
return rs;
},
Expand Down Expand Up @@ -304,6 +305,7 @@ export const MoveSelectionEnterAndTabCommand: ICommand<IMoveSelectionEnterAndTab
subUnitId: sheetId,
type: SelectionMoveType.MOVE_END,
selections,
reveal: true,
extra: params.extra,
});
const renderManagerService = accessor.get(IRenderManagerService);
Expand Down Expand Up @@ -445,7 +447,7 @@ export const SelectAllCommand: ICommand<ISelectAllCommandParams> = {
return accessor.get(ICommandService).executeCommand(SetSelectionsOperation.id, {
unitId,
subUnitId,

reveal: true,
selections: [
{
range: destRange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import type { IFreeze, IRange, IWorksheetData, Nullable, Workbook } from '@univerjs/core';
import type { IRenderContext, IRenderModule, IScrollObserverParam, IWheelEvent } from '@univerjs/engine-render';
import type { SheetsSelectionsService } from '@univerjs/sheets';
import type { ISetSelectionsOperationParams, SheetsSelectionsService } from '@univerjs/sheets';
import type { IScrollCommandParams } from '../../commands/commands/set-scroll.command';
import type { IExpandSelectionCommandParams } from '../../commands/commands/set-selection.command';
import type { IScrollState, IScrollStateSearchParam, IViewportScrollState } from '../../services/scroll-manager.service';
Expand Down Expand Up @@ -332,14 +332,14 @@ export class SheetsScrollRenderController extends Disposable implements IRenderM

private _initCommandListener(): void {
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
if (command.params?.unitId !== this._context.unitId) {
return;
}

switch (command.id) {
case MoveSelectionEnterAndTabCommand.id:
case SetSelectionsOperation.id:
this._scrollToSelection();
{
const p = command.params as ISetSelectionsOperationParams;
if (p.unitId === this._context.unitId && p.reveal) {
this._scrollToSelection();
}
}
break;

case ScrollToCellOperation.id:
Expand Down Expand Up @@ -561,7 +561,6 @@ export class SheetsScrollRenderController extends Disposable implements IRenderM
endRow: viewMainEndRow,
endColumn: viewMainEndColumn,
} = bounds;
// const visibleRangeOfViewMain = skeleton.getVisibleRangeByViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);

// why undefined?
let startSheetViewRow: number | undefined;
Expand Down

0 comments on commit 8780277

Please sign in to comment.