Skip to content

Commit

Permalink
fix: use left position of sidebar to set viewer width
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme authored and backportbot-nextcloud[bot] committed May 4, 2023
1 parent 577cd3a commit 7a7a556
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
:has-previous="hasPrevious"
:inline-actions="canEdit ? 1 : 0"
:spread-navigation="true"
:style="{ width: isSidebarShown ? `calc(100% - ${sidebarWidth}px)` : null }"
:style="{ width: isSidebarShown ? `${sidebarPosition}px` : null }"
:title="currentFile.basename"
:view="currentFile.modal"
class="viewer"
Expand Down Expand Up @@ -226,7 +226,7 @@ export default {
cancelRequestFolder: () => {},
// Flags
sidebarWidth: 0,
sidebarPosition: 0,
isSidebarShown: false,
canSwipe: true,
isStandalone: !(OCA && OCA.Files && 'fileActions' in OCA.Files),
Expand Down Expand Up @@ -928,21 +928,21 @@ export default {
this.isSidebarShown = true
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarWidth = sidebar.offsetWidth
this.sidebarPosition = sidebar.getBoundingClientRect().left
this.trapElements = [sidebar]
}
this.updateSidebarPosition()
},
handleAppSidebarClose() {
this.isSidebarShown = false
this.trapElements = []
},
onResize(event) {
// update sidebar width
onResize() {
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarWidth = sidebar.offsetWidth
this.sidebarPosition = sidebar.getBoundingClientRect().left
}
},
Expand Down

0 comments on commit 7a7a556

Please sign in to comment.