]> _ Git - cubeextranet.git/commitdiff
Tidy up compiler and merge performance fix from master branch. WIP #1653 @1.5
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Sep 2017 13:03:43 +0000 (13:03 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Sep 2017 13:03:43 +0000 (13:03 +0000)
inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php
inc/ws/Util/html5/burgermenu/class.ws.html5.links.php

index d9a1b7435be3cec9cbb568e5a3756efd1cd45114..cbee4239b64847d32dcf198da7a3fd605bdf56b9 100644 (file)
@@ -1161,9 +1161,12 @@ class wsHTML5Compiler {
                        if ($page == 1) {
                                $this->_makeCover($docdir . 'html/t36-' . $infos['document_page'] . '.jpg');
                        }
-                       $this->makeThumbSprites($thumbs);
+
                        $this->log('Copied image ' . $page);
                }
+
+               $this->makeThumbSprites($thumbs);
+               $this->log('Made thumbnails');
        }
 
        public function makeThumbSprites(array $thumbs) {
index bdc44552bc0b9267a5bc012f1cb75835d6064205..13b67d2c0d52cbce59331b69957bdc47bb11de01 100644 (file)
@@ -262,8 +262,8 @@ class wsHTML5Link {
                }
 
                $css = '#l_' . $this->id . '{';
-               $css .= 'left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;';
-               $css .= 'width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;';
+               $css .= 'left:' . round($this->left * $this->getCssScale()) . 'px;top:' . round($this->top * $this->getCssScale()) . 'px;';
+               $css .= 'width:' . round($this->width * $this->getCssScale()) . 'px;height:' . round($this->height * $this->getCssScale()) . 'px;';
                $origin = false;
                if ($this->rot) {
                        $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)');
@@ -1241,9 +1241,11 @@ class zoomLink extends normalLink {
        }
 
        public function generateImage() {
-               $left = CubeIT_Files::tempnam();
 
-               $maxzoom = $this->to;
+               $maxzoom = ((int)$this->to !== 0) ? $this->to : 2; // Max zoom level might not always be set in the link editor
+
+        // TODO: Consider generating higher-res images (eg. 2x) for HiDPI screens. Maybe some extra optimisations can be done on the larger images...
+
                $extractOptions = [
                    // The Poppler::extractArea function accepts a resolution setting and uses that to determine the
             // scale factor on the extracted images. It does so by dividing by 72, so we can pass our own scale
@@ -1265,6 +1267,7 @@ class zoomLink extends normalLink {
                $p = wsDAOBook::getDocumentPage($this->compiler->book_id, $this->page);
                $pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf';
 
+        $left = CubeIT_Files::tempnam();
                $leftfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
                        $p['document_page'],
                        array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h),