Skip to content

Commit

Permalink
fixed unscaled image offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alxcube committed Dec 19, 2023
1 parent 52833c3 commit c6a29c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/playground/image-area/ImageViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ function fitViewport() {
width = height * ratio;
}
const { x: offsetX, y: offsetY } = props.offset;
const x = vpWidth / 2 - width / 2 - offsetX;
const y = vpHeight / 2 - height / 2 - offsetY;
const scale = width / props.image.width;
const { x: offsetX, y: offsetY } = props.offset;
const x = vpWidth / 2 - width / 2 - (offsetX * scale);
const y = vpHeight / 2 - height / 2 - (offsetY * scale);
if (scaleModel.value !== scale) {
scaleModel.value = scale;
}
Expand Down

0 comments on commit c6a29c4

Please sign in to comment.