Skip to content

Commit

Permalink
Hide toolbar on viewer launch
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Oct 14, 2024
1 parent 2acb22a commit 4adb279
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions dev/editviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.replace('''<link rel="stylesheet" href="viewer.css">''', '''<link rel="stylesheet" href="viewer.css">\n <link rel="stylesheet" href="latexworkshop.css">''')
.replace('''<script src="../build/pdf.mjs" type="module"></script>''', '''<script src="build/pdf.mjs" type="module"></script>''')
.replace('''<script src="viewer.mjs" type="module"></script>''', '''<script src="out/viewer/latexworkshop.js" type="module"></script>''')
.replace('''<div class="toolbar">''', '''<div class="toolbar hide">''')
.replace('''<div class="toolbarButtonSpacer"></div>''', '''<!-- <div class="toolbarButtonSpacer"></div> -->''')
)

Expand Down
13 changes: 7 additions & 6 deletions viewer/components/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ export async function patchViewerUI() {
const params = await utils.getParams()

if (params.toolbar === 0) {
const containerDom = document.getElementById('viewerContainer')!
containerDom.style.top = '32px'
document.getElementsByClassName('toolbar')[0]?.classList.remove('hide')
document.getElementById('viewerContainer')!.style.top = '32px'
}

document.getElementById('outerContainer')!.onmouseleave = () => { hideToolbar(params) }
document.getElementById('outerContainer')!.onmouseleave = () => {
if (params.toolbar !== 0) {
hideToolbar(params)
}
}

document.getElementById('outerContainer')!.onmousemove = (e) => {
if (params.toolbar === 0) {
Expand All @@ -54,9 +58,6 @@ export async function patchViewerUI() {

document.getElementById('sidebarResizer')?.classList.add('hidden')
document.getElementById('firstPage')?.previousElementSibling?.classList.add('visibleLargeView')
if (params.toolbar !== 0) {
document.getElementsByClassName('toolbar')[0]?.classList.add('hide')
}

const template = document.createElement('template')
template.innerHTML =
Expand Down
2 changes: 1 addition & 1 deletion viewer/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</div> <!-- sidebarContainer -->

<div id="mainContainer">
<div class="toolbar">
<div class="toolbar hide">
<div id="toolbarContainer">
<div id="toolbarViewer" class="toolbarHorizontalGroup">
<div id="toolbarViewerLeft" class="toolbarHorizontalGroup">
Expand Down

0 comments on commit 4adb279

Please sign in to comment.