From 75102cfca6a7ce8be16a981b2b0076faedaf69ad Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 30 Sep 2024 18:14:37 +0200 Subject: [PATCH] wait #7092 @1.5 --- app/Fields/BlendMode.php | 17 +++++++++++++++++ app/Fluidbook/Compiler/Compiler.php | 6 +++--- .../FluidbookPublication/PreviewOperation.php | 6 +++++- app/Models/FluidbookTheme.php | 11 +++++------ 4 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 app/Fields/BlendMode.php diff --git a/app/Fields/BlendMode.php b/app/Fields/BlendMode.php new file mode 100644 index 000000000..bee75d567 --- /dev/null +++ b/app/Fields/BlendMode.php @@ -0,0 +1,17 @@ +lessVariables['z'] = $this->z; $this->lessVariables['book-page-width'] = $w; - $this->lessVariables['book-page-correct-width'] = $w; $this->lessVariables['book-page-correct-height'] = $h; - $this->log('CSS 2'); $this->lessVariables['book-page-height'] = $h; $this->lessVariables['book-page-ratio'] = floatval($w) / floatval($h); $this->lessVariables['page-shade-opacity'] = min(1, $this->themeSettings->shadeAlpha / 50); + $this->lessVariables['shadow-blend-mode'] = $this->themeSettings->bookShadeMultiply ?? "normal"; + $c = new Color($this->themeSettings->bookShadeColor); $this->lessVariables['shadow-opacity'] = $c->getAlpha() * 1.2; + $this->config->bookShadeColor = [round($c->getRed() * 255), round($c->getGreen() * 255), round($c->getBlue() * 255)]; $this->lessVariables['edges-display'] = $this->_lessBoolean($this->themeSettings->usePageEdges); $this->lessVariables['edge-left-offset'] = 0; $this->lessVariables['edge-right-offset'] = 0; $this->lessVariables['edges-opacity'] = 1; - $this->lessVariables['audioplayer-background-color'] = Color::colorToCSS($this->themeSettings->audioplayerBackgroundColor ?: $this->themeSettings->couleurL); $this->lessVariables['audioplayer-icon-color'] = Color::colorToCSS($this->themeSettings->audioplayerIconColor); $this->config->audioplayerStrokeColor = $this->lessVariables['audioplayer-stroke-color'] = Color::colorToCSS($this->themeSettings->audioplayerStrokeColor ?: $this->themeSettings->couleurL); diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php index ca9d1efac..f58d8fe8f 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php @@ -11,7 +11,6 @@ use App\Models\FluidbookTheme; use Cubist\Backpack\Http\Controllers\Base\XSendFileController; use Cubist\Util\PHP; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Route; // __('!!Paramètres des fluidbooks') @@ -72,6 +71,7 @@ trait PreviewOperation return $this->loadingCompile($url, $id, $hash); } + return $this->preview($version, $fluidbook, $theme, $path, $skipCompile); } @@ -130,6 +130,10 @@ trait PreviewOperation $isScorm = $version === 'scorm'; + if ($skipCompile && !file_exists($fluidbook->getFinalPath() . '/index.html')) { + $skipCompile = false; + } + $dest = $fluidbook->getFinalPath($theme, $isScorm); if ($path === 'index.html') { $fluidbook->incrementPreviewVisit(); diff --git a/app/Models/FluidbookTheme.php b/app/Models/FluidbookTheme.php index 30ade502f..b8d4f428d 100644 --- a/app/Models/FluidbookTheme.php +++ b/app/Models/FluidbookTheme.php @@ -3,19 +3,16 @@ namespace App\Models; +use App\Fields\BlendMode; use App\Fields\FluidbookFont; use App\Fields\FluidbookThemeImage; -use App\Fields\HorizontalAlign; -use App\Fields\ThemeBackgroundSize; -use App\Fields\VerticalAlign; use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Jobs\GenerateThemePreview; -use App\Jobs\UpdateWS2ThemeTable; use App\Models\Base\ToolboxModel; use App\Models\Traits\ToolboxSettings; use Cubist\Backpack\Magic\EntityData; -use Cubist\Backpack\Magic\Fields\Color; use Cubist\Backpack\Magic\Fields\Files; +use Cubist\Backpack\Magic\Fields\FormSeparator; use Cubist\Backpack\Magic\Fields\SelectFromArray; use Cubist\Backpack\Magic\Fields\SelectFromModel; use Cubist\Util\CommandLine; @@ -271,6 +268,7 @@ class FluidbookTheme extends ToolboxModel 'default' => true, 'translatable' => false, ]); + $this->addField('sep_shade', FormSeparator::class); $this->addField([ 'name' => 'bookShadeColor', 'type' => 'Color', @@ -279,6 +277,7 @@ class FluidbookTheme extends ToolboxModel 'allows_alpha' => true, 'translatable' => false, ]); + $this->addField('bookShadeMultiply', BlendMode::class, __('Blend mode de l\'ombre')); $this->addField([ 'name' => 'section_numbers', @@ -549,7 +548,7 @@ class FluidbookTheme extends ToolboxModel 'type' => FluidbookThemeImage::class, 'label' => __('Icone (pour favicon, apps et exe)'), 'mime_types' => ['image/png'], - 'hint' => __('Image PNG de 256x256').', '.__('pas de transparence'), + 'hint' => __('Image PNG de 256x256') . ', ' . __('pas de transparence'), 'translatable' => false, ]); $this->addField([ -- 2.39.5