From: Vincent Vanwaelscappel Date: Fri, 5 Oct 2018 15:03:50 +0000 (+0200) Subject: fix #2289 @0:50 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=62da43f8eb3a6462d967778ac67c27cafcd2a3c9;p=fluidbook-html5.git fix #2289 @0:50 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 518033c6..d07a1956 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -239,7 +239,8 @@ FluidbookLinks.prototype = { zoomZonesGap = 30, // Space between grouped zoom links gapsTotal, availableWidth = $(window).width() - (2 * zoomMargin), - availableHeight = $(window).height() - (2 * zoomMargin); + availableHeight = $(window).height() - (2 * zoomMargin), + maxZoom = parseFloat($(link).data('maxzoom')) || 2; // If the interface is zoomed in, we must zoom out first if (this.fluidbook.zoom.zoom > 1) { @@ -279,23 +280,23 @@ FluidbookLinks.prototype = { // Calculate positions and scaling for all zoomLink blocks // First, calculate stacked height of all zoomLink blocks var stackedHeight = gapsTotal + links.reduce(function (sum, zoomLink) { - return sum + (zoomLink.data('height') * zoomLink.data('maxzoom')); + return sum + (zoomLink.data('height') * maxZoom); }, 0); // Calculate side-by-side width of all zoomLink blocks var sideBySideWidth = gapsTotal + links.reduce(function (sum, zoomLink) { - return sum + (zoomLink.data('width') * zoomLink.data('maxzoom')); + return sum + (zoomLink.data('width') * maxZoom); }, 0); // Find widest element in collection var widestLink = links.reduce(function (maxWidth, zoomLink) { - var width = (zoomLink.data('width') * zoomLink.data('maxzoom')); + var width = (zoomLink.data('width') * maxZoom); return (width > maxWidth) ? width : maxWidth; }, 0); // Find tallest element in collection var tallestLink = links.reduce(function (maxHeight, zoomLink) { - var height = (zoomLink.data('height') * zoomLink.data('maxzoom')); + var height = (zoomLink.data('height') * maxZoom); return (height > maxHeight) ? height : maxHeight; }, 0); @@ -335,7 +336,7 @@ FluidbookLinks.prototype = { parent = zoomLink.closest('.link'), baseWidth = parseInt(zoomLink.data('width')), // Width of the original link from the editor baseHeight = parseInt(zoomLink.data('height')), // Height of the original link from the editor - maxZoom = parseInt(zoomLink.data('maxzoom')) || 2, // The default value for this should match that of the compiler in zoomLink::generateImage() + maxZoom = parseFloat(zoomLink.data('maxzoom')) || 2, // The default value for this should match that of the compiler in zoomLink::generateImage() zoomX, zoomY, zoomWidth, @@ -372,6 +373,9 @@ FluidbookLinks.prototype = { zoomWidth = baseWidth * zoomScale; zoomHeight = baseHeight * zoomScale; + // Max zoom of first clicked link + var firstMaxZoom = parseFloat(links[0].data('maxzoom')) || 2; + //========= // Position elements based on the layout // There are two possible layouts: stacked or side-by-side @@ -392,7 +396,7 @@ FluidbookLinks.prototype = { // Otherwise, calculate Y position based on first element position } else { - zoomY = Math.round(groupY + links[0].data('height') * links[0].data('maxzoom') * groupScale + zoomZonesGap + zoomMargin - parent.offset().top); + zoomY = Math.round(groupY + links[0].data('height') * firstMaxZoom * groupScale + zoomZonesGap + zoomMargin - parent.offset().top); } } else { // Side-by-side layout @@ -410,7 +414,7 @@ FluidbookLinks.prototype = { // Otherwise, calculate X position based on first element position } else { - zoomX = Math.round(groupX + (links[0].data('width') * links[0].data('maxzoom') * groupScale) + zoomZonesGap + zoomMargin - parent.offset().left); + zoomX = Math.round(groupX + (links[0].data('width') * firstMaxZoom * groupScale) + zoomZonesGap + zoomMargin - parent.offset().left); } } @@ -534,8 +538,11 @@ FluidbookLinks.prototype = { $(".inlineslideshow").each(function () { if ($(this).is(':visible')) { $__this.initSlideshow(this); - }else{ - + } else { + var $s = $(this); + $(this).closest('.link').on('fluidbook.link.show', function () { + $__this.initSlideshow($s); + }); } }); },