Web:Common:Components:MediaViewer:Sub-Components:ImageViewer Fixed the wheel event and removed useless code

This commit is contained in:
Akmal Isomadinov 2023-03-06 11:59:41 +05:00
parent ff18523e43
commit 7ee3770bd2

View File

@ -61,7 +61,6 @@ function ImageViewer({
const isDoubleTapRef = useRef<boolean>(false);
const setTimeoutIDTapRef = useRef<NodeJS.Timeout>();
const startAngleRef = useRef<number>(0);
const scaleRef = useRef<number>(1);
const toolbarRef = useRef<ImperativeHandle>(null);
const [scale, setScale] = useState(1);
@ -702,8 +701,6 @@ function ImageViewer({
const point = calculateAdjustBounds(dx, dy, ratio, dRotate);
scaleRef.current = dScale;
api.start({
...point,
scale: dScale,
@ -813,7 +810,6 @@ function ImageViewer({
onWheel: ({
first,
offset: [, yWheel],
lastOffset: [, lYWheel],
movement: [, mYWheel],
pinching,
memo,
@ -827,8 +823,8 @@ function ImageViewer({
)
return memo;
resetToolbarVisibleTimer();
const dScale = (-1 * yWheel) / RatioWheel;
const lScale = (-1 * lYWheel) / RatioWheel;
const mScale = (-1 * mYWheel) / RatioWheel;
if (first || !memo) {
@ -845,7 +841,7 @@ function ImageViewer({
const dx = memo[0] - mScale * memo[2];
const dy = memo[1] - mScale * memo[3];
const ratio = dScale / lScale;
const ratio = dScale / style.scale.get();
const point = calculateAdjustImage(
calculateAdjustBounds(dx, dy, ratio),