Skip to content

Commit c002a26

Browse files
committed
fix(Viewer): fix taking sidebar position in fullscreen mode
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 195bf9c commit c002a26

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

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: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -941,24 +941,30 @@ export default {
941941
this.nextFile.failed = true
942942
},
943943
944+
takeSidebarPosition() {
945+
const sidebarElement = document.querySelector('aside.app-sidebar')
946+
this.sidebarPosition = sidebarElement?.getBoundingClientRect().left
947+
},
948+
944949
/**
945950
* Show the sharing sidebar
946951
*/
947-
948952
async showSidebar() {
949953
// Open the sidebar sharing tab
950954
// TODO: also hide figure, needs a proper method for it in server Sidebar
951-
952955
if (OCA?.Files?.Sidebar) {
953956
await OCA.Files.Sidebar.open(this.sidebarOpenFilePath)
957+
// If OCA.Files.Sidebar has isFullScreenMode on, the sidebar is moved only after file loading
958+
// So we need to take its new position after the loading
959+
this.takeSidebarPosition()
954960
}
955961
},
956962
957963
handleAppSidebarOpen() {
958964
this.isSidebarShown = true
965+
this.takeSidebarPosition()
959966
const sidebar = document.querySelector('aside.app-sidebar')
960967
if (sidebar) {
961-
this.sidebarPosition = sidebar.getBoundingClientRect().left
962968
this.trapElements = [sidebar]
963969
}
964970
},
@@ -969,10 +975,7 @@ export default {
969975
},
970976
971977
onResize() {
972-
const sidebar = document.querySelector('aside.app-sidebar')
973-
if (sidebar) {
974-
this.sidebarPosition = sidebar.getBoundingClientRect().left
975-
}
978+
this.takeSidebarPosition()
976979
},
977980
978981
async onDelete() {

0 commit comments

Comments
 (0)