},
resizeZoomLinkBackground: function (show) {
- var top, left, bottom, right, width, height, padding;
+ var top, left, bottom, right, width, height, hpadding, vpadding;
+
+ var menuWidth = $("#zoomPopupMenu").outerWidth();
var wrappers = $('.zoomPopupWrapper');
if ($('html').hasClass('menu-burger')) {
left = 0;
width = this.fluidbook.resize.ww;
height = this.fluidbook.resize.hh;
- } else if (wrappers.length === 1) {
- var box = $(wrappers).get(0).getBoundingClientRect();
- top = box.top;
- left = box.left;
- width = box.width;
- height = box.height;
} else {
- top = Number.MAX_VALUE;
- left = Number.MAX_VALUE;
- bottom = Number.MIN_VALUE;
- right = Number.MIN_VALUE;
- wrappers.each(function () {
- var box = $(this).get(0).getBoundingClientRect();
- top = Math.min(top, box.top);
- left = Math.min(left, box.left);
- right = Math.max(right, box.right);
- bottom = Math.max(bottom, box.bottom);
- });
- padding = 20;
- width = right - left + 2 * padding;
- height = bottom - top + 2 * padding;
- top -= padding;
- left -= padding;
+ var box = $(wrappers).get(0).getBoundingClientRect();
+ if (wrappers.length === 1 && menuWidth < box.width) {
+ top = box.top;
+ left = box.left;
+ width = box.width;
+ height = box.height;
+ } else {
+ top = Number.MAX_VALUE;
+ left = Number.MAX_VALUE;
+ bottom = Number.MIN_VALUE;
+ right = Number.MIN_VALUE;
+ wrappers.each(function () {
+ var box = $(this).get(0).getBoundingClientRect();
+ top = Math.min(top, box.top);
+ left = Math.min(left, box.left);
+ right = Math.max(right, box.right);
+ bottom = Math.max(bottom, box.bottom);
+ });
+ vpadding = hpadding = 20;
+ width = right - left + 2 * hpadding;
+ if (width < menuWidth) {
+ hpadding = (menuWidth - (right - left)) / 2;
+ width = right - left + 2 * hpadding;
+ }
+ height = bottom - top + 2 * vpadding;
+ top -= vpadding;
+ left -= hpadding;
+ }
}
$("#zoomPopupBackground").css({left: left, top: top, width: width, height: height, opacity: show ? 1 : 0});