]> _ Git - fluidbook-html5.git/commitdiff
Fix #1469 @0.75
authorStephen Cameron <stephen@cubedesigners.com>
Fri, 30 Jun 2017 09:36:43 +0000 (11:36 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Fri, 30 Jun 2017 09:36:43 +0000 (11:36 +0200)
js/libs/fluidbook/fluidbook.video.js

index b7173e8fdf46e1450c51b6ff28aca40bb44d8fe4..a7dbfc827b731ed95bd8ddc777b641f928b961ca 100644 (file)
@@ -381,7 +381,18 @@ FluidbookVideo.prototype = {
             if (videojs(id) && videojs(id).isFullscreen()) {
                 $(this).attr('style', ''); // Clear scaling for fullscreen player
             } else {
-                $(this).css('fontSize', 12 / fluidbook.resize.bookScale);
+                var scaledFontSize = 12 / fluidbook.resize.bookScale,
+                    scaledWidth = $(this).width() * fluidbook.resize.bookScale, // Actual screen width in pixels
+                    breakpoint = 400; // Width of player when it should start scaling down all elements as width reduces
+
+                // Sometimes the player might be very small so we need to
+                // scale the font size differently in this case to make it fit
+                if (scaledWidth < breakpoint) {
+                    $(this).css('fontSize', scaledFontSize * scaledWidth / breakpoint);
+                } else {
+                    $(this).css('fontSize', scaledFontSize);
+                }
+
             }
         });
     },