From 468fa4943b9a3b579ccb87f4a8a76c3bc5ae798b Mon Sep 17 00:00:00 2001 From: soufiane Date: Thu, 16 Oct 2025 15:40:38 +0200 Subject: [PATCH] wait #7785 @10:00 --- resources/linkeditor/js/linkeditor.js | 2 +- .../linkeditor/js/linkeditor.previewLinks.js | 64 +++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index 0c00442be..19dd5e5c2 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -508,7 +508,7 @@ LinkEditor.prototype = { this.undo.updateIconsStates(); this.loader.preloadPages(); $("#linkeditor-layer-links").empty() - this.previewLinks.setPreview(); + this.previewLinks.setPreview(false, false); const w = $("#linkeditor-layer-links").width() const h = $("#linkeditor-layer-links").height() $(".linkeditor-fluidbook-copy,#linkeditor-layer-links [class^=linkeditor-page-]").css({ diff --git a/resources/linkeditor/js/linkeditor.previewLinks.js b/resources/linkeditor/js/linkeditor.previewLinks.js index a908c568d..9efb31270 100644 --- a/resources/linkeditor/js/linkeditor.previewLinks.js +++ b/resources/linkeditor/js/linkeditor.previewLinks.js @@ -40,7 +40,37 @@ LinkeditorPreviewLinks.prototype = { l.html("
") } - $this.previewByType(link.type, isZooming, reset) + this.previewByType(link.type, isZooming, reset) + + // Cropper les bords pour éviter que les animations de type scale etc... ne fassent sortir le calque + // du fb afin d'obtenir un rendu plus proche du rendu final + const time = setTimeout(function(){ + if(link.type !== '39') { + const { right, bottom, top } = $("#linkeditor-fluidbook")[0].getBoundingClientRect() + + const {width: wLink, height: hLink, right: rLink, bottom: bLink, left: lLink, top: tLink} = l[0].getBoundingClientRect() + + let limitRight = wLink + (right - rLink) + let limitBottom = hLink + (bottom - bLink) + const limitTop = top - tLink + + // Pour la première page si c'est un fb à double page + const { left: pageRightDimensionX} = $("#linkeditor-page-right")[0].getBoundingClientRect() + const { left: pageLeftDimensionX, right: pageLeftDimensionXRight} = $("#linkeditor-page-left")[0].getBoundingClientRect() + let limitLeft = pageLeftDimensionX - lLink + if($("#linkeditor").hasClass("double") && this.linkeditor.currentPage === 0) { + limitLeft = pageRightDimensionX - lLink + } + + // Pour la dernière page on modifie la limite à droite + if($("#linkeditor").hasClass("double") && this.linkeditor.currentPage === FLUIDBOOK_DATA.settings.pages) { + limitRight = wLink + (pageLeftDimensionXRight - rLink) + } + + l.css('clip-path',`polygon(${limitLeft}px ${limitTop}px, ${limitRight}px ${limitTop}px, ${limitRight}px ${limitBottom}px, ${limitLeft}px ${limitBottom}px)`) + } + }, 500) + }, previewByType: function (type, isZooming = false, reset = false) { @@ -68,38 +98,6 @@ LinkeditorPreviewLinks.prototype = { } const z = this.linkeditor.zoom.normalizeZoom(this.linkeditor.zoom.getZoom()) - - // Cropper les bords pour éviter que les animations de type scale etc... ne fassent sortir le calque - // du fb afin d'obtenir un rendu plus proche du rendu final - if(type !== '39') { - const { right, bottom, top } = $("#linkeditor-fluidbook")[0].getBoundingClientRect() - - const {width: wLink, height: hLink, right: rLink, bottom: bLink, left: lLink, top: tLink} = $(".link[fb-uid="+$this.linkData.uid+"]")[0].getBoundingClientRect() - - let limitRight = wLink + (right - rLink) - const limitBottom = hLink + (bottom - bLink) - - // Pour la première page si c'est un fb à double page - const { left: pageRightDimensionX} = $("#linkeditor-page-right")[0].getBoundingClientRect() - const { left: pageLeftDimensionX, right: pageLeftDimensionXRight} = $("#linkeditor-page-left")[0].getBoundingClientRect() - let limitLeft = pageLeftDimensionX - lLink - if($("#linkeditor").hasClass("double") && this.linkeditor.currentPage === 0) { - limitLeft = pageRightDimensionX - lLink - } - - // Pour la dernière page on modifie la limite à droite - if($("#linkeditor").hasClass("double") && this.linkeditor.currentPage === FLUIDBOOK_DATA.settings.pages) { - limitRight = wLink + (pageLeftDimensionXRight - rLink) - } - - const limitTop = top - tLink - - $(".link[fb-uid="+$this.linkData.uid+"]").css('clip-path',`polygon(${limitLeft}px ${limitTop}px, ${limitRight}px ${limitTop}px, ${limitRight}px ${limitBottom}px, ${limitLeft}px ${limitBottom}px)`) - } - - /*$("#linkeditor-editor").css({ - 'clip-path': $this.getClipPath(clipLimit.left * z, clipLimit.top * z, clipLimit.width * z, clipLimit.height * z) - })*/ }, createPreviewLayerHTML: function(el,id) { -- 2.39.5