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;
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')),
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);
$.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);
});