]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7177 @8:00
authorsoufiane <soufiane@cubedesigners.com>
Thu, 7 Nov 2024 10:37:18 +0000 (11:37 +0100)
committersoufiane <soufiane@cubedesigners.com>
Thu, 7 Nov 2024 10:37:18 +0000 (11:37 +0100)
resources/linkeditor/js/linkeditor.links.js
resources/linkeditor/js/linkeditor.previewLinks.js
resources/linkeditor/js/linkeditor.resize.js
resources/linkeditor/js/linkeditor.zoom.js
resources/linkeditor/style/inc/_links.sass

index 14f13ae684d514d541d18ee846b8a82c4dc8a71d..b26ca1266fb50cef5c5524aa51a7ee4e6c536607 100644 (file)
@@ -1175,7 +1175,16 @@ LinkeditorLinks.prototype = {
         this.updatePolygonLinks(false);
 
         const $this = this
-        $this.linkeditor.previewLinks.updatePreview(LINKS[id]);
+
+        /**
+         *
+         * Si le lien n'est pas de type 'animation de calque'
+         * alors on autorise la mise à jour de la preview
+         *
+         */
+        if(LINKS[id].type !== '39') {
+            $this.linkeditor.previewLinks.updatePreview(LINKS[id]);
+        }
     },
 
     updateSelectionData: function (props) {
index f8a89dbfcbd57cc4ba21b156595de7918b6ce3f7..c5b51197d20283f99e987a07fecb50ca7c4c46ff 100644 (file)
@@ -17,15 +17,15 @@ LinkeditorPreviewLinks.prototype = {
         }
     },
 
