npm run format
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user