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>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
ShGKme authored and nextcloud-command committed May 4, 2023
1 parent 96b22b7 commit 1c7394c
Show file tree
Hide file tree
Showing 3 changed files with 9 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.

12 changes: 6 additions & 6 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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 @@ -219,7 +219,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 @@ -921,21 +921,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 1c7394c

Please sign in to comment.