From: Vincent Vanwaelscappel Date: Tue, 26 Aug 2025 15:29:06 +0000 (+0200) Subject: wait #7704 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4b50779b7ffc47e0778ffa4ebeac19ac6e8f19f1;p=fluidbook_tools.git wait #7704 @1 --- diff --git a/src/Links/LayerLink.php b/src/Links/LayerLink.php index be64ef8..cbc284f 100644 --- a/src/Links/LayerLink.php +++ b/src/Links/LayerLink.php @@ -16,10 +16,10 @@ class LayerLink extends ImageLink public function __construct($id, $init, &$compiler) { - if ($init['to'] === 'text' || $init['to'] === 'onlytext') { + if ($init['to'] === 'text' || $init['to'] === 'onlytext' || $init['to'] === 'textmask') { $this->defaultZIndex++; } - if ($init['to'] === 'text' && $compiler->config->transparentPage) { + if ($init['to'] === 'textmask') { $compiler->addMask('texts', $init['page'], ['x' => $init['left'], 'y' => $init['top'], 'width' => $init['width'], 'height' => $init['height']]); } parent::__construct($id, $init, $compiler); @@ -51,11 +51,10 @@ class LayerLink extends ImageLink protected function _getExtension() { - if ($this->_getLayer() === 'text' || $this->_getLayer() === 'onlytext' || $this->_getLayer() === 'bothsvg') { - return 'svg'; - } else { - return 'jpg'; - } + return match ($this->_getLayer()) { + 'text', 'onlytext', 'bothsvg', 'textmask' => 'svg', + default => 'jpg', + }; } protected function _getLayer() diff --git a/src/Links/ZoomLink.php b/src/Links/ZoomLink.php index 005a89d..0f1851f 100644 --- a/src/Links/ZoomLink.php +++ b/src/Links/ZoomLink.php @@ -127,7 +127,7 @@ class ZoomLink extends NormalLink $extractOptions['quality'] = $attributes['quality']; } - if (isset($attributes['layer']) && !in_array($attributes['layer'], ['image', 'text', 'onlytext', 'bothsvg'])) { + if (isset($attributes['layer']) && !in_array($attributes['layer'], ['image', 'text', 'onlytext', 'bothsvg', 'textmask'])) { unset($attributes['layer']); } @@ -165,7 +165,7 @@ class ZoomLink extends NormalLink if ($attributes['layer'] === 'image') { $extractOptions['texts'] = false; $extractOptions['background'] = true; - } else if ($attributes['layer'] === 'text' || $attributes['layer'] === 'onlytext') { + } else if ($attributes['layer'] === 'text' || $attributes['layer'] === 'onlytext' || $attributes['layer'] === 'textmask') { $extractOptions['texts'] = true; $extractOptions['background'] = false; $ext = $extractOptions['format'] = 'svg';