Skip to content

Commit

Permalink
fix(sheets-drawing-ui): float dom scroll not update on drag range (#3840
Browse files Browse the repository at this point in the history
)

Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
weird94 and actions-user authored Oct 24, 2024
1 parent 3e3e795 commit 575a604
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,8 @@ export class SheetCanvasFloatDomManagerService extends Disposable {
}
});
};
let time = 0;

this.disposeWithMe(

this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET)
.pipe(
filter((sheet) => !!sheet),
Expand All @@ -400,18 +398,14 @@ export class SheetCanvasFloatDomManagerService extends Disposable {
return render ? { render, unitId: sheet.getUnitId(), subUnitId: sheet.getActiveSheet().getSheetId() } : null;
}),
filter((render) => !!render),
switchMap((render) => fromEventSubject(render.render.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)!.onMouseWheel$)
.pipe(
map(() => ({ unitId: render.unitId, subUnitId: render.subUnitId }))
)
switchMap((render) =>
fromEventSubject(render.render.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)!.onScrollAfter$)
.pipe(map(() => ({ unitId: render.unitId, subUnitId: render.subUnitId })))
)
)
.subscribe(({ unitId, subUnitId }) => {
const now = performance.now();
time = now;
updateSheet(unitId, subUnitId);
})

);
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
if (commandInfo.id === SetZoomRatioOperation.id) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/views/components/dom/FloatDom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const FloatDomSingle = memo((props: { layer: IFloatDom; id: string }) => {

const sizeSubscription = size$.subscribe((size) => {
if (domRef.current) {
domRef.current.style.width = `${size.endX - size.startX}px`;
domRef.current.style.height = `${size.endY - size.startY}px`;
domRef.current.style.width = `${Math.max(size.endX - size.startX - 2, 0)}px`;
domRef.current.style.height = `${Math.max(size.endY - size.startY - 2, 0)}px`;
}

if (innerDomRef.current) {
Expand Down

0 comments on commit 575a604

Please sign in to comment.