Skip to content

Commit

Permalink
fix: img defaul height/width on standalone mode
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Aug 22, 2024
1 parent 7f85251 commit 77c3fae
Show file tree
Hide file tree
Showing 13 changed files with 65,469 additions and 79 deletions.
9,330 changes: 9,330 additions & 0 deletions css/main-B8JMBDQI.chunk.css

Large diffs are not rendered by default.

9,334 changes: 9,334 additions & 0 deletions css/main-BQpYvOBl.chunk.css

Large diffs are not rendered by default.

9,330 changes: 9,330 additions & 0 deletions css/main-Bib0W53f.chunk.css

Large diffs are not rendered by default.

9,330 changes: 9,330 additions & 0 deletions css/main-Bq-oOeTE.chunk.css

Large diffs are not rendered by default.

9,330 changes: 9,330 additions & 0 deletions css/main-BqxICS9X.chunk.css

Large diffs are not rendered by default.

9,330 changes: 9,330 additions & 0 deletions css/main-CTwq7dfv.chunk.css

Large diffs are not rendered by default.

9,330 changes: 9,330 additions & 0 deletions css/main-JMTTP9er.chunk.css

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions css/viewer-main.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/* extracted by css-entry-points-plugin */
<<<<<<< HEAD
@import './main-dRuNgPbA.chunk.css';
=======
@import './main-CWJ2NyUp.chunk.css';
>>>>>>> 4f4c20d1 (chore(assets): Recompile assets)
@import './main-BQpYvOBl.chunk.css';
200 changes: 136 additions & 64 deletions js/viewer-main.mjs

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ export default {
},
props: {
canZoom: {
type: Boolean,
default: false,
},
editing: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -261,6 +257,10 @@ export default {
// Try to make sure that image position at stableX, stableY
// in client coordinates stays in the same place on the screen.
updateZoomAndShift(stableX, stableY, newZoomRatio) {
if (!this.canZoom) {
return
}
// scrolling position relative to the image
const element = this.$refs.image ?? this.$refs.video
const scrollX = stableX - element.getBoundingClientRect().x - (this.width * this.zoomRatio / 2)
Expand Down Expand Up @@ -364,6 +364,9 @@ export default {
* @param {DragEvent} event the event
*/
pointerMove(event) {
if (!this.canZoom) {
return
}
if (this.pointerCache.length > 0) {
// Update pointer position in the pointer cache
Expand Down
7 changes: 7 additions & 0 deletions src/mixins/Mime.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default {
type: Boolean,
default: true,
},
canZoom: {
type: Boolean,
default: false,
},
// is the content loaded?
// synced with parent
loaded: {
Expand Down Expand Up @@ -197,6 +201,9 @@ export default {
this.height = this.naturalHeight
this.width = this.naturalWidth
}
} else {
this.height = this.naturalHeight
this.width = this.naturalWidth
}
},

Expand Down
8 changes: 3 additions & 5 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ref="content"
:active="true"
:can-swipe="false"
:can-zoom="false"
v-bind="currentFile"
:file-list="[currentFile]"
:is-full-screen="false"
Expand Down Expand Up @@ -155,7 +156,7 @@
v-bind="currentFile"
:active="true"
:can-swipe.sync="canSwipe"
:can-zoom="canZoom"
:can-zoom="true"
:editing.sync="editing"
:file-list="fileList"
:is-full-screen="isFullscreen"
Expand Down Expand Up @@ -332,9 +333,6 @@ export default {
canLoop() {
return this.Viewer.canLoop
},
canZoom() {
return !this.Viewer.el
},
isStartOfList() {
return this.currentIndex === 0
},
Expand Down Expand Up @@ -505,7 +503,7 @@ export default {
// user reached the end of list
async isEndOfList(isEndOfList) {
if (!isEndOfList) {
if (!isEndOfList || this.el) {
return
}
Expand Down

0 comments on commit 77c3fae

Please sign in to comment.