From: Vincent Vanwaelscappel Date: Wed, 15 Nov 2023 08:40:54 +0000 (+0100) Subject: wait #6422 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b6b0118078cb4d04fe1340d69c98acbe901801a2;p=fluidbook_tools.git wait #6422 @0.5 --- diff --git a/src/Links/LayerLink.php b/src/Links/LayerLink.php index 68a5ea6..270229f 100644 --- a/src/Links/LayerLink.php +++ b/src/Links/LayerLink.php @@ -4,15 +4,18 @@ namespace Fluidbook\Tools\Links; use Illuminate\Support\Facades\Log; -class LayerLink extends ImageLink { +class LayerLink extends ImageLink +{ protected $maxzoom_default = 4; public $defaultZIndex = 30; - public function ignore() { + public function ignore() + { return parent::ignore() || $this->isOutsidePage(); } - public function __construct($id, $init, &$compiler) { + public function __construct($id, $init, &$compiler) + { if ($init['to'] === 'text' || $init['to'] === 'onlytext') { $this->defaultZIndex++; } @@ -22,24 +25,28 @@ class LayerLink extends ImageLink { /** * @throws \Exception */ - public function getCSS() { + public function getCSS() + { $attributes = $this->getZoomAttributes(); if (!$this->rightClone) { ZoomLink::generateImage($attributes, $this->compiler, 'layerlink', 'layer'); } } - public function getAdditionnalContent() { + public function getAdditionnalContent() + { $res = parent::getAdditionnalContent(); $res .= ' data-layer="' . $this->to . '"'; return $res; } - public function getImageUrl() { + public function getImageUrl() + { return 'data/links/layer_' . $this->uid . '.' . $this->_getExtension(); } - protected function _getExtension() { + protected function _getExtension() + { if ($this->_getLayer() === 'text' || $this->_getLayer() === 'onlytext' || $this->_getLayer() === 'bothsvg') { return 'svg'; } else { @@ -47,12 +54,15 @@ class LayerLink extends ImageLink { } } - protected function _getLayer() { + protected function _getLayer() + { return $this->to ?: 'both'; } - public function getZoomAttributes() { + public function getZoomAttributes() + { $layer = $this->_getLayer(); + return [ 'id' => $this->uid, 'page' => $this->page,