box = $link[0].getBoundingClientRect(),
parent = $link.closest('.link'),
maxZoom = parseInt($link.data('maxzoom')) || 2,
+ baseWidth = parseInt($link.data('width')),
+ baseHeight = parseInt($link.data('height')),
x,
y,
zoomWidth,
var linkId = $(parent).attr('id').split('_', 2)[1];
var zoomImage = 'data/links/zoom_' + linkId + '.jpg';
-
// Calculate best scale factor to fit and also to honour the maxZoom level
- zoomScale = Math.min((availableWidth / box.width), (availableHeight / box.height), maxZoom);
+ zoomScale = Math.min((availableWidth / baseWidth), (availableHeight / baseHeight), maxZoom);
+
+ console.log('Maxzoom = ' + maxZoom + ' | zoomScale is: ' + zoomScale);
- zoomWidth = box.width * zoomScale;
- zoomHeight = box.height * zoomScale;
+ zoomWidth = baseWidth * zoomScale;
+ zoomHeight = baseHeight * zoomScale;
// Calculate translate co-ordinates
x = availableWidth / 2 - parent.offset().left - zoomWidth / 2 + zoomMargin;
z.css({
transform: 'none',
- width: box.width,
- height: box.height,
+ width: Math.round(box.width), // Rounded to prevent scaling discrepancies against zoom image
+ height: Math.round(box.height),
left: box.left,
top: box.top
});
this.fluidbook.hideLoader();
z.show();
- var s = (zoomWidth / box.width);
+ var s = (zoomWidth / Math.round(box.width));
$(".zoomPopupClose").css('opacity', 0).transform({scale: (0.5 * this.fluidbook.resize.interfaceScale) / s, origin: ['100%', '0', 0]});
setTimeout(function () {
z.css({