Skip to content

Commit

Permalink
fix(images): zoom default public page style
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 27, 2023
1 parent 5dc89dd commit a439125
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@
zoomed: zoomRatio !== 1
}"
:src="data"
:style="{
marginTop: Math.round(shiftY * 2) + 'px',
marginLeft: Math.round(shiftX * 2) + 'px',
height: zoomHeight + 'px',
width: zoomWidth + 'px',
}"
:style="imgStyle"
@error.capture.prevent.stop.once="onFail"
@load="updateImgSize"
@wheel="updateZoom"
Expand Down Expand Up @@ -97,6 +92,17 @@ export default {
alt() {
return this.basename
},
imgStyle() {
if (this.zoomRatio === 1) {
return {}
}
return {
marginTop: Math.round(shiftY * 2) + 'px',
marginLeft: Math.round(shiftX * 2) + 'px',
height: zoomHeight + 'px',
width: zoomWidth + 'px',
}
},
},
asyncComputed: {
Expand Down

0 comments on commit a439125

Please sign in to comment.