]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7785 @10:00
authorsoufiane <soufiane@cubedesigners.com>
Thu, 16 Oct 2025 13:40:38 +0000 (15:40 +0200)
committersoufiane <soufiane@cubedesigners.com>
Thu, 16 Oct 2025 13:40:38 +0000 (15:40 +0200)
resources/linkeditor/js/linkeditor.js
resources/linkeditor/js/linkeditor.previewLinks.js

index 0c00442be2c119e4a53199a1601afecbae6feb4a..19dd5e5c211cc42c96f9f1d31704163761d56ddc 100644 (file)
@@ -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({
index a908c568d0631dd9978283f10c4102c88ee0536d..9efb31270ceae5e9aac98ae640c250bf92dd659d 100644 (file)
@@ -40,7 +40,37 @@ LinkeditorPreviewLinks.prototype = {
             l.html("<div class='bg-preview'></div><div data-id-preview-wrap='" + link.uid + "'><div data-id-preview='" + link.uid + "'></div></div>")
         }
 
-        $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) {