this.linkeditor.rulers.updateMagnetValues();
this.updateLayers();
this.updatePolygonLinks(false);
- if($(['data-action=links.preview']).hasClass("active")) {
+ if($("#preview-links").hasClass("active")) {
this.updatePreview(LINKS[id]);
}
},
},
loadFontSize: function() {
- $.ajax({
- url: '/fluidbook-publication/' + FLUIDBOOK_DATA.id + '/generatefont',
- type: 'post',
- data: { links: window.LINKS, rulers: window.RULERS },
- success: function (response) {
- FONT_SIZE = JSON.parse(response);
- },
- complete: function() {
- $("#extra-font-face").remove()
- $("head").append("<style id='extra-font-face'></style>")
- for(let k in FONT_SIZE) {
- $("#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');}")
+ if(Object.keys(window.LINKS).length > 0) {
+ $.ajax({
+ url: '/fluidbook-publication/' + FLUIDBOOK_DATA.id + '/generatefont',
+ type: 'post',
+ data: {links: window.LINKS, rulers: window.RULERS},
+ success: function (response) {
+ FONT_SIZE = JSON.parse(response);
+ },
+ complete: function () {
+ $("#extra-font-face").remove()
+ $("head").append("<style id='extra-font-face'></style>")
+ for (let k in FONT_SIZE) {
+ $("#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');
}
- }
- });
+ });
+ } else {
+ $("#preview-links").removeClass('disabled');
+ }
},
updatePreview: function(link) {
- let linkData = link,
- gsapConfig = this.convertAnimationStringToObject(linkData.image_rollover)
+ let linkData = link
+
+ let l = this.getLinkById(link.uid)
+ if($('[data-id-preview="'+link.uid+'"]').length < 1) {
+ l.html("<div data-id-preview='" + link.uid + "'></div>")
+ }
$("[data-id-preview="+linkData.uid+"]").css({
height: '100%',
'background-position': '0 0',
})
} else if(linkData.type === '35') {
- var hash = 'fb_'+window.MD5(link.image).toString().substring(0,10)
+ var hash = 'fb_'+window.MD5(linkData.image).toString().substring(0,10)
this.setFontSize(linkData, hash)
$("[data-id-preview=" + linkData.uid + "]").text(linkData.to).css({
'font-family': hash,
'color': linkData.extra,
})
+ this.updateFontSize(link)
}
},
const links = this.getLinksOfPage(this.linkeditor.currentPage)
for(let link in links) {
- let l = this.getLinkById(links[link].uid)
- l.html("<div data-id-preview='"+links[link].uid+"'></div>")
this.updatePreview(links[link])
}
},
}
},
- updateFontSize: function(zoom, link) {
+ updateFontSize: function(link) {
+ let zoom = this.linkeditor.zoom.zoom
$("[data-id-preview="+link.uid+"]").css({
transform: "scale("+zoom+")",
'transform-origin': 'left top'