npm run format

This commit is contained in:
2025-11-18 20:12:32 +01:00
parent 404ca9ce88
commit 5c33e77595
6 changed files with 36 additions and 60 deletions

View File

@@ -19,7 +19,7 @@ function isStepOptions(options: ZoomOptions): options is ZoomOptionsStep {
}
export function useZoom(options: ZoomOptions) {
const initial = options.initial ?? (isStepOptions(options) ? 1 : options.allowedValues[1] ?? options.allowedValues[0]);
const initial = options.initial ?? (isStepOptions(options) ? 1 : (options.allowedValues[1] ?? options.allowedValues[0]));
const zoom = ref(initial);
const zoomPercent = computed(() => Math.round(zoom.value * 100));
@@ -67,9 +67,7 @@ export function useZoom(options: ZoomOptions) {
zoom.value = Math.max(options.min, Math.min(options.max, value));
} else {
// Snap to nearest allowed value
const nearest = options.allowedValues.reduce((prev, curr) =>
Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev
);
const nearest = options.allowedValues.reduce((prev, curr) => (Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev));
zoom.value = nearest;
}
};