]> _ Git - fluidbook-html5.git/commitdiff
done #1503 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Jun 2017 15:40:40 +0000 (17:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Jun 2017 15:40:40 +0000 (17:40 +0200)
js/libs/fluidbook/fluidbook.menu.js

index 1b04a0de76cf7547307484d1d0ea9c773b017415..7c05a434dd96e1118c650f5a090965f8c6c8ab7f 100644 (file)
@@ -530,35 +530,44 @@ FluidbookMenu.prototype = {
                 if (readmode) {
                     w = Math.max(w * 0.5, nw);
                     forceHeight = false;
+
                     if (w > ww * 0.9) {
                         fullscreen = true;
                         w = ww;
                         h = hh;
+                        s = ww / nw;
+
+                    } else {
+                        s = w / nw;
+
                     }
+                    x = 0;
+                    y = 0;
                 } else {
                     forceHeight = true;
 
                     s = Math.min(w / nw, h / nh);
-                    if (iframe.is('img')) {
+                    if (iframe.is('img') || fullscreen) {
                         s = Math.min(1, s);
                     }
                     if (!fullscreen) {
                         w = nw * s;
                         h = nh * s;
                     }
-                    x = ( w - (nw * s)  ) / 2;
-                    y = (h - (nh * s)) / 2;
 
-                    if (s < 1) {
-                        var css = {overflow: 'hidden', width: nw * s, height: nh * s};
-                        m.find('.multimediaHolder').css(css);
-                    } else {
-                        m.find('.multimediaHolder').css({width: '', height: ''});
-                    }
+                    x = (w - (nw * s)  ) / 2;
+                    y = (h - (nh * s)) / 2;
                 }
 
 
-                m.find('.multimediaScale').css({width: nw, height: nh, overflow: 'hidden'}).transform({translateX: x + 'px', translateY: y + 'px', scale: [s, s], origin: [0, 0]}).css('text-align', 'left');
+                if (s < 1) {
+                    var css = {overflow: 'hidden', width: nw * s, height: nh * s, top: y, left: x, position: 'absolute'};
+                    m.find('.multimediaHolder').css(css);
+                } else {
+                    m.find('.multimediaHolder').css({position: "", overflow: '', width: '', height: '', top: '', left: ''});
+                }
+
+                m.find('.multimediaScale').css({width: nw, height: nh, overflow: 'hidden'}).transform({scale: [s, s], origin: [0, 0]}).css('text-align', 'left');
                 break;
             default:
                 break;