From: soufiane Date: Thu, 27 Jun 2024 15:29:28 +0000 (+0200) Subject: wip #6960 @6:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8a91b419860f637eef807ebaaa10b3ceb114bc31;p=fluidbook-toolbox.git wip #6960 @6:00 --- diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index a9f42e25b..6be556a20 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -1637,26 +1637,23 @@ LinkeditorLinks.prototype = { }) this.updateFontSize(link) } else if (linkData.type === '39') { - $("[data-id-preview=" + linkData.uid + "]").html('') - - const canvas = $('#canvas'+ linkData.uid).get(0), - ctx = canvas.getContext('2d'), - xLink = linkData.left, - yLink = linkData.top, - wLink = linkData.width, - hLink = linkData.height; - var image = new Image(); - image.src = $(".contents .images").attr('src') - - const image_image = $(".contents .images").get(0); - const coord = image_image.getBoundingClientRect() - const image_texts = $(".contents .texts").attr("src"); - - console.log("pw",this.linkeditor.ph,hLink,yLink) - const $this = this - image.onload = function() { - ctx.drawImage(image,-(xLink - $this.linkeditor.pw) * $this.linkeditor.zoom.zoom,-yLink* $this.linkeditor.zoom.zoom,$this.linkeditor.pw * $this.linkeditor.zoom.zoom,$this.linkeditor.ph * $this.linkeditor.zoom.zoom); + $("[data-id-preview=" + linkData.uid + "]").parent().css("overflow","hidden") + $("[data-id-preview=" + linkData.uid + "]").html("
") + + if($("[data-id-preview=" + linkData.uid + "] .canvas img").length < 1) { + $("#linkeditor-page-right .contents .images").clone().appendTo("[data-id-preview=" + linkData.uid + "] .canvas") } + + const wp = $(".linkeditor-page").get(0).getBoundingClientRect().width, + pageRightRect = $("#linkeditor-page-right").get(0).getBoundingClientRect() + + $('[data-id-preview="' + linkData.uid + '"] .canvas img').css({ + 'position': 'fixed', + 'width': wp, + 'left': pageRightRect.x, + 'top': pageRightRect.y, + }) + } if (linkData.type === '10') { @@ -1750,29 +1747,6 @@ LinkeditorLinks.prototype = { clearPreview: function() { $("[data-id-preview]").remove() }, - - convertAnimationStringToObject: function(anim) { - let anims = anim.split('---') - let o = [] - - if(anim !== "" && anim !== "none") { - anims.forEach(function (anim_) { - let arr = anim_.split('\n') - let o_ = {} - arr.forEach(function (pair) { - let parts = pair.split("="); - if (parts[0].length > 0 && parts[1].length > 0) { - let k = parts[0]; - let v = parts[1]; - o_[k] = v; - } - }) - o.push(o_) - }) - } - - return o - }, }; export default LinkeditorLinks;