Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix taking sidebar position in fullscreen mode #1711

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions js/viewer-filerobot.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-filerobot.js.map

Large diffs are not rendered by default.

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.

15 changes: 9 additions & 6 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ export default {

methods: {
beforeOpen() {
this.takeSidebarPosition()

// initial loading start
this.initiated = true

Expand Down Expand Up @@ -945,10 +947,14 @@ export default {
this.nextFile.failed = true
},

takeSidebarPosition() {
ShGKme marked this conversation as resolved.
Show resolved Hide resolved
const sidebarElement = document.querySelector('aside.app-sidebar')
this.sidebarPosition = sidebarElement?.getBoundingClientRect().left
},

/**
* Show the sharing sidebar
*/

async showSidebar() {
// Open the sidebar sharing tab
// TODO: also hide figure, needs a proper method for it in server Sidebar
Expand All @@ -960,9 +966,9 @@ export default {

handleAppSidebarOpen() {
this.isSidebarShown = true
this.takeSidebarPosition()
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarPosition = sidebar.getBoundingClientRect().left
this.trapElements = [sidebar]
}
},
Expand All @@ -983,10 +989,7 @@ export default {
},

onResize() {
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarPosition = sidebar.getBoundingClientRect().left
}
this.takeSidebarPosition()
},

async onDelete() {
Expand Down
Loading