chore(editor): merge clamp functions (#10577)

Closes: [BS-2625](https://linear.app/affine-design/issue/BS-2625/合并clamp函数)
This commit is contained in:
Saul-Mirone
2025-03-03 10:33:38 +00:00
parent 899a957fab
commit 4c3c953a36
16 changed files with 21 additions and 34 deletions

View File

@@ -1,3 +1,5 @@
import { clamp } from '@blocksuite/global/utils';
export const BLOCK_CHILDREN_CONTAINER_PADDING_LEFT = 24;
export const NOTE_MIN_WIDTH = 450 + 24 * 2;
export const NOTE_MIN_HEIGHT = 92;
@@ -11,9 +13,6 @@ export enum NoteDisplayMode {
EdgelessOnly = 'edgeless',
}
export const clamp = (min: number, val: number, max: number) =>
Math.min(Math.max(min, val), max);
export const bound01 = (n: number, max: number) => {
n = clamp(0, n, max);