import tippy from 'tippy.js';
import 'tippy.js/dist/tippy.css';
import gsap from "gsap";
+import Raphael from "raphael";
+import { CountUp } from "countup.js";
import Noty from "noty";
import 'noty/lib/noty.css';
window.Noty = Noty;
window.GrahamScan = GrahamScan;
window.gsap = gsap;
+window.Raphael = Raphael;
+window.CountUp = CountUp;
window.key.filter = function (event) {
return keyfilter(event);
this.dimensionProperties = ['left', 'top', 'width', 'height'];
this.init();
+
+ let $this = this
}
LinkEditor.prototype = {
css[dim] = (v * ($this.fs * $this.zoom.zoom)) + 1;
if (dim === 'height') {
if (LINKS[$(e).attr('fb-uid')].type === '35') {
- $this.links.setFontSize(LINKS[$(e).attr('fb-uid')])
+ $( document ).ajaxComplete(function( event, xhr, settings ) {
+ //$this.links.setFontSize(LINKS[$(e).attr('fb-uid')])
+ })
}
}
} else {
}
this.undo.updateIconsStates();
this.loader.preloadPages();
- if ($("#preview-links").hasClass("active")) {
- this.links.setPreview()
- }
+ this.previewLinks.setPreview()
},
getCurrentPages: function (page) {
setInterval(function () {
$this.checkLastSelectedLink();
}, 250);
-
- $this.linkeditor.previewLinks.setPreview(false,true)
},
key: function (shortcut, scope) {
},
loadFontSize: function() {
+ const $this = this
if(Object.keys(window.LINKS).length > 0) {
$.ajax({
url: '/fluidbook-publication/' + FLUIDBOOK_DATA.id + '/generatefont',
$("#extra-font-face").append("@font-face{font-family:" + FONT_SIZE[k]['font'] + ";src:url('/fluidbook-publication/" + FLUIDBOOK_DATA.id + "/edit/links/assets/" + FONT_SIZE[k]['hash'] + "' ) format('woff');}")
}
$("#preview-links").removeClass('disabled');
+ $this.linkeditor.resize.resize()
+ $this.linkeditor.changePage()
+ $this.linkeditor.previewLinks.setPreview()
}
});
} else {
$this.previewByType(link.type)
},
- setPreview: function(zooming = false, isActive = false) {
+ setPreview: function() {
const links = this.linkeditor.links.getLinksOfPage(this.linkeditor.currentPage)
for (let link in links) {
- if (!isActive) {
- this.updatePreview(links[link])
- }
+ this.updatePreview(links[link])
}
},
imgUrl = imgUrl + (imgUrl.includes('.svg') ? "#svgView(preserveAspectRatio(none))" : '')
let img = "<img src='" + imgUrl + "' />"
$("[data-id-preview=" + $this.linkData.uid + "]").css("position","absolute").html(img)
-
- $("[data-id-preview=" + $this.linkData.uid + "] img").css({
- height: '100%',
- width: '100%',
- display: 'block',
- 'background-size': '100% 100%',
- 'background-position': '0 0',
- })
} else if (type === '35') {
var hash = 'fb_' + window.MD5($this.linkData.image).toString().substring(0, 10)
- this.linkeditor.links.setFontSize($this.linkData)
+ $this.linkeditor.links.setFontSize($this.linkData)
$("[data-id-preview=" + $this.linkData.uid + "]").addClass("link-text").text($this.linkData.to).css({
'height': 'auto',
'color': $this.linkData.extra,
'position': 'absolute'
})
- this.linkeditor.links.updateFontSize($this.linkData)
+ $this.linkeditor.links.updateFontSize($this.linkData)
} else if (type === '39') {
let $link = $("[fb-uid="+$this.linkData.uid+"]")
let animationText = $link.attr("fb-image_rollover")
$("[data-id-preview=" + $this.linkData.uid + "]").append('<div class="preview-wrapper"></div>')
}
- if($("[data-id-preview=" + $this.linkData.uid + "] .linkeditor-page").length < 1) {
- $("[data-id-preview=" + $this.linkData.uid + "]").html('<div class="linkeditor-zoom-copy"><div class="linkeditor-fluidbook-copy"><div class="linkeditor-page linkeditor-page-right-copy" data-page="1"></div><div class="linkeditor-page linkeditor-page-left-copy" data-page="0"></div></div></div>')
- $("[data-id-preview=" + $this.linkData.uid + "]").find(".linkeditor-page-right-copy,.linkeditor-page-left-copy").css({
- "position": "absolute",
- "left": 0
- })
-
- $("[data-id-preview=" + $this.linkData.uid + "]").find(".linkeditor-zoom-copy").css({
- "position": "absolute",
- "transform-origin": "0 0"
- })
- this.linkeditor.resize.resizePages()
-
- $(".linkeditor-fluidbook-copy").css({position: 'absolute', "transform-origin": "0 0"});
+ this.createPreviewLayerHTML($("[data-id-preview=" + $this.linkData.uid + "]"))
+ this.linkeditor.resize.resizePages()
+ //this.linkeditor.zoom.setZoom(1)
- this.linkeditor.zoom.setZoom(1)
- }
if(animZoom.length > 0) {
let srcImg = $("#linkeditor-page-left .contents img.images").attr('src')
let srcText = $("#linkeditor-page-left .contents img.texts").attr('src')
bg = 'url('+srcText+')'
}
- $("[data-id-preview=" + $this.linkData.uid + "] .preview-wrapper").css("clip-path","inset(0)")
$("[data-id-preview=" + $this.linkData.uid + "] .preview-wrapper").addClass("img")
$("[data-id-preview=" + $this.linkData.uid + "] .linkeditor-page-left-copy").css({
}
this.linkeditor.resize.resizeCanvas()
-
- $("[data-id-preview=" + $this.linkData.uid + "]").css({
- "clip-path":"inset(0)",
- "position": "absolute",
- }).find('img').css({
- 'width': '100%',
- 'height': '100%',
- 'position': 'absolute',
- 'left': 0,'top': 0
- })
-
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
$("[data-id-preview]").parents('.link').css()
},
+ createPreviewLayerHTML: function(el) {
+ let html = `
+ <div class="linkeditor-zoom-copy">
+ <div class="linkeditor-fluidbook-copy">
+ <div class="linkeditor-page linkeditor-page-right-copy" data-page="1"></div>
+ <div class="linkeditor-page linkeditor-page-left-copy" data-page="0"></div>
+ </div>
+ </div>
+ `;
+ el.html(html)
+ },
+
}
export default LinkeditorPreviewLinks;