-    setPreview: function(isZooming = false) {
+    setPreview: function(isZooming = false, reset = false) {
         const links = this.linkeditor.links.getLinksOfPage(this.linkeditor.currentPage)
 
         for (let link in links) {
-            this.updatePreview(links[link],isZooming)
+            this.updatePreview(links[link],isZooming,reset)
         }
     },
 
-    updatePreview: function(link, isZooming = false) {
+    updatePreview: function(link, isZooming = false, reset = false) {
         let $this = this
         this.linkData = link
         let l = this.linkeditor.links.getLinkById(link.uid)
@@ -34,15 +34,10 @@ LinkeditorPreviewLinks.prototype = {
             l.html("<div class='bg-preview'></div><div data-id-preview-wrap='" + link.uid + "'><div data-id-preview='" + link.uid + "'></div></div>")
         }
 
-        $("[data-id-preview=" + this.linkData.uid + "]").css({
-            height: '100%',
-            width: '100%'
-        })
-
-        $this.previewByType(link.type, isZooming)
+        $this.previewByType(link.type, isZooming, reset)
     },
 
-    previewByType: function (type, isZooming = false) {
+    previewByType: function (type, isZooming = false, reset = false) {
         const $this = this
         if (type === '14') {
             this.previewColor($this)
@@ -51,7 +46,7 @@ LinkeditorPreviewLinks.prototype = {
         } else if (type === '35') {
             this.previewText($this)
         } else if (type === '39') {
-            this.previewLayer($this,isZooming)
+            this.previewLayer($this,isZooming,reset)
         }
 
         if (type === '10') {
@@ -123,16 +118,42 @@ LinkeditorPreviewLinks.prototype = {
         this.linkeditor.links.updateFontSize($this.linkData)
     },
 
-    previewLayer: function($this,isZooming) {
+    previewLayer: function($this,isZooming,reset) {
         let $link = $("[fb-uid="+$this.linkData.uid+"]")
         let animationText = $link.attr("fb-image_rollover")
         let animations = $this.linkeditor.links.resolveAnimation(animationText)
         let animZoom = animations.filter((v) => v.type === "zoomout" || v.type === "zoomin")
         let previewDiv = $("[data-id-preview=" + $this.linkData.uid + "]")
 
+        const z = this.linkeditor.zoom.normalizeZoom(this.linkeditor.zoom.getZoom())
+        if(z) {
+            this.linkeditor.zoom.setZoom(z)
+        }
+
+        /**
+         *
+         * (Voir linkeditor.resize.js resizePages())
+         *
+         * Application des styles pour #linkeditor-fluidbook-copy
+         */
+        let width = $("#linkeditor-fluidbook").css("width")
+        let height = $("#linkeditor-fluidbook").css("height")
+        let left_ = $("#linkeditor-fluidbook").css("left")
+        let top_ = $("#linkeditor-fluidbook").css("top")
+        let transform = $("#linkeditor-fluidbook").css("transform")
+        $(".linkeditor-fluidbook-copy").css({'width':width,'height':height,'left':left_,'top':top_,'transform':transform})
+
+        /**
+         * Application des styles pour #linkeditor-page-right-copy
+         */
+        let left__ = $("#linkeditor-page-right").css("left")
+        $(".linkeditor-page-right-copy").css('left',left__)
+
+        /**
+         *
+         */
         if(!isZooming) {
             this.createPreviewLayerHTML(previewDiv,animZoom.length > 0)
-            this.linkeditor.resize.resizePages()
 
             if (animZoom.length > 0) {
                 $("[data-id-preview=" + $this.linkData.uid + "] .preview-wrapper").addClass("img")
@@ -175,7 +196,6 @@ LinkeditorPreviewLinks.prototype = {
                     })
                 }
 
-
                 //$("[data-id-preview=" + $this.linkData.uid + "] .preview-wrapper .linkeditor-page").remove()
             } else {
                 if ($("[data-id-preview=" + $this.linkData.uid + "] img").length < 1) {
@@ -186,11 +206,14 @@ LinkeditorPreviewLinks.prototype = {
             }
         }
 
-        this.linkeditor.resize.resizeCanvas()
+        if(reset) {
+            $this.linkeditor.rulers.updateRulers();
+        }
         let linkeditorZoomRect = $("#linkeditor-zoom")[0].getBoundingClientRect()
-        let left = $this.linkeditor.fluidbookToGlobal($this.linkData.left, 'left') - linkeditorZoomRect.left
-        let top = $this.linkeditor.fluidbookToGlobal($this.linkData.top, 'top') - linkeditorZoomRect.top
+        let left = this.linkeditor.fluidbookToGlobal($this.linkData.left, 'left') - linkeditorZoomRect.left
+        let top = this.linkeditor.fluidbookToGlobal($this.linkData.top, 'top') - linkeditorZoomRect.top
 
+        //
         previewDiv.find(".linkeditor-zoom-copy").css({
             "left": -left - 1,
             "top": -top - 1,
index 1e6db84a97901070acba4a1ff61b474c67a104d5..ccda429c000b181da41c6ae0467351dc62b8e3d8 100644 (file)
@@ -22,7 +22,6 @@ LinkeditorResize.prototype = {
     },
 
     resize: function () {
-
         let special = this.linkeditor.utils.isSpecialPage();
         if (this.linkeditor.single || special) {
             $("#linkeditor").addClass('single').removeClass('double');
@@ -73,8 +72,8 @@ LinkeditorResize.prototype = {
         if (!this.linkeditor.single && !special) {
             fw *= 2;
         }
-        $("#linkeditor-page-right,.linkeditor-page-right-copy").css({left: this.linkeditor.pw});
-        $("#linkeditor-fluidbook,.linkeditor-fluidbook-copy").css({width: fw, height: ph});
+        $("#linkeditor-page-right").css({left: this.linkeditor.pw});
+        $("#linkeditor-fluidbook").css({width: fw, height: ph});
 
     },
 
@@ -110,7 +109,7 @@ LinkeditorResize.prototype = {
             left = (this.linkeditor.canvasRect.width - this.linkeditor.fw * this.linkeditor.fs) / 2;
             top = 75;
         }
-        $("#linkeditor-fluidbook,.linkeditor-fluidbook-copy").css({left: left, top: top, transform: 'scale(' + this.linkeditor.fs + ')'});
+        $("#linkeditor-fluidbook").css({left: left, top: top, transform: 'scale(' + this.linkeditor.fs + ')'});
     },
 };
 export default LinkeditorResize;
index 8e7d783bc5db572fba518edad32eed113bf64f14..f237433d576520ef0c3670eaea1e62723b267882 100644 (file)
@@ -72,6 +72,7 @@ LinkeditorZoom.prototype = {
     },
 
     moveZoomAfterWheelZoom: function (initialPosition) {
+        console.log('moveZoomAfterWheelZoom')
         let currentPosition = this.getFluidbookPositionOfCursor();
         var dx = (initialPosition.x - currentPosition.x) * currentPosition.width;
         var sx = $("#linkeditor-canvas").scrollLeft() + dx;
@@ -140,7 +141,11 @@ LinkeditorZoom.prototype = {
         var top = this.linkeditor.mobileFirst ? 0 : '50%';
         $("#linkeditor-canvas").scrollTo({top: top, left: '50%'});
         this.resetZoomDrag();
-        this.linkeditor.previewLinks.setPreview(true)
+        this.linkeditor.previewLinks.setPreview(true, true)
     },
+
+    getZoom: function() {
+        return $("#linkeditor-canvas").attr("data-z")
+    }
 };
 export default LinkeditorZoom;
index a20a1924063e846fca950470eb03a7a7ad17a477..800efc42c99cdaee7ae8f6d95dfb3da4ef3747db 100644 (file)
@@ -46,6 +46,8 @@ body:not(.preview)
 
         [data-id-preview]
             display: none !important
+            height: 100% !important
+            width: 100% !important
 
         .bg-preview,
         .preview-wrapper,