Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/mixins/Mime.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export default {
type: Boolean,
default: false,
},
// left-edge position of the sidebar (px), set before isSidebarShown flips
sidebarPosition: {
type: Number,
default: 0,
},
// are we in fullscreen mode ?
isFullScreen: {
type: Boolean,
Expand Down Expand Up @@ -121,8 +126,7 @@ export default {
},
// update image size on sidebar toggle
isSidebarShown() {
// wait for transition to complete (100ms)
setTimeout(this.updateHeightWidth, 200)
this.updateHeightWidth()
},
},

Expand Down Expand Up @@ -162,7 +166,9 @@ export default {
const modalContainer = modalWrapper.querySelector('.modal-container')

const parentHeight = modalContainer.clientHeight
const parentWidth = modalContainer.clientWidth
const parentWidth = (this.isSidebarShown && this.sidebarPosition > 0)
? this.sidebarPosition
: modalContainer.clientWidth

const heightRatio = parentHeight / this.naturalHeight
const widthRatio = parentWidth / this.naturalWidth
Expand Down
4 changes: 3 additions & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
:editing="false"
:is-full-screen="isFullscreen"
:is-sidebar-shown="isSidebarShown"
:sidebar-position="sidebarPosition"
:loaded.sync="comparisonFile.loaded"
class="viewer__file viewer__file--active"
@error="comparisonFailed" />
Expand Down Expand Up @@ -145,6 +146,7 @@
:file-list="fileList"
:is-full-screen="isFullscreen"
:is-sidebar-shown="isSidebarShown"
:sidebar-position="sidebarPosition"
:loaded.sync="currentFile.loaded"
class="viewer__file viewer__file--active"
@update:editing="toggleEditor"
Expand Down Expand Up @@ -1117,12 +1119,12 @@ export default defineComponent({
},

handleAppSidebarOpen() {
this.isSidebarShown = true
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarPosition = sidebar.getBoundingClientRect().left
this.trapElements = [sidebar]
}
this.isSidebarShown = true
},

handleAppSidebarClose() {
Expand Down
Loading