From: soufiane Date: Mon, 13 Oct 2025 16:19:39 +0000 (+0200) Subject: wip #7785 @6:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ce73dfb8c5f6b02cb61ae814bb3c2c6ba2ad949c;p=fluidbook-toolbox.git wip #7785 @6:00 --- diff --git a/resources/linkeditor/js/linkeditor.previewLinks.js b/resources/linkeditor/js/linkeditor.previewLinks.js index 182ee7050..4b579ab82 100644 --- a/resources/linkeditor/js/linkeditor.previewLinks.js +++ b/resources/linkeditor/js/linkeditor.previewLinks.js @@ -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) {