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

This commit is contained in:
Brendan Dahl 2012-04-25 15:55:11 -07:00
parent 0d248a05a1
commit 3d43576838
3 changed files with 36 additions and 18 deletions

View File

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

View File

@ -90,6 +90,10 @@
</div>
<span class="dropdownToolbarButton">
<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 value="0.5">50%</option>
<option value="0.75">75%</option>
@ -97,9 +101,6 @@
<option value="1.25">125%</option>
<option value="1.5">150%</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>
</span>
</div>

View File

@ -259,27 +259,37 @@ var PDFView = {
currentPage.width * currentPage.scale / kCssUnits;
var pageHeightScale = (container.clientHeight - kScrollbarPadding) /
currentPage.height * currentPage.scale / kCssUnits;
if ('page-width' == value)
this.setScale(pageWidthScale, resetAutoSettings);
if ('page-height' == value)
this.setScale(pageHeightScale, resetAutoSettings);
if ('page-fit' == value) {
this.setScale(
Math.min(pageWidthScale, pageHeightScale), resetAutoSettings);
switch (value) {
case 'page-actual':
this.setScale(1, resetAutoSettings);
break;
case 'page-width':
this.setScale(pageWidthScale, 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);
},
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);
},
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);
},
@ -1345,7 +1355,6 @@ window.addEventListener('load', function webViewerLoad(evt) {
document.getElementById('sidebarToggle').addEventListener('click',
function() {
this.classList.toggle('toggled');
console.log('toggling');
document.getElementById('outerContainer').classList.toggle('sidebarOpen');
updateThumbViewArea();
});