]> _ Git - cubeextranet.git/commitdiff
Merge print improvements into master branch. Done #817 @2
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 5 Dec 2018 16:38:11 +0000 (16:38 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 5 Dec 2018 16:38:11 +0000 (16:38 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/printing/class.ws.html5.compiler.php

index bd43ced8d2e85943648262f5ec9164f1582ee347..171c6a8c93c7fbb917fc4ac2d9beac69991e8b3b 100644 (file)
@@ -77,6 +77,7 @@ class wsHTML5Compiler
                                'js/libs/fluidbook/menu/fluidbook.index.js',
                                'js/libs/fluidbook/fluidbook.landingpage.js',
                                'js/libs/fluidbook/fluidbook.slideshow.js',
+                               'js/libs/fluidbook/fluidbook.print.js',
                                'js/libs/fluidbook/fluidbook.js',
                                'js/main.js']
        ];
index e0b7bf31745988ce27ff70a1a79695dea853f166..171c6a8c93c7fbb917fc4ac2d9beac69991e8b3b 100644 (file)
@@ -1423,6 +1423,27 @@ class wsHTML5Compiler
                        $thisimagesvg = !$thisrasterize && $this->svg;
                        $thisbackgroundPrefix = $thisrasterize ? ['t'] : $this->backgroundsPrefix;
 
+                       foreach ($this->getResolutions() as $r) {
+                               foreach ($thisbackgroundPrefix as $backgroundsPrefix) {
+                                       $srcPrefix = $backgroundsPrefix;
+                                       if ($backgroundsPrefix == 'p') {
+                                               $srcPrefix = 'h';
+                                       }
+                                       $source = $docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg';
+                                       if (!file_exists($source)) {
+                                               if (!isset($doc) || $doc->document_id != $infos['document_id']) {
+                                                       $dao = new wsDAODocument($core->con);
+                                                       $doc = $dao->selectById($infos['document_id']);
+                                               }
+                                               $doc->makeHTML5Files($infos['document_page']);
+                                       }
+                                       $ok = $this->vdir->copy($source, 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
+                                       if (!$ok && $r = 300) {
+                                               $this->maxRes = 150;
+                                       }
+                               }
+                       }
+
                        if ($thisimagesvg) {
                                $full = $docdir . 'html/fp' . $infos['document_page'] . '.svg';
                                $fullopt = $docdir . 'html/fo' . $infos['document_page'] . '%s.svg';
@@ -1447,18 +1468,6 @@ class wsHTML5Compiler
                                }
                        }
 
-                       foreach ($this->getResolutions() as $r) {
-                               foreach ($thisbackgroundPrefix as $backgroundsPrefix) {
-                                       $srcPrefix = $backgroundsPrefix;
-                                       if ($backgroundsPrefix == 'p') {
-                                               $srcPrefix = 'h';
-                                       }
-                                       $ok = $this->vdir->copy($docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
-                                       if (!$ok && $r = 300) {
-                                               $this->maxRes = 150;
-                                       }
-                               }
-                       }
 
                        $thumb = false;
                        if ($this->book->parametres->pdfThumbnails) {
@@ -1599,9 +1608,17 @@ class wsHTML5Compiler
                $res[] = '.doublePage._2d.axis_y.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}';
                $res[] = '.doublePage._2d.axis_y.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}';
 
-               $res[] = '.doublePage._3d{left:' . $w . ';}';
-               $res[] = '#links.right{left:-' . $w . ';}';
-               $res[] = '.landscape .page.right{left:' . $w . '}';
+
+               $left = $w;
+               if ($this->book->parametres->correctCenter) {
+                       $centerOffset = 3;
+                       $left = ($cssWidth - $centerOffset) . 'px';
+                       $res[] = '.doublePage._3d .page.left{left:-' . ($centerOffset + 1) . 'px !important;}';
+               }
+
+               $res[] = '.doublePage._3d{left:' . $left . ';}';
+               $res[] = '#links.right{left:-' . $left . ';}';
+               $res[] = '.landscape .page.right{left:' . $left . '}';
 
                $lessVariables['page-number-color'] = wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber);
                $lessVariables['display-page-number'] = $this->_lessBoolean($this->theme->parametres->displayPageNumber);