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) {
}
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) {