]> _ Git - fluidbook-html5.git/commitdiff
fix #3184 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Nov 2019 17:00:00 +0000 (18:00 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Nov 2019 17:00:00 +0000 (18:00 +0100)
js/libs/fluidbook/links/fluidbook.links.zoom.js
style/fluidbook.less

index e2ad70a076208a312fa3dd2230deef23f54a3205..5b6a815e5a5a150c7f40fb30a4133ca63c1556ef 100644 (file)
@@ -285,7 +285,9 @@ FluidbookLinksZoom.prototype = {
     },
 
     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')) {
@@ -293,29 +295,35 @@ FluidbookLinksZoom.prototype = {
             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});
index 29dbadde1aa85857f756b99503172fb83dbfc151..309c2efac6eb51b9e1aecf2e6c383e0fad309616 100644 (file)
@@ -2772,6 +2772,10 @@ ul.chapters {
       width: auto;
       white-space: nowrap;
 
+      &:first-child{
+        margin-left: 0;
+      }
+
       .menu-burger & {
         padding: 10px 20px 10px 10px;
         height: 60px;