refactor(editor): replace debounce and throttle with lodash (#10639)

This commit is contained in:
Saul-Mirone
2025-03-06 04:46:52 +00:00
parent 824f573ff9
commit 2b30d756e2
27 changed files with 118 additions and 202 deletions

View File

@@ -5,8 +5,9 @@ import {
type IVec,
Vec,
} from '@blocksuite/global/gfx';
import { debounce, Slot } from '@blocksuite/global/utils';
import { Slot } from '@blocksuite/global/utils';
import { signal } from '@preact/signals-core';
import debounce from 'lodash-es/debounce';
import type { GfxViewportElement } from '.';
@@ -73,21 +74,13 @@ export class Viewport {
ZOOM_MIN = ZOOM_MIN;
private readonly _resetZooming = debounce(
() => {
this.zooming$.value = false;
},
200,
{ leading: false, trailing: true }
);
private readonly _resetZooming = debounce(() => {
this.zooming$.value = false;
}, 200);
private readonly _resetPanning = debounce(
() => {
this.panning$.value = false;
},
200,
{ leading: false, trailing: true }
);
private readonly _resetPanning = debounce(() => {
this.panning$.value = false;
}, 200);
constructor() {
this.elementReady.once(el => (this._element = el));