]> git.parisson.com Git - pdf.js.git/commitdiff
Re-order the zoom options, add actual size option.
authorBrendan Dahl <brendan.dahl@gmail.com>
Wed, 25 Apr 2012 22:55:11 +0000 (15:55 -0700)
committerBrendan Dahl <brendan.dahl@gmail.com>
Wed, 25 Apr 2012 22:55:11 +0000 (15:55 -0700)
web/viewer.css
web/viewer.html
web/viewer.js

index c1738386646c12b84717c4ebc4b419f510eed7bc..576207ae96258a0ba77808b35e419989681cfdfd 100644 (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;
index c89e982b614d84a68f57bcab4b0a94acf51a5aa3..4ddf257560927dd5ef88f0adeb207d94f302446f 100644 (file)
                   </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>
                       <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>
index 5b7aea3998af99852a9fb7b802199ea68ebec008..05f8974a2ac2f410e36668cece171fa2eaab1a15 100644 (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();
     });