$(document).on("click", "#linkeditor-start-animation", function(e) {
e.preventDefault()
- let isActive = $("#preview-links").hasClass("active")
$("#preview-links").addClass("active")
- $this.linkeditor.previewLinks.setPreview(false,isActive)
+ $("body").addClass("preview")
$this.setAnim(false)
})
setInterval(function () {
$this.checkLastSelectedLink();
}, 250);
+
+ $this.linkeditor.previewLinks.setPreview(false,true)
},
key: function (shortcut, scope) {
this.linkeditor.hasChanged();
this.updatePolygonLinks();
this.updateLayers();
+
this.linkeditor.previewLinks.updatePreview(this.lastSelectedLinkData);
},
this.linkeditor.rulers.updateMagnetValues();
this.updateLayers();
this.updatePolygonLinks(false);
- this.linkeditor.previewLinks.updatePreview(LINKS[id]);
+
+ const $this = this
+ $this.linkeditor.previewLinks.updatePreview(LINKS[id]);
},
updateSelectionData: function (props) {
},
preview: function() {
- let el = $("[data-action='links.preview']")
- el.toggleClass("active")
-
- if(el.hasClass("active")) {
- this.linkeditor.previewLinks.setPreview()
- } else {
- this.linkeditor.previewLinks.clearPreview()
- }
+ $("body").toggleClass("preview")
+ $("#preview-links").toggleClass("active")
},
animation: function() {
- $("[data-action='links.preview']").addClass("active")
- this.linkeditor.previewLinks.setPreview()
+ $("body").addClass("preview")
+ $("#preview-links").addClass("active")
this.setAnim()
},
let el = previewDiv.get(0)
let animWithBackground = animations.filter((v) => v.backgroundColor)
- let backgroundColor = animWithBackground.length > 0 ? animWithBackground[0].backgroundColor : null
+ let backgroundColor = animWithBackground.length > 0 ? animWithBackground[0].backgroundColor : 'transparent'
+
+ if(links[link].type !== '45') {
+ $link.find('.bg-preview').css('background-color', backgroundColor)
+ }
+
+ /**
+ * On supprime les svgs s'il y en a
+ * utile dans le cas si c'est une animation pie
+ */
+ previewDiv.find('svg').remove()
- $link.find('.bg-preview').css('background-color',backgroundColor)
/**
- * Utiliser les classes css pour selectionner seulement
- * le calque à animer
+ * On ajoute un id utilisable par l'animation pie
*/
+ previewDiv.attr('id','linkwrapper-'+links[link].uid)
+
+ /**
+ * On ajoute un attribut data-color utilisable par l'animation pie
+ * Pour les liens couleurs
+ */
+ if(links[link].type === '14') {
+ previewDiv.attr('data-color', links[link].to)
+ }
+
+ /**
+ * On ajoute un attribut data-color utilisable par l'animation pie
+ * Pour les liens texte
+ */
+ if(links[link].type === '35') {
+ previewDiv.attr('data-anim-numeric-value', links[link].to).addClass('textLink')
+ }
+
if(animationText) {
+ /**
+ * Utiliser les classes css pour selectionner seulement
+ * le calque à animer
+ */
if(links[link].type === '39') {
previewDiv.addClass(links[link].to)
}
'line-height': FONT_SIZE[hash]['capHeight']
})
} catch (e) {
-
+ console.log(e)
}
},
updateFontSize: function(link) {
- let scaleString = link.image_rollover.split('\n').filter((n) => { return n.includes('scale') })[0]
+ let scaleString = false
+ if (link.image_rollover) {
+ scaleString = link.image_rollover.split('\n').filter((n) => {
+ return n.includes('scale')
+ })[0]
+ }
+
let scale = scaleString ? parseFloat(scaleString.split('=')[1]) : 1
let zoom = 0.39
- $("[data-id-preview="+link.uid+"]").css({
- transform: "scale("+scale+")",
- 'transform-origin': "0 100%"
+ $("[data-id-preview=" + link.uid + "]").css({
+ transform: "scale(" + scale + ")",
+ 'transform-origin': "0 100% !important"
})
- $("[data-id-preview-wrap="+link.uid+"]").css({
- transform: "scale("+zoom+")",
+ $("[data-id-preview-wrap=" + link.uid + "]").css({
+ transform: "scale(" + zoom + ")",
'transform-origin': "0 0",
- width: "calc(100% / "+zoom+")",
- height: "calc(100% / "+zoom+")"
+ width: "calc(100% / " + zoom + ")",
+ height: "calc(100% / " + zoom + ")"
})
},
result = []
for (let k in o) {
let entries = o[k].split('=')
- result[entries[0]] = entries[1]
+ result[entries[0]] = entries[1]?.replace(/([\"]+)/gm, "")
}
obj[anim] = Object.assign({}, result)
}