Skip to content

Commit 1c7394c

Browse files
ShGKmenextcloud-command
authored andcommitted
fix: use left position of sidebar to set viewer width
Signed-off-by: Grigorii K. Shartsev <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 96b22b7 commit 1c7394c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
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/views/Viewer.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
:has-previous="hasPrevious"
5656
:inline-actions="canEdit ? 1 : 0"
5757
:spread-navigation="true"
58-
:style="{ width: isSidebarShown ? `calc(100% - ${sidebarWidth}px)` : null }"
58+
:style="{ width: isSidebarShown ? `${sidebarPosition}px` : null }"
5959
:title="currentFile.basename"
6060
:view="currentFile.modal"
6161
class="viewer"
@@ -219,7 +219,7 @@ export default {
219219
cancelRequestFolder: () => {},
220220
221221
// Flags
222-
sidebarWidth: 0,
222+
sidebarPosition: 0,
223223
isSidebarShown: false,
224224
canSwipe: true,
225225
isStandalone: !(OCA && OCA.Files && 'fileActions' in OCA.Files),
@@ -921,21 +921,21 @@ export default {
921921
this.isSidebarShown = true
922922
const sidebar = document.querySelector('aside.app-sidebar')
923923
if (sidebar) {
924-
this.sidebarWidth = sidebar.offsetWidth
924+
this.sidebarPosition = sidebar.getBoundingClientRect().left
925925
this.trapElements = [sidebar]
926926
}
927+
this.updateSidebarPosition()
927928
},
928929
929930
handleAppSidebarClose() {
930931
this.isSidebarShown = false
931932
this.trapElements = []
932933
},
933934
934-
onResize(event) {
935-
// update sidebar width
935+
onResize() {
936936
const sidebar = document.querySelector('aside.app-sidebar')
937937
if (sidebar) {
938-
this.sidebarWidth = sidebar.offsetWidth
938+
this.sidebarPosition = sidebar.getBoundingClientRect().left
939939
}
940940
},
941941

0 commit comments

Comments
 (0)