Fixing #426 comment; add '0' key as a scale reset
This commit is contained in:
parent
9f765f052e
commit
865a6e663a
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -34,12 +34,14 @@
|
|||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<button id="next" title="Zoom Out" onclick="PDFView.zoomOut();">
|
<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>
|
||||||
<button id="next" title="Zoom In" onclick="PDFView.zoomIn();">
|
<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>
|
</button>
|
||||||
|
|
||||||
|
<div class="separator"></div>
|
||||||
|
|
||||||
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);">
|
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);">
|
||||||
<option id="customScaleOption" value="custom"></option>
|
<option id="customScaleOption" value="custom"></option>
|
||||||
<option value="0.5">50%</option>
|
<option value="0.5">50%</option>
|
||||||
|
@ -45,13 +45,14 @@ var PDFView = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
parseScale: function(value) {
|
parseScale: function(value) {
|
||||||
|
if ('custom' == value)
|
||||||
|
return;
|
||||||
|
|
||||||
var scale = parseFloat(value);
|
var scale = parseFloat(value);
|
||||||
if (scale) {
|
if (scale) {
|
||||||
this.setScale(scale, true);
|
this.setScale(scale, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ('custom' == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var currentPage = this.pages[this.page - 1];
|
var currentPage = this.pages[this.page - 1];
|
||||||
var scrollbarPadding = 40;
|
var scrollbarPadding = 40;
|
||||||
@ -493,7 +494,7 @@ window.addEventListener('scalechange', function scalechange(evt) {
|
|||||||
var value = '' + evt.scale;
|
var value = '' + evt.scale;
|
||||||
for (var i = 0; i < options.length; i++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
var option = options[i];
|
var option = options[i];
|
||||||
if (option.value != evt.scale) {
|
if (option.value != value) {
|
||||||
option.selected = false;
|
option.selected = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -517,16 +518,19 @@ window.addEventListener('pagechange', function pagechange(evt) {
|
|||||||
document.getElementById('next').disabled = (page == PDFView.pages.length);
|
document.getElementById('next').disabled = (page == PDFView.pages.length);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
window.addEventListener('keydown', function (evt) {
|
window.addEventListener('keydown', function keydown(evt) {
|
||||||
switch(evt.keyCode) {
|
switch(evt.keyCode) {
|
||||||
case 61: // '+' and '=' keys
|
case 61: // FF/Mac '='
|
||||||
case 107:
|
case 107: // FF '+' and '='
|
||||||
case 187:
|
case 187: // Chrome '+'
|
||||||
PDFView.zoomIn();
|
PDFView.zoomIn();
|
||||||
break;
|
break;
|
||||||
case 109: // '-' keys
|
case 109: // FF '-'
|
||||||
case 189:
|
case 189: // Chrome '-'
|
||||||
PDFView.zoomOut();
|
PDFView.zoomOut();
|
||||||
break;
|
break;
|
||||||
|
case 48: // '0'
|
||||||
|
PDFView.setScale(kDefaultScale, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user