$this->log('Got data from database');
- $this->width = round($size[0], 3);
- $this->height = round($size[1], 3);
+ $this->width = round($size[0], 8);
+ $this->height = round($size[1], 8);
wsDocument::makeHTML5FilesIfNotExists($this->pages[1]['document_id'], $this->pages[1]['document_page']);
$firstJpeg = wsDocument::getDir($this->pages[1]['document_id']) . 'html/h150-' . $this->pages[1]['document_page'] . '.jpg';
$imagesize = CubeIT_Image::getimagesize($firstJpeg);
- $this->pdf2htmlRatio = round(($imagesize[0] * 0.48) / $this->width, 8);
+ $this->pdf2htmlRatio = round(($imagesize[0] * 0.48) / $this->width, 12);
$this->linkScale = $this->cssScale = $this->z * min($this->optimalWidth / $this->width, $this->optimalHeight / $this->height);
$this->cssOneScale = $this->z * min(($this->optimalWidth * 2) / $this->width, $this->optimalHeight / $this->height);
$this->numerotation = explode(',', $this->book->numerotation);
- if ($this->book->parametres->mobileNavigationType === 'mobilefirst') {
+ if ($this->isMobileFirst()) {
$this->cssScale = $this->cssOneScale = 480 / $this->width;
$this->linkScale = $this->cssScale;
$this->cssOneWidth = $this->cssWidth = $this->width * $this->cssScale;
$this->initMobileFirst();
}
- if ($this->book->parametres->zoomMode == 1 || $this->book->parametres->mobileNavigationType === 'mobilefirst') {
+ if ($this->book->parametres->zoomMode == 1 || $this->isMobileFirst()) {
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssOneScale;
} else {
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale;
$this->log('Defined dimensions');
}
+ public function isMobileFirst()
+ {
+ return $this->book->parametres->mobileNavigationType === 'mobilefirst';
+ }
+
public function initMobileFirst()
{
$this->theme->parametres->usePageEdges = false;
protected function writeImages()
{
global $core;
+ $daoDoc = new wsDAODocument($core->con);
switch ($this->book->parametres->mobileVersion) {
case 'html5-desktop':
}
$source = $docdir . $imdir . '/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg';
if ($r == 150 && file_exists($source)) {
- $d = getimagesize($source);
+ $firstDoc = $daoDoc->selectById($infos['document_id']);
+ $d = $firstDoc->generalInfos['page'][$infos['document_page']]['size'];
$this->config->pagesDimensions[$page] = array($this->cssWidth, $d[1] * ($this->cssWidth / $d[0]));
}
$ok = $this->vdir->copy($source, 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
$lessVariables['z'] = $this->z;
$lessVariables['book-page-width'] = $w;
- if ($this->book->parametres->correctCenter) {
+ if ($this->book->parametres->correctCenter && !$this->isMobileFirst()) {
$lessVariables['book-page-correct-width'] = ceil($w) + 1;
$lessVariables['book-page-correct-height'] = ceil($h) + 1;
} else {
$lessVariables['display-page-number'] = $this->_lessBoolean($this->theme->parametres->displayPageNumber);
$lessVariables['page-transition-duration'] = $this->book->parametres->mobileTransitionDuration . 's';
+ $corrText = $this->isMobileFirst() ? 0 : 4;
+
if ($this->cssSVGScale != 1) {
$texts = '.texts{' . wsHTML5::writeCSSUA('transform-origin', 'top left') . ';';
$texts .= wsHTML5::writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';';
$texts .= 'height:' . ($hm / $this->cssSVGScale) . 'px; max-height:' . ($hm / $this->cssSVGScale) . 'px;';
$texts .= '}';
} else {
- $texts = '.texts{width:' . floor(floatval($w) + 4) . 'px;height:' . floor(floatval($h) + 4) . 'px;}';
+ $texts = '.texts{width:' . floor(floatval($w) + $corrText) . 'px;height:' . floor(floatval($h) + $corrText) . 'px;}';
}
$res[] = $texts;