Merge pull request #1179 from gigaherz/sidebar-pinning

Implement sidebar pinning
This commit is contained in:
notmasteryet 2012-02-13 19:07:05 -08:00
commit 27b9ae79ee
6 changed files with 31 additions and 6 deletions

View File

@ -65,6 +65,7 @@ MIMEs = {
'.pdf': 'application/pdf',
'.xhtml': 'application/xhtml+xml',
'.ico': 'image/x-icon',
'.png': 'image/png',
'.log': 'text/plain'
}

BIN
web/images/pin_down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
web/images/pin_up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -89,7 +89,8 @@ span#info {
z-index: 1;
}
#sidebar:hover {
#sidebar:hover,
#sidebar.pinned {
left: 0px;
transition: left 0.25s ease-in-out 0s;
-o-transition: left 0.25s ease-in-out 0s;
@ -97,6 +98,24 @@ span#info {
-webkit-transition: left 0.25s ease-in-out 0s;
}
#pinIcon {
position: absolute;
top: 4px;
right: 55px;
width: 15px;
height: 15px;
background: center no-repeat;
background-image: url('images/pin_up.png');
}
#pinIcon:hover {
background-color: rgba(255,255,255,0.35);
}
#sidebar.pinned #pinIcon {
background-image: url('images/pin_down.png');
}
#sidebarBox {
background-color: rgba(0, 0, 0, 0.7);
width: 300px;
@ -116,7 +135,7 @@ span#info {
position: absolute;
overflow: hidden;
overflow-y: auto;
top: 10px;
top: 20px;
bottom: 10px;
left: 10px;
width: 280px;
@ -147,7 +166,7 @@ span#info {
position: absolute;
background-color: #fff;
overflow: auto;
top: 10px;
top: 20px;
bottom: 10px;
left: 10px;
width: 280px;
@ -381,6 +400,6 @@ canvas {
}
#loading {
margin: 100px 0;
text-align: center;
margin: 100px 0;
text-align: center;
}

View File

@ -122,6 +122,7 @@
<div id="sidebar">
<div id="sidebarBox">
<div id="pinIcon" onClick="PDFView.pinSidebar()"></div>
<div id="sidebarScrollView">
<div id="sidebarView"></div>
</div>
@ -136,7 +137,7 @@
<img src="images/nav-outline.svg" align="top" height="16" alt="Document Outline" />
</button>
</div>
</div>
</div>
</div>
<div id="loading">Loading... 0%</div>

View File

@ -571,6 +571,10 @@ var PDFView = {
}
},
pinSidebar: function pdfViewPinSidebar() {
document.getElementById('sidebar').classList.toggle('pinned');
},
getVisiblePages: function pdfViewGetVisiblePages() {
var pages = this.pages;
var kBottomMargin = 10;