From: stephen@cubedesigners.com Date: Mon, 18 Sep 2017 13:03:43 +0000 (+0000) Subject: Tidy up compiler and merge performance fix from master branch. WIP #1653 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ef6bec1fac51861152ad210cc780e48aeb15ad5c;p=cubeextranet.git Tidy up compiler and merge performance fix from master branch. WIP #1653 @1.5 --- diff --git a/inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php b/inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php index d9a1b7435..cbee4239b 100644 --- a/inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php @@ -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) { diff --git a/inc/ws/Util/html5/burgermenu/class.ws.html5.links.php b/inc/ws/Util/html5/burgermenu/class.ws.html5.links.php index bdc44552b..13b67d2c0 100644 --- a/inc/ws/Util/html5/burgermenu/class.ws.html5.links.php +++ b/inc/ws/Util/html5/burgermenu/class.ws.html5.links.php @@ -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),