fix(editor): improve table selection in edgeless mode (#10293)

fix: BS-2614, BS-2560
This commit is contained in:
zzj3720
2025-02-20 01:50:40 +00:00
parent 676ccc9094
commit d8435421d2
3 changed files with 38 additions and 21 deletions
@@ -43,6 +43,10 @@ export class SelectionController implements ReactiveController {
private get clipboard() {
return this.host.std.clipboard;
}
private get scale() {
return this.host.getScale();
}
widthAdjust(dragHandle: HTMLElement, event: MouseEvent) {
event.preventDefault();
event.stopPropagation();
@@ -50,6 +54,7 @@ export class SelectionController implements ReactiveController {
const currentWidth =
dragHandle.closest('td')?.getBoundingClientRect().width ??
DefaultColumnWidth;
const adjustedWidth = currentWidth / this.scale;
const columnId = dragHandle.dataset['widthAdjustColumnId'];
if (!columnId) {
return;
@@ -60,7 +65,7 @@ export class SelectionController implements ReactiveController {
columnId,
width: Math.max(
ColumnMinWidth,
event.clientX - initialX + currentWidth
(event.clientX - initialX) / this.scale + adjustedWidth
),
};
};