chore(a11y): merge labelConfig with defaults

This commit is contained in:
Abbey Yacoe
2025-05-22 11:38:02 +02:00
parent 6081f687bf
commit 48c5467851
5 changed files with 15 additions and 5 deletions
+6
View File
@@ -16,6 +16,8 @@ import type {
import { type Viewport } from '../types';
import { getNodePositionWithOrigin, isInternalNodeBase } from './graph';
import { defaultLabelConfig, type LabelConfig } from '../constants';
export const clamp = (val: number, min = 0, max = 1): number => Math.min(Math.max(val, min), max);
export const clampPosition = (
@@ -418,3 +420,7 @@ export function withResolvers<T>(): {
});
return { promise, resolve, reject };
}
export function mergeLabelConfig(partial?: Partial<LabelConfig>): LabelConfig {
return { ...defaultLabelConfig, ...(partial || {}) };
}