From fb39bb4e689b4d181ce294f3b270ab1c31124f95 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 26 Aug 2025 15:51:35 +0200 Subject: [PATCH] wip #7704 @1 --- src/Compiler/Compiler.php | 5 +++++ src/Compiler/CompilerInterface.php | 2 ++ src/Compiler/DummyCompiler.php | 5 +++++ src/Compiler/Links.php | 2 -- src/Links/LayerLink.php | 4 +++- src/Links/Link.php | 4 ++++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Compiler.php b/src/Compiler/Compiler.php index ec8d653..6ab10ad 100644 --- a/src/Compiler/Compiler.php +++ b/src/Compiler/Compiler.php @@ -413,4 +413,9 @@ class Compiler implements ShouldQueue, ShouldBeUnique, CompilerInterface { public function extractPDFArea($file, $page, $rect, $to=null, $options = array(), $cache = null){ return PDF::extractArea($file, $page, $rect, $to=null, $options = array(), $cache = null); } + + public function addMask($layer, $page, $area) + { + // TODO: Implement addMask() method. + } } diff --git a/src/Compiler/CompilerInterface.php b/src/Compiler/CompilerInterface.php index c3d4a5a..3a081f5 100644 --- a/src/Compiler/CompilerInterface.php +++ b/src/Compiler/CompilerInterface.php @@ -80,4 +80,6 @@ interface CompilerInterface public function getExternalMultimediaContents($to); public function extractPDFArea($file, $page, $rect, $to=null, $options = array(), $cache = null); + + public function addMask($layer, $page, $area); } diff --git a/src/Compiler/DummyCompiler.php b/src/Compiler/DummyCompiler.php index 9d24a63..4e469ac 100644 --- a/src/Compiler/DummyCompiler.php +++ b/src/Compiler/DummyCompiler.php @@ -169,4 +169,9 @@ class DummyCompiler implements CompilerInterface { { // TODO: Implement extractPDFArea() method. } + + public function addMask($layer, $page, $area) + { + // TODO: Implement addMask() method. + } } diff --git a/src/Compiler/Links.php b/src/Compiler/Links.php index fa00c00..514e971 100644 --- a/src/Compiler/Links.php +++ b/src/Compiler/Links.php @@ -2,13 +2,11 @@ namespace Fluidbook\Tools\Compiler; -use Cubist\Util\ArrayUtil; use Cubist\Util\Files\Files; use Cubist\Util\Zip; use Exception; use Fluidbook\Tools\Links\ContentLink; use Fluidbook\Tools\Links\Link; -use Nette\Utils\Image; trait Links { diff --git a/src/Links/LayerLink.php b/src/Links/LayerLink.php index b9ae28f..3d3ed9d 100644 --- a/src/Links/LayerLink.php +++ b/src/Links/LayerLink.php @@ -19,6 +19,9 @@ class LayerLink extends ImageLink if ($init['to'] === 'text' || $init['to'] === 'onlytext') { $this->defaultZIndex++; } + if ($init['to'] === 'text' && $compiler->config->transparentPage) { + $this->compiler->addMask('texts', $init['page'], ['x' => $init['left'], 'y' => $init['top'], 'width' => $init['width'], 'height' => $init['height']]); + } parent::__construct($id, $init, $compiler); } @@ -77,5 +80,4 @@ class LayerLink extends ImageLink } - } diff --git a/src/Links/Link.php b/src/Links/Link.php index 90c6457..45688fc 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -75,6 +75,7 @@ class Link const SLIDESHOW_INLINE = 46; const PAGE_BACKGROUND_COLOR = 48; const FLUIDBOOK_TOOLBOX_ELEARNING_CONTENT = 49; + const LAYER_MASK = 50; protected static string|false|null $_linksKey = null; public $left; @@ -365,6 +366,9 @@ class Link case static::PAGE_BACKGROUND_COLOR: $compiler->addPageBackground($init['page'], $init['to'] ?? '', $init['extra'] ?? '', $init['alternative'] ?? ''); break; + case static::LAYER_MASK: + $compiler->addMask($init['to'], $init['page'], ['x' => $init['left'], 'y' => $init['top'], 'width' => $init['width'], 'height' => $init['height']]); + break; default: return null; } -- 2.39.5