]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7785 @6:00
authorsoufiane <soufiane@cubedesigners.com>
Mon, 13 Oct 2025 16:19:39 +0000 (18:19 +0200)
committersoufiane <soufiane@cubedesigners.com>
Mon, 13 Oct 2025 16:19:39 +0000 (18:19 +0200)
resources/linkeditor/js/linkeditor.previewLinks.js

index 182ee7050855a61bc9f21934682cc576144bd0ff..4b579ab82143b23e6324da5db749fbea09c97581 100644 (file)
@@ -66,6 +66,32 @@ LinkeditorPreviewLinks.prototype = {
         if(type === '10' || type === '4') {
             $("[data-id-preview=" + $this.linkData.uid + "]").css("transform","rotate("+$this.linkData.rot+"deg)")
         }
+
+        const clipLimit = $("#linkeditor-fluidbook")[0].getBoundingClientRect()
+        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 } = $("#linkeditor-layer-links")[0].getBoundingClientRect()
+
+            const wLink = $(".link[fb-uid="+$this.linkData.uid+"]")[0].getBoundingClientRect().width
+            const hLink = $(".link[fb-uid="+$this.linkData.uid+"]")[0].getBoundingClientRect().height
+            const rLink = $(".link[fb-uid="+$this.linkData.uid+"]")[0].getBoundingClientRect().right
+            const bLink = $(".link[fb-uid="+$this.linkData.uid+"]")[0].getBoundingClientRect().bottom
+
+            const limitX = wLink + (right - rLink)
+            const limitY = hLink + (bottom - bLink)
+
+            const x = -$this.linkData.left
+            const y = -$this.linkData.top
+
+            $(".link[fb-uid="+$this.linkData.uid+"]").css('clip-path',`polygon(${x}px ${y}px, ${limitX}px ${y}px, ${limitX}px ${limitY}px, ${x}px ${limitY}px)`)
+        }
+
+        /*$("#linkeditor-editor").css({
+            'clip-path': $this.getClipPath(clipLimit.left * z, clipLimit.top * z, clipLimit.width * z, clipLimit.height * z)
+        })*/
     },
 
     createPreviewLayerHTML: function(el,id) {