]> _ Git - fluidbook-html5.git/commitdiff
Fix #610 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Aug 2016 15:31:43 +0000 (15:31 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Aug 2016 15:31:43 +0000 (15:31 +0000)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.support.js
js/libs/fluidbook/fluidbook.touch.js
js/libs/fluidbook/fluidbook.viewport.js

index ffc56d8e5b0a5c76aa47e3ac33203d6da58c6881..0b345c88f346bc0e18daa53144bd43ccd94dee39 100644 (file)
@@ -2,7 +2,6 @@
  this.l10n.__('click to call this number');
 
  */
-
 function Fluidbook(datas) {
     this.init(datas);
 }
@@ -32,12 +31,12 @@ Fluidbook.prototype = {
         this.search = new FluidbookSearch(this);
         this.pad = new FluidbookPad(this);
         this.waiters = [];
+        this.viewport = new FluidbookViewport(this);
+        this.viewport.updateViewport();
         if (Modernizr.ftouch && this.support.transitions2d && this.datas.mobileTransitions != 'none') {
             this.touch = new FluidbookTouch(this);
         }
         this.background = new FluidbookBackground(this);
-        this.viewport = new FluidbookViewport();
-        this.viewport.updateViewport();
         this.l10n = new FluidbookL10N(this, $_GET['lang']);
         this.video = new FluidbookVideo(this);
         this.bookmarks = new FluidbookBookmarks(this);
@@ -105,7 +104,7 @@ Fluidbook.prototype = {
         key('end', this.goLastPage.bind(this));
         key('left', this.goPreviousPage.bind(this));
         key('right', this.goNextPage.bind(this));
-        
+
         // See fluidbook.audiodescription.js for specific shortcuts
     },
     hideSplash: function () {
@@ -127,6 +126,11 @@ Fluidbook.prototype = {
         this.ready();
         $("#main").css('visibility', 'visible');
         this.hideLoader(0, true);
+        // See bug #610
+        if (this.touch !== undefined && this.support.android) {
+            this.touch.enableUserScale();
+        }
+
         if (this.support.transitions2d) {
             $("#splash").css('opacity', 0).one(this.support.getTransitionEndEvent(true), function () {
                 $(this).remove();
index be3b9905d983f1aa221fdb4abad2ecf20cdde057..54f4e933230454a068d3fb8a49ff9f2e469ed7fa 100644 (file)
@@ -8,6 +8,8 @@ function FluidbookSupport(fluidbook) {
     this.transitions2d = Modernizr.csstransforms && Modernizr.csstransitions;
     this.transitions3d = Modernizr.csstransforms3d && Modernizr.preserve3d && this.transitions2d;
 
+    this.androidbrowser = this.android && this.userAgent.search(/applewebkit/i) > -1;
+
     this.transitionendevent = null;
 
     if (window.resolution == 'auto') {
index 9c9144793b0e6470a0fcb87df3427efd18fd5cf8..e6c00cab249938a8fa74ab7282241e1a8ee522bf 100644 (file)
@@ -14,6 +14,7 @@ function FluidbookTouch(fluidbook) {
     this.init();
 }
 
+
 FluidbookTouch.prototype = {
     init: function () {
         this.reset();
@@ -215,11 +216,14 @@ FluidbookTouch.prototype = {
         this.reset();
     },
     enableUserScale: function () {
+        if (this.fluidbook.viewport === undefined) {
+            return;
+        }
         if (this.fluidbook.pad.enabled) {
             this.fluidbook.viewport.maxScale = 1;
             this.fluidbook.viewport.userScalable = false;
         } else {
-            this.fluidbook.viewport.maxScale = 3;
+            this.fluidbook.viewport.maxScale = 5;
             this.fluidbook.viewport.userScalable = true;
         }
         this.fluidbook.viewport.updateViewport();
index 4cb839a4729abfbe6958b67909c4555737a3b470..1e0666cbdf5ed090b15ab9e42942d1005fc0985c 100644 (file)
@@ -1,11 +1,15 @@
-function FluidbookViewport() {
+function FluidbookViewport(fluidbook) {
     this.width = 'device-width';
     this.height = null;
     this.minScale = 1;
-    this.maxScale = 10;
+    this.maxScale = 5;
     this.initialScale = 0;
-    this.userScalable = false;
+    this.userScalable = true;
     this.meta = $('meta[name="viewport"]');
+    this.fluidbook = fluidbook;
+    if (this.fluidbook.support.androidbrowser) {
+        this.userScalable = true;
+    }
 }
 
 FluidbookViewport.prototype = {
@@ -25,5 +29,6 @@ FluidbookViewport.prototype = {
         var us = this.userScalable == true ? '1' : '0';
         var value = w + h + is + 'minimum-scale=' + Math.max(0.25, this.minScale) + ', maximum-scale=' + Math.min(10, this.maxScale) + ', user-scalable=' + us + ", shrink-to-fit=no";
         this.meta.attr('content', value);
+
     }
 }
\ No newline at end of file