]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6094 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Jul 2023 16:37:02 +0000 (18:37 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Jul 2023 16:37:02 +0000 (18:37 +0200)
app/SubForms/Link/Base.php
resources/linkeditor/js/linkeditor.layers.js
resources/linkeditor/js/linkeditor.links.js

index e384f41b4a66f29cfe21272b054053c14b8647e9..2f5ea5317078211bc42d8401e36f1747dc979e26 100644 (file)
@@ -318,7 +318,7 @@ class Base extends Form
             if ($type['type'] === Link::MULTIMEDIA) {
                 $optionsChoices['to'] = ['file.jpg', 'file.zip'];
             } else if ($type['type'] === Link::LAYER) {
-                $optionsChoices['to'] = ['', 'both', 'image', 'text'];
+                $optionsChoices['to'] = ['', 'both','bothsvg', 'image', 'text', 'onlytext'];
             }
 
             $configs[$type['type']] = $optionsChoices;
index dc794a506dc13f06ebd84e6789f3400cf044fbd2..afadaecc1494dec6306efd10dfc24efaadf0b0f0 100644 (file)
@@ -61,7 +61,12 @@ LinkeditorLayers.prototype = {
                 dest = '<em>' + TRANSLATIONS.empty + '</em>';
             }
             var l = '<label class="layer" fb-type="' + type + '"><input name="' + $(this).attr('fb-uid') + '" type="checkbox"> ' + dest + '<span data-tooltip="' + TRANSLATIONS.click_to_copy_id + '" data-uid="' + $(this).attr('fb-uid') + '" class="uid">#' + $(this).attr('fb-uid') + '</span></label>';
-            let level = Math.floor(parseInt($(this).attr('fb-calc-depth')) / 10);
+            let d = parseInt($(this).attr('fb-calc-depth'));
+            var m = 1;
+            if (d >= 30 && d < 50) {
+                m = 10;
+            }
+            let level = Math.floor((m * d) / 10) / m;
             layers.push({
                 level: level,
                 zindex: parseInt($(this).attr('fb-calc-zindex')),
index b108c45ac27fd099a99d4f6e76c7ad5c33376d5c..c7baa03f31d97e469b0b3a46b78c980686528144 100644 (file)
@@ -1048,6 +1048,11 @@ LinkeditorLinks.prototype = {
             let linkWidth = parseFloat($(this).attr('fb-width'));
             let linkHeight = parseFloat($(this).attr('fb-height'));
             let zindex = ((calcDepth + 1) * 10000) - Math.min(9999, Math.max(1, Math.round(9999 * ((linkWidth * linkHeight) / $this.linkeditor.bookSurface))));
+
+            if (isNaN(zindex) || isNaN(calcDepth)) {
+                console.warn('error defining depth of link ' + $(this).attr('fb-uid'), calcDepth, linkWidth, linkHeight, $this.linkeditor.bookSurface);
+            }
+
             $(this).attr('fb-calc-depth', calcDepth);
             $(this).attr('fb-calc-zindex', zindex);
             $(this).css('z-index', zindex);
@@ -1061,9 +1066,11 @@ LinkeditorLinks.prototype = {
         $.each(conf, function (k, v) {
             let val = $(link).attr('fb-' + k);
             if (k === 'alternative' || k === 'to') {
-                let e = val.split('.');
-                let ext = e.pop().toLowerCase();
-                val = (['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'svg'].indexOf(ext) >= 0) ? 'file.jpg' : 'file.zip';
+                if (key === 6) {
+                    let e = val.split('.');
+                    let ext = e.pop().toLowerCase();
+                    val = (['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'svg'].indexOf(ext) >= 0) ? 'file.jpg' : 'file.zip';
+                }
             }
             settings.push(k + '|' + val);
         });