From 036a4d8f808e33fd86bd76077a7d7f53f7445260 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 11 Oct 2011 08:08:23 +0000 Subject: [PATCH] --- inc/ws/Util/html5/class.ws.html5.compiler.php | 84 +++++++++++++------ inc/ws/Util/html5/class.ws.html5.links.php | 12 +-- 2 files changed, 64 insertions(+), 32 deletions(-) diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index e73063fa6..58436a52d 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -63,7 +63,9 @@ class wsHTML5Compiler { protected $height; protected $cssWidth; protected $cssHeight; - public $cssScale; + protected $cssOneWidth; + protected $cssOneHeight; + protected $cssScale; protected $optimalWidth = 567; protected $optimalHeight = 709; protected $additionalConfig = array(); @@ -112,14 +114,30 @@ class wsHTML5Compiler { $this->pdf2htmlRatio = round($imagesize[0] / $this->width, 2); $this->cssScale = min($this->optimalWidth / $this->width, $this->optimalHeight / $this->height); + $this->cssOneScale = min(($this->optimalWidth * 2) / $this->width, $this->optimalHeight / $this->height); $this->cssWidth = $this->width * $this->cssScale; $this->cssHeight = $this->height * $this->cssScale; + $this->cssOneWidth = $this->width * $this->cssOneScale; + $this->cssOneHeight = $this->height * $this->cssOneScale; + $this->scale = 10; - $this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale; + if ($this->book->parametres->zoomMode == 1) { + $this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssOneScale; + } else { + $this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale; + } $this->numerotation = explode(',', $this->book->numerotation); } + + public function getCssScale(){ + if($this->book->parametres->zoomMode==1){ + return $this->cssOneScale; + }else{ + return $this->cssScale; + } + } public function virtualToPhysical($virtual) { if (!in_array($virtual, $this->numerotation)) { @@ -535,35 +553,34 @@ class wsHTML5Compiler { $res = array(); // General theme - $h = $this->cssHeight . 'px'; - $w2 = ($this->cssWidth * 2) . 'px'; - $w = $this->cssWidth . 'px'; + + if ($this->book->parametres->zoomMode == '1') { + // Slideshow mode + $cssScale = $this->cssOneScale; + $cssWidth = $this->cssOneWidth; + $cssHeight = $this->cssOneHeight; + $w2 = ($cssWidth * 2) . 'px'; + } else { + // Normal mode + $cssWidth = $this->cssWidth; + $cssHeight = $this->cssHeight; + $cssScale = $this->cssScale; + $w2 = ($cssWidth * 2) . 'px'; + } + + $h = $cssHeight . 'px'; + $wm = ($this->width * $this->multiply) . 'px'; $hm = ($this->height * $this->multiply) . 'px'; - $offsetLeft = round(($this->optimalWidth - $this->cssWidth) / 2, 2); + $w = $cssWidth . 'px'; + $offsetLeft = round(($this->optimalWidth - $cssWidth) / 2, 2); $offsetLeft2 = $offsetLeft * 2; - $offsetTop = round(($this->optimalHeight - $this->cssHeight) / 2, 2); - - $navTop = ($this->cssHeight - 40 - 100) / 2; - - + $offsetTop = round(($this->optimalHeight - $cssHeight) / 2, 2); + $navTop = ($cssHeight - 40 - 100) / 2; $res[] = '#fluidbook{left:' . $offsetLeft . 'px;top:' . $offsetTop . 'px;}'; $res[] = '.landscape #fluidbook{left:' . $offsetLeft2 . 'px;}'; $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; - $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}'; - foreach (self::$resolutions as $r) { - $ratio = round(72 / $r, 2) * $this->cssScale; - $wr = $this->cssWidth / $ratio; - $hr = $this->cssHeight / $ratio; - - $br = '.background.r' . $r . '{'; - if ($ratio != 1) { - $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; - } - $br.='width:' . $wr . 'px;height:' . $hr . 'px;}'; - $res[] = $br; - } $res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.landscape #shadow.single.right{left: ' . $w . ';}'; $res[] = '.landscape .page.right{left:' . $w . '}'; @@ -574,8 +591,23 @@ class wsHTML5Compiler { $res[] = '#pagesnumbers{display:none;}'; } + + $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}'; + foreach (self::$resolutions as $r) { + $ratio = round(72 / $r, 2) * $cssScale; + + $wr = $cssWidth / $ratio; + $hr = $cssHeight / $ratio; + + $br = '.background.r' . $r . '{'; + if ($ratio != 1) { + $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; + } + $br.='width:' . $wr . 'px;height:' . $hr . 'px;}'; + $res[] = $br; + } $texts = '.texts{' . $this->writeCSSUA('transform-origin', 'top left') . ';'; - $texts.=$this->writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $this->cssScale, 2) . ')') . ';'; + $texts.=$this->writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale, 2) . ')') . ';'; $texts.='width:' . $wm . '; max-width:' . $wm . ';'; $texts.='height:' . $hm . '; max-height:' . $hm . ';'; $texts.='}'; @@ -872,7 +904,7 @@ class wsHTML5Compiler { } protected function getCSSSize($size) { - $os=$size; + $os = $size; $size = $this->normalizeFloatValue($size); $size*=$this->multiply; return $this->getIndex($size, $this->cssSize); diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 489a66730..25cf68806 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -91,8 +91,8 @@ class wsHTML5Link { public function getCSSContainer() { $css = '#link' . $this->id . '{'; - $css.='left:' . $this->left * $this->compiler->cssScale . 'px;top:' . $this->top * $this->compiler->cssScale . 'px;'; - $css.='width:' . $this->width * $this->compiler->cssScale . 'px;height:' . $this->height * $this->compiler->cssScale . 'px;'; + $css.='left:' . $this->left * $this->compiler->getCssScale() . 'px;top:' . $this->top * $this->compiler->getCssScale() . 'px;'; + $css.='width:' . $this->width * $this->compiler->getCssScale() . 'px;height:' . $this->height * $this->compiler->getCssScale() . 'px;'; $css.=$this->getCSS(); $css.='}'; return $css; @@ -197,8 +197,8 @@ class videoLink extends wsHTML5Link { $e = explode('.', $file); $ext = array_pop($e); $basename = implode('.', $e); - $w = round($this->width*$this->compiler->cssScale); - $h = round($this->height*$this->compiler->cssScale); + $w = round($this->width*$this->compiler->getCssScale()); + $h = round($this->height*$this->compiler->getCssScale()); $res = '