]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 11 Oct 2011 08:08:23 +0000 (08:08 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 11 Oct 2011 08:08:23 +0000 (08:08 +0000)
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/html5/class.ws.html5.links.php

index e73063fa62c8169377341a159fdd936420f1db53..58436a52d3d936fec41d35d8781605293bdc79e2 100644 (file)
@@ -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);
index 489a667306223b0a53b7530440ddbe7d88518717..25cf6880634663e62c06b05456f35a63d1698525 100644 (file)
@@ -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 = '<video width="' . $w . '" height="' . $h . '"';
                if ($this->video_auto_start) {
@@ -245,7 +245,7 @@ class webVideoLink extends videoLink {
        }
 
        public function getEmbed() {
-               return '<iframe width="' . $this->width*$this->compiler->cssScale . '" height="' . $this->height*$this->compiler->cssScale . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
+               return '<iframe width="' . $this->width*$this->compiler->getCssScale() . '" height="' . $this->height*$this->compiler->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
        }
 
        public function getEmbedURL() {
@@ -304,7 +304,7 @@ class fileLink extends normalLink {
 class multimediaLink extends wsHTML5Link {
 
        public function getHTMLContent() {
-               return cubeMedia::flashObject(wsHTML5Link::getUniversalLocation($this->to), $this->width*$this->compiler->cssScale, $this->height*$this->compiler->cssScale, array(), '', '', 9, '#ffffff', '', 'true', 'noscale', 'transparent');
+               return cubeMedia::flashObject(wsHTML5Link::getUniversalLocation($this->to), $this->width*$this->compiler->getCssScale(), $this->height*$this->compiler->getCssScale(), array(), '', '', 9, '#ffffff', '', 'true', 'noscale', 'transparent');
        }
 
 }