1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into zoom-bookmark

Conflicts:
	web/viewer.js
This commit is contained in:
notmasteryet 2011-09-05 15:54:54 -05:00
commit 9eac2e1c95
6 changed files with 78 additions and 72 deletions

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -34,12 +34,14 @@
<div class="separator"></div>
<button id="next" title="Zoom Out" onclick="PDFView.zoomOut();">
<img src="images/list-remove.svg" align="top" height="32"/>
<img src="images/zoom-out.svg" align="top" height="32"/>
</button>
<button id="next" title="Zoom In" onclick="PDFView.zoomIn();">
<img src="images/list-add.svg" align="top" height="32"/>
<img src="images/zoom-in.svg" align="top" height="32"/>
</button>
<div class="separator"></div>
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);">
<option id="customScaleOption" value="custom"></option>
<option value="0.5">50%</option>

View file

@ -47,13 +47,14 @@ var PDFView = {
},
parseScale: function(value, resetAutoSettings) {
if ('custom' == value)
return;
var scale = parseFloat(value);
if (scale) {
this.setScale(scale, true);
return;
}
if ('custom' == value)
return;
var currentPage = this.pages[this.page - 1];
var pageWidthScale = (window.innerWidth - kScrollbarPadding) /
@ -567,7 +568,7 @@ window.addEventListener('scalechange', function scalechange(evt) {
var value = '' + evt.scale;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.value != evt.scale) {
if (option.value != value) {
option.selected = false;
continue;
}
@ -591,16 +592,19 @@ window.addEventListener('pagechange', function pagechange(evt) {
document.getElementById('next').disabled = (page == PDFView.pages.length);
}, true);
window.addEventListener('keydown', function (evt) {
window.addEventListener('keydown', function keydown(evt) {
switch(evt.keyCode) {
case 61: // '+' and '=' keys
case 107:
case 187:
case 61: // FF/Mac '='
case 107: // FF '+' and '='
case 187: // Chrome '+'
PDFView.zoomIn();
break;
case 109: // '-' keys
case 189:
case 109: // FF '-'
case 189: // Chrome '-'
PDFView.zoomOut();
break;
case 48: // '0'
PDFView.setScale(kDefaultScale, true);
break;
}
});