]> _ Git - cubeextranet.git/commitdiff
wip #3712 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Jun 2020 16:03:23 +0000 (16:03 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Jun 2020 16:03:23 +0000 (16:03 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index 66b81f54cd1c56b1b0097467dbf0be99452bc811..593c2d12fed1cbdcdcf69ae944d4c9a70bf86894 100644 (file)
@@ -1863,8 +1863,11 @@ class zoomLink extends normalLink
     public function generateImage()
     {
 
-        $maxzoom = ((int)$this->to !== 0) ? $this->to : $this->maxzoom_default; // Max zoom level might not always be set in the link editor
-        $maxzoom = min($maxzoom, 4.166666667);
+        $maxzoom = $this->getZoomAttributes()['maxzoom']; // Max zoom level might not always be set in the link editor
+        $maxzoom = max(2, min($maxzoom, 4.166666667));
+        if(!$maxzoom){
+            $maxzoom=2;
+        }
 
         // TODO: Consider generating higher-res images (eg. 2x) for HiDPI screens. Maybe some extra optimisations can be done on the larger images...
 
@@ -1941,6 +1944,8 @@ class zoomLink extends normalLink
 
 class zoomProductLink extends zoomLink
 {
+    protected $maxzoom_default = 2.5;
+
     public function __construct($id, $init, &$compiler)
     {
         $init['group'] = $init['to'];
@@ -1951,9 +1956,9 @@ class zoomProductLink extends zoomLink
     {
         $url = isset($this->compiler->config->product_zoom_references[$this->to]) ? $this->compiler->config->product_zoom_references[$this->to] : '';
 
-        $res = array_merge(parent::getZoomAttributes(),
-            ['maxzoom' => $this->maxzoom_default, 'ref' => $this->to]
-        );
+        $res = parent::getZoomAttributes();
+        $res['maxzoom'] = $this->maxzoom_default;
+        $res['ref'] = $this->to;
         if ($url) {
             $res['shareurl'] = $url[0];
             $n = count($url);
@@ -1966,6 +1971,7 @@ class zoomProductLink extends zoomLink
 
         return $res;
     }
+
 }