]> _ Git - cubeextranet.git/commitdiff
wip #5299 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 30 May 2022 14:45:42 +0000 (14:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 30 May 2022 14:45:42 +0000 (14:45 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index a99e6fc750eb1197d00633f7977ea0632571cdc9..1ba33f13cf73bec391253759ebdda55fc21ef5ce 100644 (file)
@@ -1744,7 +1744,7 @@ class remarkableCartLink extends cartLink
 
 class layerLink extends imageLink
 {
-    protected $maxzoom_default = 4;
+    protected $maxzoom_default = 2;
     public $defaultZIndex = 31;
 
     public function ignore()
@@ -1758,20 +1758,20 @@ class layerLink extends imageLink
         if (!$this->rightClone) {
             zoomLink::generateImage($attributes, $this->compiler, 'layerlink', 'layer');
         }
-        return 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
     }
 
     public function getImageUrl()
     {
-        return '../links/layer_' . $this->uid . '.jpg';
+        return 'data/links/layer_' . $this->uid . '.jpg';
     }
 
     public function getZoomAttributes()
     {
+        $z = $this->maxzoom_default * $this->compiler->getCssScale();
         return [
             'id' => $this->uid,
             'page' => $this->page,
-            'maxzoom' => $this->maxzoom_default,
+            'maxzoom' => $z,
             'width' => round($this->width),
             'height' => round($this->height),
             'x' => round($this->left),
@@ -1858,33 +1858,9 @@ class imageLink extends contentLink
     {
         $res = parent::getCSS();
         $this->copyExternalFile($this->to);
-        $res .= 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
         return $res;
     }
 
-    public function getBackgroundPosition()
-    {
-        $animations = self::parseAnimations($this->image_rollover);
-        foreach ($animations as $animation) {
-            if (($animation['type'] === 'zoomout' || $animation['type'] === 'zoomin') && isset($animation['transformorigin'])) {
-                return $animation['transformorigin'];
-            }
-        }
-        return '50% 50%';
-    }
-
-    public function getBackgroundSize()
-    {
-        $size = '100%';
-        $animations = self::parseAnimations($this->image_rollover);
-        foreach ($animations as $animation) {
-            if ($animation['type'] === 'zoomout') {
-                $size = round($animation['scale'] * 100) . '%';
-            }
-        }
-        return $size . ' ' . $size;
-    }
-
     public function getAdditionnalContent()
     {
         $res = parent::getAdditionnalContent();
@@ -1893,6 +1869,10 @@ class imageLink extends contentLink
         return $res;
     }
 
+    public function getHTMLContent()
+    {
+        return '<img src="' . $this->getImageUrl() . '" />';
+    }
 }
 
 class inlineSlideshowLink extends slideshowLink
@@ -2819,7 +2799,7 @@ class zoomLink extends normalLink
     {
 
         $maxzoom = $attributes['maxzoom']; // Max zoom level might not always be set in the link editor
-        $maxzoom = max(2, min($maxzoom, 4.166666667));
+        $maxzoom = max(1, min($maxzoom, 4.166666667));
         if (!$maxzoom) {
             $maxzoom = 2;
         }
@@ -2830,7 +2810,7 @@ class zoomLink extends normalLink
             // 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
             // factor by setting the resolution to 72 * $maxzoom
-            'resolution' => 150 * $maxzoom
+            'resolution' => round(150 * $maxzoom)
         ];
 
         // Round all link co-ordinates because there seems to be a problem with the the Workshop link editor