修改样式

This commit is contained in:
al 2024-08-21 16:33:13 +08:00
parent d4c45a6dd1
commit 7f6a50c3c2
1 changed files with 5 additions and 2 deletions

View File

@ -158,15 +158,18 @@ const ImagesMaskContaint = forwardRef(
// ref.current.children[0].style.transform = // ref.current.children[0].style.transform =
// "matrix(" + size + ", 0, 0, " + size + ", 0, 0)"; // "matrix(" + size + ", 0, 0, " + size + ", 0, 0)";
// } // }
if (zoomed) { if (zoomed) {
let currentX = touches[0].clientX - initialMoveX; let currentX = touches[0].clientX - initialMoveX;
let currentY = touches[0].clientY - initialMoveY; let currentY = touches[0].clientY - initialMoveY;
// console.log(currentX + xOffsetMove); // console.log(currentX + xOffsetMove);
if (Math.abs(currentX + xOffsetMove) > window.innerWidth) return; let currentDom =
ref.current.children[currentIndex].getBoundingClientRect();
if (Math.abs(currentX + xOffsetMove) > currentDom.width / 3) return;
ref.current.children[currentIndex].style.left = `${ ref.current.children[currentIndex].style.left = `${
currentX + xOffsetMove currentX + xOffsetMove
}px`; }px`;
if (Math.abs(currentY + yOffsetMove - 54) > window.innerHeight) return; if (Math.abs(currentY + yOffsetMove) > currentDom.height / 3) return;
ref.current.children[currentIndex].style.top = `${ ref.current.children[currentIndex].style.top = `${
currentY + yOffsetMove - 54 currentY + yOffsetMove - 54
}px`; }px`;