From 48ce47c39cb8c485688d9d6fb6f2898263dffb84 Mon Sep 17 00:00:00 2001 From: soufiane Date: Mon, 30 Mar 2026 17:23:09 +0200 Subject: [PATCH] wait #7926 --- resources/linkeditor/js/linkeditor.links.js | 18 +++++++++---- .../linkeditor/js/linkeditor.previewLinks.js | 26 +++++++++++++------ resources/linkeditor/style/inc/_links.sass | 19 ++++++++++++++ 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 93ed768fe..2b09905d1 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -429,13 +429,12 @@ LinkeditorLinks.prototype = { data.left += offset.x; $this.selectLink($this.addLink(data, false)); + $this.linkeditor.previewLinks.updatePreview(data); }); this.linkeditor.hasChanged(); this.updatePolygonLinks(); this.updateLayers(); - - this.linkeditor.previewLinks.updatePreview(this.lastSelectedLinkData); }, hasUIDLink: function (uid) { @@ -1255,7 +1254,7 @@ LinkeditorLinks.prototype = { } var link = this.getCurrentSelection().eq(0); var rect = { - x: -margin, y: -margin, width: this.linkeditor.fw + margin * 2, height: this.linkeditor.ph + margin * 2, + x: -margin, y: -margin, width: this.linkeditor.fw + margin * 2, height: this.linkeditor.utils.getPageDimensions(this.linkeditor.currentPage)[1] ?? this.linkeditor.ph + margin * 2, }; if (!this.linkeditor.single && !double) { if (parseFloat($(link).attr('fb-left')) > this.linkeditor.pw) { @@ -1624,10 +1623,19 @@ LinkeditorLinks.prototype = { * le calque à animer */ if(links[link].type === '39') { + if(links[link].to === 'onlytext' || links[link].to === 'text') { + el = $("#linkeditor-layer-links > [data-id-preview-wrap="+links[link].uid+"] > [data-id-preview="+links[link].uid+"] .texts-wrapper[data-id="+links[link].uid+"]") + } else if(links[link].to === 'image') { + el = $("#linkeditor-layer-links > [data-id-preview-wrap="+links[link].uid+"] > [data-id-preview="+links[link].uid+"] .images-wrapper[data-id="+links[link].uid+"]") + } previewDiv.addClass(links[link].to) - } - this.linkeditor.linksAnimations.executeAnimations(el, animations) + for(let i = 0; i < 2; i++) { + this.linkeditor.linksAnimations.executeAnimations(el[i], animations) + } + } else { + this.linkeditor.linksAnimations.executeAnimations(el, animations) + } } } }, diff --git a/resources/linkeditor/js/linkeditor.previewLinks.js b/resources/linkeditor/js/linkeditor.previewLinks.js index 3d4a4d346..1e029e1aa 100644 --- a/resources/linkeditor/js/linkeditor.previewLinks.js +++ b/resources/linkeditor/js/linkeditor.previewLinks.js @@ -43,6 +43,7 @@ LinkeditorPreviewLinks.prototype = { previewByType: function (type, isZooming = false, reset = false) { const $this = this + console.log("type: ",type, "linkId: ",this.linkData.uid); if (type === '14') { this.previewColor($this) } else if (type === '15' || /\.(jpg|png|svg|webp|avif)$/.exec(this.linkData.image)) { @@ -73,8 +74,14 @@ LinkeditorPreviewLinks.prototype = {
-
-
+
+
+
+
+
+
+
+
@@ -214,8 +221,10 @@ LinkeditorPreviewLinks.prototype = { //$("[data-id-preview=" + $this.linkData.uid + "] .preview-wrapper .linkeditor-page").remove() } else {*/ if ($(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] img").length < 1) { - $("#linkeditor-page-left .contents img").clone().addClass('left').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-left-copy") - $("#linkeditor-page-right .contents img").clone().addClass('right').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-right-copy") + $("#linkeditor-page-left .contents img.texts").clone().addClass('left').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-left-copy .texts-wrapper[data-id="+ $this.linkData.uid +"]"); + $("#linkeditor-page-left .contents img.images").clone().addClass('left').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-left-copy .images-wrapper[data-id="+ $this.linkData.uid +"]"); + $("#linkeditor-page-right .contents img.texts").clone().addClass('right').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-right-copy .texts-wrapper[data-id="+ $this.linkData.uid +"]"); + $("#linkeditor-page-right .contents img.images").clone().addClass('right').appendTo(".linkeditor-fluidbook-copy[data-id=" + $this.linkData.uid + "] .linkeditor-page-right-copy .images-wrapper[data-id="+ $this.linkData.uid +"]"); } $("#linkeditor-layer-links [data-id-preview=" + $this.linkData.uid + "] .preview").removeClass("img") /*}*/ @@ -228,10 +237,12 @@ LinkeditorPreviewLinks.prototype = { } if(polygon) { - $("#linkeditor-layer-links [data-id-preview-wrap="+$this.linkData.uid+"]").css({ - 'z-index': 3, - 'clip-path': this.getPolygon($this.linkData.left,$this.linkData.top,polygon) + $("#linkeditor-layer-links [data-id-preview-wrap="+$this.linkData.uid+"], #linkeditor-layer-links [data-id-preview-wrap="+$this.linkData.uid+"] [class*=-wrapper]").css({ + 'clip-path': this.getPolygon($this.linkData.left,$this.linkData.top,polygon), }) + + $("#linkeditor-layer-links [data-id-preview-wrap="+$this.linkData.uid+"] .texts-wrapper").css('z-index','3'); + $("#linkeditor-layer-links [data-id-preview-wrap="+$this.linkData.uid+"] .images-wrapper").css('z-index','2'); }else{ if(animZoom.length > 0) { $("#linkeditor-layer-links [data-id-preview-wrap=" + $this.linkData.uid + "]").css({ @@ -248,7 +259,6 @@ LinkeditorPreviewLinks.prototype = { 'width':'100%', 'height':'100%', 'position': 'absolute', - 'background-color': '#fff', 'z-index': 2 }) diff --git a/resources/linkeditor/style/inc/_links.sass b/resources/linkeditor/style/inc/_links.sass index e3b6b8734..7cee53003 100644 --- a/resources/linkeditor/style/inc/_links.sass +++ b/resources/linkeditor/style/inc/_links.sass @@ -42,6 +42,9 @@ body:not(.preview) position: absolute transform-origin: 0 0 z-index: 2 + .bg-preview + + [data-id-preview-wrap], [data-id-preview] position: absolute @@ -49,9 +52,25 @@ body:not(.preview) height: 100% z-index: 2 + .texts-wrapper, + .images-wrapper + position: absolute + width: 100% + height: 100% + + .texts-wrapper + z-index: 3 + + .images-wrapper + z-index: 2 + + .linkeditor-fluidbook-copy position: absolute transform-origin: 0 0 + width: 100% + height: 100% + .linkeditor-page position: absolute top: 0 -- 2.39.5