Skip to content

Commit

Permalink
fix: 图片预览拖拽问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fennghuang committed Oct 25, 2023
1 parent 22e2a1f commit 0a5247c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/image-viewer/image-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,14 @@ export default defineComponent({
return;
}

state.dragging = true;

// 过高图片允许上下滑动
state.draggedY = offset?.[1] || 0;

if (state.scale === 1) return;

state.draggedX = offset?.[0] || 0;
state.dragging = true;

if (movement[0] !== _movement[0] && overflow[0] !== 0) {
state.extraDraggedX += _delta[0] / 5;
Expand Down Expand Up @@ -375,13 +376,7 @@ export default defineComponent({

watch(
() => state.scale,
(newVal) => {
if (newVal !== 1) {
disabled.value = true;
} else {
disabled.value = false;
}
},
(newVal) => (disabled.value = newVal !== 1),
);

onUnmounted(() => {
Expand Down

0 comments on commit 0a5247c

Please sign in to comment.