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) {
// 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);
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,
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
// 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
// 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);
}
}
$(".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);
+ });
}
});
},