Web:Common:Components:MediaViewer:Sub-Components:ImageViewer Fixed the wheel event and removed useless code
This commit is contained in:
parent
ff18523e43
commit
7ee3770bd2
@ -61,7 +61,6 @@ function ImageViewer({
|
|||||||
const isDoubleTapRef = useRef<boolean>(false);
|
const isDoubleTapRef = useRef<boolean>(false);
|
||||||
const setTimeoutIDTapRef = useRef<NodeJS.Timeout>();
|
const setTimeoutIDTapRef = useRef<NodeJS.Timeout>();
|
||||||
const startAngleRef = useRef<number>(0);
|
const startAngleRef = useRef<number>(0);
|
||||||
const scaleRef = useRef<number>(1);
|
|
||||||
const toolbarRef = useRef<ImperativeHandle>(null);
|
const toolbarRef = useRef<ImperativeHandle>(null);
|
||||||
|
|
||||||
const [scale, setScale] = useState(1);
|
const [scale, setScale] = useState(1);
|
||||||
@ -702,8 +701,6 @@ function ImageViewer({
|
|||||||
|
|
||||||
const point = calculateAdjustBounds(dx, dy, ratio, dRotate);
|
const point = calculateAdjustBounds(dx, dy, ratio, dRotate);
|
||||||
|
|
||||||
scaleRef.current = dScale;
|
|
||||||
|
|
||||||
api.start({
|
api.start({
|
||||||
...point,
|
...point,
|
||||||
scale: dScale,
|
scale: dScale,
|
||||||
@ -813,7 +810,6 @@ function ImageViewer({
|
|||||||
onWheel: ({
|
onWheel: ({
|
||||||
first,
|
first,
|
||||||
offset: [, yWheel],
|
offset: [, yWheel],
|
||||||
lastOffset: [, lYWheel],
|
|
||||||
movement: [, mYWheel],
|
movement: [, mYWheel],
|
||||||
pinching,
|
pinching,
|
||||||
memo,
|
memo,
|
||||||
@ -827,8 +823,8 @@ function ImageViewer({
|
|||||||
)
|
)
|
||||||
return memo;
|
return memo;
|
||||||
|
|
||||||
|
resetToolbarVisibleTimer();
|
||||||
const dScale = (-1 * yWheel) / RatioWheel;
|
const dScale = (-1 * yWheel) / RatioWheel;
|
||||||
const lScale = (-1 * lYWheel) / RatioWheel;
|
|
||||||
const mScale = (-1 * mYWheel) / RatioWheel;
|
const mScale = (-1 * mYWheel) / RatioWheel;
|
||||||
|
|
||||||
if (first || !memo) {
|
if (first || !memo) {
|
||||||
@ -845,7 +841,7 @@ function ImageViewer({
|
|||||||
const dx = memo[0] - mScale * memo[2];
|
const dx = memo[0] - mScale * memo[2];
|
||||||
const dy = memo[1] - mScale * memo[3];
|
const dy = memo[1] - mScale * memo[3];
|
||||||
|
|
||||||
const ratio = dScale / lScale;
|
const ratio = dScale / style.scale.get();
|
||||||
|
|
||||||
const point = calculateAdjustImage(
|
const point = calculateAdjustImage(
|
||||||
calculateAdjustBounds(dx, dy, ratio),
|
calculateAdjustBounds(dx, dy, ratio),
|
||||||
|
Loading…
Reference in New Issue
Block a user