Skip to content

Commit

Permalink
fix(image-viewer): 滚轮缩放符合操作直觉 (#2974)
Browse files Browse the repository at this point in the history
自然滚动与标准滚动对图片放大缩小的操作均符合直觉

#2825
  • Loading branch information
sinbadmaster authored Dec 12, 2023
1 parent 840c477 commit 8a37ecf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/image-viewer/image-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,9 @@ export default defineComponent({

const onWheel = (e: WheelEvent) => {
e.preventDefault();
const { deltaY, ctrlKey } = e;
// mac触摸板双指缩放时ctrlKey=true,deltaY>0为缩小 <0为放大
if (ctrlKey) {
return deltaY > 0 ? onZoomOut() : onZoomIn();
}
deltaY > 0 ? onZoomIn() : onZoomOut();
const { deltaY } = e;

deltaY > 0 ? onZoomOut() : onZoomIn();
};

const transStyle = computed(() => setTransform(`translateX(calc(-${indexValue.value} * (40px / 9 * 16 + 4px)))`));
Expand Down

0 comments on commit 8a37ecf

Please sign in to comment.