Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -1,11 +1,4 @@
|
||||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { as } from 'folds';
|
||||
import { Icon, Icons } from '../icons';
|
||||
@@ -42,16 +35,13 @@ function imageViewportMax() {
|
||||
};
|
||||
}
|
||||
|
||||
function pointerDistance(
|
||||
a: { x: number; y: number },
|
||||
b: { x: number; y: number }
|
||||
): number {
|
||||
function pointerDistance(a: { x: number; y: number }, b: { x: number; y: number }): number {
|
||||
return Math.hypot(a.x - b.x, a.y - b.y);
|
||||
}
|
||||
|
||||
function pointerMidpoint(
|
||||
a: { x: number; y: number },
|
||||
b: { x: number; y: number }
|
||||
b: { x: number; y: number },
|
||||
): { x: number; y: number } {
|
||||
return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
|
||||
}
|
||||
@@ -123,7 +113,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
applyZoomCss(clamped);
|
||||
setZoom(clamped);
|
||||
},
|
||||
[applyZoomCss, clampPan]
|
||||
[applyZoomCss, clampPan],
|
||||
);
|
||||
|
||||
const resetZoom = useCallback(() => {
|
||||
@@ -162,7 +152,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
ty: py - iy * scale,
|
||||
});
|
||||
},
|
||||
[commitZoom]
|
||||
[commitZoom],
|
||||
);
|
||||
|
||||
const framePoint = (clientX: number, clientY: number) => {
|
||||
@@ -202,7 +192,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
const local = framePoint(mid.x, mid.y);
|
||||
const scale = Math.min(
|
||||
ZOOM_MAX,
|
||||
Math.max(ZOOM_MIN, pinch.startScale * (dist / pinch.startDist))
|
||||
Math.max(ZOOM_MIN, pinch.startScale * (dist / pinch.startDist)),
|
||||
);
|
||||
|
||||
// Keep the original content under the pinch midpoint while scaling + panning.
|
||||
@@ -441,5 +431,5 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user