Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: fix the issue of holding down the shift key to select a selection (#5958)

wpxp123456e05e89f1f1e0
diff --git a/packages/sheets-ui/src/services/selection/base-selection-render.service.ts b/packages/sheets-ui/src/services/selection/base-selection-render.service.ts
index 94eda35cc2..93964e0ce9 100644
--- a/packages/sheets-ui/src/services/selection/base-selection-render.service.ts
+++ b/packages/sheets-ui/src/services/selection/base-selection-render.service.ts
@@ -42,7 +42,7 @@ import {
ThemeService,
} from '@univerjs/core';
import { ScrollTimer, ScrollTimerType, SHEET_VIEWPORT_KEY, Vector2 } from '@univerjs/engine-render';
-import { REF_SELECTIONS_ENABLED, SELECTIONS_ENABLED } from '@univerjs/sheets';
+import { convertPrimaryWithCoordToPrimary, REF_SELECTIONS_ENABLED, SELECTIONS_ENABLED } from '@univerjs/sheets';
import { BehaviorSubject, Subject } from 'rxjs';
import { SHEET_COMPONENT_SELECTION_LAYER_INDEX } from '../../common/keys';
import { genNormalSelectionStyle, RANGE_FILL_PERMISSION_CHECK, RANGE_MOVE_PERMISSION_CHECK } from './const';
@@ -902,7 +902,7 @@ export class BaseSelectionRenderService extends Disposable implements ISheetSele
});
const selectionWithStyle = {
range,
- primary: null,
+ primary: convertPrimaryWithCoordToPrimary(currentCell),
style: null,
};
const selectionWithCoord = attachSelectionWithCoord(selectionWithStyle, skeleton);
diff --git a/packages/sheets-ui/src/services/selection/selection-render.service.ts b/packages/sheets-ui/src/services/selection/selection-render.service.ts
index 3aa6376f36..e57d989022 100644
--- a/packages/sheets-ui/src/services/selection/selection-render.service.ts
+++ b/packages/sheets-ui/src/services/selection/selection-render.service.ts
@@ -409,7 +409,7 @@ export class SheetSelectionRenderService extends BaseSelectionRenderService impl
!this._singleSelectionEnabled;
//#region update selection control
- if (expandByShiftKey && currentCell) {
+ if (expandByShiftKey) {
// Perform pointer down selection.
this._makeSelectionByTwoCells(
currentCell,