]> _ Git - fluidbook-html5.git/commitdiff
wait #5503 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 17:14:06 +0000 (19:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 17:14:06 +0000 (19:14 +0200)
js/libs/fluidbook/fluidbook.resize.js

index a5656db23d408d3025e9cf01b427e43e011fbd47..35fd61c8f8190e989b08dfcd21ca042cefc1c854 100644 (file)
@@ -36,6 +36,10 @@ FluidbookResize.prototype = {
         return this.fluidbook.mobilefirst.enabled || (this.orientation === 'portrait' && (this.fluidbook.support.iOS || this.fluidbook.support.android));
     },
 
+    reduceVerticalMargins: function () {
+        return this.fluidbook.settings.mobileReducedMargins && this.orientation === 'portrait' && this.fluidbook.nav.burgerActive();
+    },
+
     setMargins: function () {
         var marginV = 20;
         var marginY = marginV;
@@ -49,6 +53,12 @@ FluidbookResize.prototype = {
         this.margintop = marginY + parseInt(this.fluidbook.settings.extraYSpace);
         this.marginbottom = marginY + marginV;
         this.marginright = this.marginleft;
+
+        if (this.reduceVerticalMargins()) {
+            this.margintop -= parseInt(this.fluidbook.settings.extraYSpace)
+            this.margintop -= 65;
+            this.marginbottom -= 30;
+        }
     },
 
     init: function () {
@@ -150,8 +160,7 @@ FluidbookResize.prototype = {
         var cssHeaderScale = [headerScale, headerScale];
 
         $("#main,#z,#scroll").css({
-            width: this.ww,
-            height: this.hh
+            width: this.ww, height: this.hh
         });
 
         this.resizeView();
@@ -220,8 +229,7 @@ FluidbookResize.prototype = {
         // var pageNumberScale = Math.min(1, 1 / (this.bookScale / 0.5));
         // $("#pagesnumbers").css('font-size', $("#pagesnumbers").data('size') * pageNumberScale);
         $("#pagesnumbers").css({
-            'transform': 'scale(' + (this.bookScale) + ')',
-            top: this.fh
+            'transform': 'scale(' + (this.bookScale) + ')', top: this.fh
         });
 
         if (this.fluidbook._boolean(this.fluidbook.settings.logoHideWhenOverriden)) {
@@ -245,8 +253,7 @@ FluidbookResize.prototype = {
         // Position audio buttons relative to book size and position
         var audioButtonPosition = Math.max(this.hh / 6, 30 * interfaceScale); // Ensure at least 30px clearance at the bottom
         $(".audio-description-button").css({
-            scale: cssInterfaceScale,
-            bottom: audioButtonPosition
+            scale: cssInterfaceScale, bottom: audioButtonPosition
         });
 
         $("#logo,footer,#searchHints").transform({
@@ -260,8 +267,7 @@ FluidbookResize.prototype = {
 
         var headerHeight = this.fluidbook.settings.menuHeight * navScale;
         $('header').css({
-            height: headerHeight,
-            backgroundSize: '100% ' + headerHeight + 'px'
+            height: headerHeight, backgroundSize: '100% ' + headerHeight + 'px'
         });
 
         this.refw = this.fw;
@@ -365,8 +371,7 @@ FluidbookResize.prototype = {
 
     resizeEdges: function () {
         $("#edges").css({
-            transform: 'scale(' + this.bookScale + ')',
-            transformOrigin: '0 0'
+            transform: 'scale(' + this.bookScale + ')', transformOrigin: '0 0'
         });
     },
 
@@ -383,12 +388,9 @@ FluidbookResize.prototype = {
 
     resizeShadow: function () {
         $("#shadow").transform({
-            scale: [this.bookScale, this.bookScale],
-            origin: this.origin,
+            scale: [this.bookScale, this.bookScale], origin: this.origin,
         }).css({
-            width: this.fww,
-            left: this._left(this.fww),
-            top: this._top(this.fhh),
+            width: this.fww, left: this._left(this.fww), top: this._top(this.fhh),
         });
     },
 
@@ -452,8 +454,7 @@ FluidbookResize.prototype = {
             return;
         }
         $("#splash").css({
-            width: this.ww,
-            height: this.hh
+            width: this.ww, height: this.hh
         });
 
         if ($("#splash").css('opacity') == 0) {
@@ -464,23 +465,19 @@ FluidbookResize.prototype = {
         var lh = $("#splash .logo").height();
 
         $("#splash .logo").css({
-            top: (this.hh / 2) - 30 - lh - 10,
-            left: Math.max((this.ww - lw) / 2, 0) // Prevent negative left offsets
+            top: (this.hh / 2) - 30 - lh - 10, left: Math.max((this.ww - lw) / 2, 0) // Prevent negative left offsets
         });
-    },
-    updateWindow: function () {
+    }, updateWindow: function () {
         this.ww = $(window).width();
         this.hh = $(window).height();
         if (window.innerHeight && window.innerHeight != this.hh) {
             this.hh = window.innerHeight;
         }
-    },
-    resizeView: function () {
+    }, resizeView: function () {
         var $this = this;
         this.updateWindow();
         this.fluidbook.menu.resize(this.ww, this.hh);
-    },
-    handleOrientation: function (forceChange) {
+    }, handleOrientation: function (forceChange) {
         var $this = this;
         if (forceChange === undefined) {
             forceChange = false;
@@ -529,8 +526,7 @@ FluidbookResize.prototype = {
                 }, 2000);
             }
         }
-    },
-    getScreenFluidbookWidth: function () {
+    }, getScreenFluidbookWidth: function () {
         return $("#fluidbook").outerWidth();
     },