return false;
});
+ $(document).on(this.fluidbook.input.clickEvent, 'a.triggerlink[data-trigger-event="stoponclick"]', function () {
+ var ids = $(this).data('trigger-id').split(',');
+ $.each(ids, function (k, id) {
+ try {
+ $this.stopLinkById(id);
+ } catch (e) {
+ }
+ });
+ return false;
+ });
+
$(document).on(this.fluidbook.input.clickEvent, '[data-action]', function () {
var map = {'pdf': 'print', 'fullScreen': "fullscreen", 'locales': 'localesContainers', 'basket': 'cart'};
var action = $(this).data('action');
});
},
+ stopLinkById: function (id) {
+
+ var link = $('.link[data-id="' + id + '"]');
+ if ($(link).length === 0) {
+ console.warn('Link ' + id + ' cant be stopped');
+ return;
+ }
+
+ this.stopAnimationOfLink($(link));
+ },
+
+ stopAnimationOfLink: function (link) {
+ if ($(link).data('gsap') !== undefined && $(link).data('gsap') !== null) {
+ $(link).data('gsap').pause();
+ }
+ },
handleExternalHref: function (link) {
var href = $(link).is('[data-pseudolink-href]') ? $(link).data('pseudolink-href') : $(link).attr('href');
animations[0]['autostart'] = false;
}
+ var autoStartThisAnim = true;
+
if (autostart && !animations[0]['autostart']) {
- return;
+ autoStartThisAnim = false;
}
$.each(defaults, function (k, v) {
}
});
- $(link).data('animation-started', true);
$.each(animations, function (k, animation) {
- $this.executeAnimation(link, $.extend({}, firstDefaults, animation));
+ $this.executeAnimation(link, $.extend({}, firstDefaults, animation), autoStartThisAnim);
});
},
- executeAnimation: function (link, animation) {
+ executeAnimation: function (link, animation, autoStart) {
+ if (autoStart === undefined) {
+ autoStart = true;
+ }
+ if (autoStart) {
+ $(link).data('animation-started', true);
+ if ($(link).data('gsap') !== undefined && $(link).data('gsap') !== null) {
+ $(link).data('gsap').play();
+ return;
+ }
+ }
+
link = $(link);
var linkElement = $(link).get(0);
if (animation.type === undefined || animation.type === '') {
var cy = h / 2;
var from = {};
var to = {};
+ var tweenFunctions = {};
var duration = 0.5;
var usegsap = true;
animation = $.extend({}, globalDefault, defaultParams, animation);
+
if (animation.duration !== undefined) {
duration = parseFloat(animation.duration);
}
to.yoyo = animation.yoyo === true || animation.yoyo === 1 || animation.yoyo === '1' || animation.yoyo === 'true';
to.repeat = parseInt(animation.repeat);
- to.repeatdelay = parseFloat(animation.repeatdelay);
+ to.repeatDelay = parseFloat(animation.repeatdelay);
var css = {};
+ if (animation.filter) {
+ css.filter = animation.filter;
+ }
animation.ease = this.fixEase(animation.ease);
if (animation.rotate !== undefined) {
}
var paper = new Raphael(link.attr('id'), w, h);
var bgc = link.attr('data-color');
- to.autoCSS = false;
to.angle = animation.startangle + 360;
to.onStart = function () {
link.css('background-color', "transparent");
};
to.onUpdate = function () {
paper.clear();
+ if (Math.abs(linkElement.angle - from.angle) < 2) {
+ return;
+ }
+ if (animation.backgroundcolor !== null && animation.backgroundcolor !== undefined) {
+ let circle = paper.circle(cx, cy, radius - 2);
+ circle.attr("fill", animation.backgroundcolor);
+ }
sector(paper, cx, cy, radius, animation.innerradius, linkElement.angle, to.angle, {
fill: bgc, stroke: 'none'
});
+
};
} else if (animation.type === 'number') {
usegsap = false;
$(link).css('pointer-events', 'auto');
var $this = this;
var draggable = new Draggable(link, {
- inertia: true, type: 'x',
- onDragStart: function () {
+ inertia: true, type: 'x', onDragStart: function () {
$this.fluidbook.touch.draggingFromOutside = true;
- },
- onRelease: function () {
+ }, onRelease: function () {
var d = this;
setTimeout(function () {
$this.fluidbook.touch.draggingFromOutside = false;
}
if (usegsap) {
to.duration = duration;
- gsap.fromTo(linkElement, from, to);
+ var a = gsap.fromTo(linkElement, from, to);
+ if (!autoStart) {
+ a.play()
+ setTimeout(function () {
+ a.pause().seek(0);
+ }, 10);
+ $(link).data('gsap', a);
+ }
+ }
+ if (autoStart) {
+ this.fluidbook.networkControl.pause((to.delay + duration + 0.5) * 1000);
}
- this.fluidbook.networkControl.pause((to.delay + duration + 0.5) * 1000);
},
fixEase: function (ease) {