]> _ Git - fluidbook-html5.git/commitdiff
wip #3754 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Jul 2020 14:17:02 +0000 (16:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Jul 2020 14:17:02 +0000 (16:17 +0200)
js/libs/fluidbook/fluidbook.menu.js

index bfce9abb0f39c6cd3fa0caa8af7414cc03908891..604669e631dffcac44973b9cb0611b449c571d55 100644 (file)
@@ -38,7 +38,7 @@ FluidbookMenu.prototype = {
     },
 
     _openView: function (view, param1, param2, callback) {
-        console.log(view,param1,param2);
+        console.log(view, param1, param2);
         var $this = this;
         var preload = {
             index: 'thumbnails',
@@ -193,7 +193,12 @@ FluidbookMenu.prototype = {
         view += markup;
         view += '</div></div>';
 
-        $("#view").append('<div class="mview" dir="ltr" data-menu="iframe">' + view + '</div>');
+        var maxWidth = '';
+        if ($(a).data('max-width')) {
+            maxWidth = ' data-max-width="' + $(a).data('max-width') + '"';
+        }
+
+        $("#view").append('<div class="mview" dir="ltr" data-menu="iframe"' + maxWidth + '>' + view + '</div>');
         if (callback != undefined) {
             callback();
         }
@@ -596,6 +601,11 @@ FluidbookMenu.prototype = {
 
         $("#viewOverlay").css({width: ww, height: hh});
 
+        var maxWidth = 100000;
+        if (m.data('max-width')) {
+            maxWidth = m.data('max-width');
+        }
+
         switch (m.data('menu')) {
             case 'chapters':
                 this.fluidbook.settings.chaptersColumns = Math.max(1, Math.min(6, this.fluidbook.settings.chaptersColumns));
@@ -672,6 +682,8 @@ FluidbookMenu.prototype = {
                 }
                 forceHeight = true;
 
+                w = Math.min(w, maxWidth);
+
                 var iframe = $("#view .iframeHolder iframe");
                 iframe.css('width', w);
                 try {
@@ -914,7 +926,6 @@ FluidbookMenu.prototype = {
                 }
                 break;
             default:
-                var maxWidth = 10000;
                 if (m.data('maxwidth') !== null) {
                     maxWidth = parseInt(m.data('maxwidth'));
                 }
@@ -927,6 +938,8 @@ FluidbookMenu.prototype = {
             captionHeight += $(this).outerHeight();
         })
 
+        w = Math.min(maxWidth, w);
+
         css = {};
         ccss = {};
         if (fullscreen) {
@@ -940,6 +953,7 @@ FluidbookMenu.prototype = {
             m.removeClass('fs');
         }
 
+
         css.maxWidth = css.minWidth = css.width = w;
         css.maxHeight = h;