From: Vincent Vanwaelscappel Date: Wed, 5 Jul 2023 16:37:02 +0000 (+0200) Subject: wip #6094 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b6403d034a22ffebbe272321b13a08da55e8b642;p=fluidbook-toolbox.git wip #6094 @1.5 --- diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index e384f41b4..2f5ea5317 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -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; diff --git a/resources/linkeditor/js/linkeditor.layers.js b/resources/linkeditor/js/linkeditor.layers.js index dc794a506..afadaecc1 100644 --- a/resources/linkeditor/js/linkeditor.layers.js +++ b/resources/linkeditor/js/linkeditor.layers.js @@ -61,7 +61,12 @@ LinkeditorLayers.prototype = { dest = '' + TRANSLATIONS.empty + ''; } var l = ''; - 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')), diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index b108c45ac..c7baa03f3 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -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); });