})
this.updateFontSize(link)
} else if (linkData.type === '39') {
- $("[data-id-preview=" + linkData.uid + "]").html('<canvas id="canvas'+ linkData.uid+'" width="'+linkData.width* this.linkeditor.zoom.zoom+'" height="'+linkData.height* this.linkeditor.zoom.zoom+'"></canvas>')
-
- 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("<div class='canvas' style='height:100%;clip-path:inset(0 0 0 0);'></div>")
+
+ 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') {
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;