From: soufiane Date: Thu, 7 Nov 2024 10:37:18 +0000 (+0100) Subject: wait #7177 @8:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=87efc94ea1898decf67554c81c8f400458867c7c;p=fluidbook-toolbox.git wait #7177 @8:00 --- diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 14f13ae68..b26ca1266 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -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) { diff --git a/resources/linkeditor/js/linkeditor.previewLinks.js b/resources/linkeditor/js/linkeditor.previewLinks.js index f8a89dbfc..c5b51197d 100644 --- a/resources/linkeditor/js/linkeditor.previewLinks.js +++ b/resources/linkeditor/js/linkeditor.previewLinks.js @@ -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("
") } - $("[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, diff --git a/resources/linkeditor/js/linkeditor.resize.js b/resources/linkeditor/js/linkeditor.resize.js index 1e6db84a9..ccda429c0 100644 --- a/resources/linkeditor/js/linkeditor.resize.js +++ b/resources/linkeditor/js/linkeditor.resize.js @@ -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; diff --git a/resources/linkeditor/js/linkeditor.zoom.js b/resources/linkeditor/js/linkeditor.zoom.js index 8e7d783bc..f237433d5 100644 --- a/resources/linkeditor/js/linkeditor.zoom.js +++ b/resources/linkeditor/js/linkeditor.zoom.js @@ -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; diff --git a/resources/linkeditor/style/inc/_links.sass b/resources/linkeditor/style/inc/_links.sass index a20a19240..800efc42c 100644 --- a/resources/linkeditor/style/inc/_links.sass +++ b/resources/linkeditor/style/inc/_links.sass @@ -46,6 +46,8 @@ body:not(.preview) [data-id-preview] display: none !important + height: 100% !important + width: 100% !important .bg-preview, .preview-wrapper,