]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7092 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 Sep 2024 16:14:37 +0000 (18:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 Sep 2024 16:14:37 +0000 (18:14 +0200)
app/Fields/BlendMode.php [new file with mode: 0644]
app/Fluidbook/Compiler/Compiler.php
app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php
app/Models/FluidbookTheme.php

diff --git a/app/Fields/BlendMode.php b/app/Fields/BlendMode.php
new file mode 100644 (file)
index 0000000..bee75d5
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Fields;
+
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
+
+class BlendMode extends SelectFromArray
+{
+    protected $_default = 'normal';
+    protected $_databaseDefault = 'normal';
+
+    public function getOptions()
+    {
+        $modes = ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
+        return array_combine($modes, $modes);
+    }
+}
index 7b776f07ab32ea5c9c90a2e78c183765cc4445f4..aef9062f68767fa7bf7b2365efecf9e9397b3ca9 100644 (file)
@@ -1806,24 +1806,24 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
         $this->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);
index ca9d1efac5c38983b2f4b8bc57336f4eac2c4085..f58d8fe8f199f45e18a89199c2a813ef2885b56b 100644 (file)
@@ -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();
index 30ade502f36fe9c9da3502ad314454019c5b39b3..b8d4f428d0928292eee8910c45d33ae4da02b33a 100644 (file)
@@ -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([