Skip to content

Commit 37214f5

Browse files
committed
fix: bring back zoom on single open files
Zoom should only be disabled on single shared files. See #1242 (review) Signed-off-by: Max <max@nextcloud.com>
1 parent 17a97bd commit 37214f5

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

js/viewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Images.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export default {
6262
},
6363
6464
props: {
65+
canZoom: {
66+
type: Boolean,
67+
default: false,
68+
},
6569
editing: {
6670
type: Boolean,
6771
default: false,
@@ -144,6 +148,10 @@ export default {
144148
* @return {null}
145149
*/
146150
updateZoom(event) {
151+
if (!this.canZoom) {
152+
return
153+
}
154+
147155
event.stopPropagation()
148156
event.preventDefault()
149157
@@ -172,11 +180,7 @@ export default {
172180
this.disableSwipe()
173181
this.shiftX = this.shiftX + Math.round(-scrollPercX * growX)
174182
this.shiftY = this.shiftY + Math.round(-scrollPercY * growY)
175-
176-
// only change zoomRatio when multiple files are in the fileList. Disable for single shared files
177-
if (this.fileList.length > 1) {
178-
this.zoomRatio = newZoomRatio
179-
}
183+
this.zoomRatio = newZoomRatio
180184
},
181185
182186
resetZoom() {

src/views/Viewer.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
v-bind="currentFile"
119119
:active="true"
120120
:can-swipe.sync="canSwipe"
121+
:can-zoom="canZoom"
121122
:editing.sync="editing"
122123
:file-list="fileList"
123124
:is-full-screen="isFullscreen"
@@ -256,6 +257,9 @@ export default {
256257
canLoop() {
257258
return this.Viewer.canLoop
258259
},
260+
canZoom() {
261+
return !this.Viewer.el
262+
},
259263
isStartOfList() {
260264
return this.currentIndex === 0
261265
},

0 commit comments

Comments
 (0)