Browse Source

Re-order the zoom options, add actual size option.

Brendan Dahl 13 years ago
parent
commit
3d43576838
  1. 14
      web/viewer.css
  2. 7
      web/viewer.html
  3. 33
      web/viewer.js

14
web/viewer.css

@ -304,8 +304,8 @@ body {
} }
.dropdownToolbarButton { .dropdownToolbarButton {
min-width: 100px; min-width: 120px;
max-width: 100px; max-width: 120px;
overflow: hidden; overflow: hidden;
background: url(images/toolbarButton-menuArrows.png) no-repeat 95%; background: url(images/toolbarButton-menuArrows.png) no-repeat 95%;
} }
@ -313,7 +313,7 @@ body {
.dropdownToolbarButton > select { .dropdownToolbarButton > select {
-moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */ -moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */
-webkit-appearance: none; -webkit-appearance: none;
min-width: 120px; min-width: 140px;
font-size: 12px; font-size: 12px;
color: hsl(0,0%,95%); color: hsl(0,0%,95%);
margin:0; margin:0;
@ -322,6 +322,14 @@ body {
background: transparent; background: transparent;
} }
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, .5) solid;
}
.splitToolbarButton:first-child, .splitToolbarButton:first-child,
.toolbarButton:first-child { .toolbarButton:first-child {
margin-left: 4px; margin-left: 4px;

7
web/viewer.html

@ -90,6 +90,10 @@
</div> </div>
<span class="dropdownToolbarButton"> <span class="dropdownToolbarButton">
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;"> <select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;">
<option id="pageAutoOption" value="auto" selected="selected">Automatic Zoom</option>
<option value="page-actual">Actual Size</option>
<option id="pageFitOption" value="page-fit">Fit Page</option>
<option id="pageWidthOption" value="page-width">Full Width</option>
<option id="customScaleOption" value="custom"></option> <option id="customScaleOption" value="custom"></option>
<option value="0.5">50%</option> <option value="0.5">50%</option>
<option value="0.75">75%</option> <option value="0.75">75%</option>
@ -97,9 +101,6 @@
<option value="1.25">125%</option> <option value="1.25">125%</option>
<option value="1.5">150%</option> <option value="1.5">150%</option>
<option value="2">200%</option> <option value="2">200%</option>
<option id="pageWidthOption" value="page-width">Page Width</option>
<option id="pageFitOption" value="page-fit">Page Fit</option>
<option id="pageAutoOption" value="auto" selected="selected">Auto</option>
</select> </select>
</span> </span>
</div> </div>

33
web/viewer.js

@ -259,27 +259,37 @@ var PDFView = {
currentPage.width * currentPage.scale / kCssUnits; currentPage.width * currentPage.scale / kCssUnits;
var pageHeightScale = (container.clientHeight - kScrollbarPadding) / var pageHeightScale = (container.clientHeight - kScrollbarPadding) /
currentPage.height * currentPage.scale / kCssUnits; currentPage.height * currentPage.scale / kCssUnits;
if ('page-width' == value) switch (value) {
this.setScale(pageWidthScale, resetAutoSettings); case 'page-actual':
if ('page-height' == value) this.setScale(1, resetAutoSettings);
this.setScale(pageHeightScale, resetAutoSettings); break;
if ('page-fit' == value) { case 'page-width':
this.setScale( this.setScale(pageWidthScale, resetAutoSettings);
Math.min(pageWidthScale, pageHeightScale), resetAutoSettings); break;
case 'page-height':
this.setScale(pageHeightScale, resetAutoSettings);
break;
case 'page-fit':
this.setScale(
Math.min(pageWidthScale, pageHeightScale), resetAutoSettings);
break;
case 'auto':
this.setScale(Math.min(1.0, pageWidthScale), resetAutoSettings);
break;
} }
if ('auto' == value)
this.setScale(Math.min(1.0, pageWidthScale), resetAutoSettings);
selectScaleOption(value); selectScaleOption(value);
}, },
zoomIn: function pdfViewZoomIn() { zoomIn: function pdfViewZoomIn() {
var newScale = Math.min(kMaxScale, this.currentScale * kDefaultScaleDelta); var newScale = (this.currentScale * kDefaultScaleDelta).toFixed(2);
newScale = Math.min(kMaxScale, newScale);
this.parseScale(newScale, true); this.parseScale(newScale, true);
}, },
zoomOut: function pdfViewZoomOut() { zoomOut: function pdfViewZoomOut() {
var newScale = Math.max(kMinScale, this.currentScale / kDefaultScaleDelta); var newScale = (this.currentScale / kDefaultScaleDelta).toFixed(2);
newScale = Math.max(kMinScale, newScale);
this.parseScale(newScale, true); this.parseScale(newScale, true);
}, },
@ -1345,7 +1355,6 @@ window.addEventListener('load', function webViewerLoad(evt) {
document.getElementById('sidebarToggle').addEventListener('click', document.getElementById('sidebarToggle').addEventListener('click',
function() { function() {
this.classList.toggle('toggled'); this.classList.toggle('toggled');
console.log('toggling');
document.getElementById('outerContainer').classList.toggle('sidebarOpen'); document.getElementById('outerContainer').classList.toggle('sidebarOpen');
updateThumbViewArea(); updateThumbViewArea();
}); });

Loading…
Cancel
Save