]> _ Git - fluidbook-html5.git/commitdiff
wip #1392 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Jun 2017 18:37:17 +0000 (20:37 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Jun 2017 18:37:17 +0000 (20:37 +0200)
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.tooltip.js
style/fluidbook.less

index c3018e23b04f1e25be6cdd536d9572304edd0aaf..e66d8864249dea52e989a1a6f8aafcec43ed2516 100644 (file)
@@ -9,10 +9,17 @@ FluidbookMenu.prototype = {
         var $this = this;
 
         $(document).on('click', ".mview .back", function () {
+            var currentHash = window.location.hash;
             window.location.hash = '/page/' + $this.fluidbook.currentPage;
+            if (window.location.hash == currentHash) {
+                $this.closeView(function () {
+                }, true);
+            }
+
             return false;
         });
 
+
     },
 
     viewMode: function () {
@@ -79,6 +86,8 @@ FluidbookMenu.prototype = {
             this.openChapters(cb);
         } else if (view == 'archives') {
             this.openArchives($("#nav #archives").data('tooltip'), cb);
+        } else if (view == 'text') {
+            this.openText(param1, cb);
         } else {
             this['open' + camelView](param1, param2, cb);
         }
@@ -100,8 +109,9 @@ FluidbookMenu.prototype = {
         var from = {y: -200, opacity: 0};
         var to = {
             y: 0, opacity: 1, onComplete: function () {
-                //console.log('end opening view');
-                callback();
+                if (callback != undefined) {
+                    callback();
+                }
                 $this.fluidbook.hideLoader();
                 resize();
             }
@@ -110,7 +120,6 @@ FluidbookMenu.prototype = {
             from.y = 0;
         }
         TweenMax.fromTo($(mview), 0.5, from, to);
-
     },
 
     displayResults: function (data, group, callback) {
@@ -189,8 +198,7 @@ FluidbookMenu.prototype = {
         if (callback != undefined) {
             callback();
         }
-    }
-    ,
+    },
     openVideo: function (video, callback) {
         var a = $('a[href="#/video/' + video + '"]');
         var markup = decodeURIComponent($(a).attr('data-video'));
@@ -389,8 +397,15 @@ FluidbookMenu.prototype = {
         if (callback != undefined) {
             callback();
         }
-    }
-    ,
+    },
+    openText: function (text, callback) {
+        var t = '<div class="caption">' + this.closeButton() + '<h2></h2></div>';
+        t += '<div class="content"><div class="text">' + text + '</div></div>';
+        $("#view").append('<div class="mview" data-menu="text">' + t + '</div>');
+        if (callback != undefined) {
+            callback();
+        }
+    },
     closeView: function (callback, all, animate) {
         this.hideOverlay();
         var $this = this;
@@ -455,6 +470,10 @@ FluidbookMenu.prototype = {
                     forceHeight = true;
                 }
                 break;
+            case 'text':
+                w = 600;
+                fullscreen = (w >= ww * 0.9);
+                break;
             case 'index':
                 fullscreen = true;
                 break;
index 38839dc68160d1eef45f075216b3116c018cb5ef..06313a9ff37e2eabb644ffbeb499fc05f2802ebf 100644 (file)
@@ -18,16 +18,15 @@ FluidbookTooltip.prototype = {
             $("#tooltip").transform({scale: 1 / zoom}).css({'marginTop': 20 / zoom, 'marginLeft': -10 / zoom});
         });
 
-
         if (Modernizr.ftouch) {
             $(document).on('touchstart', 'a[data-tooltip-touch][data-tooltip]', function (e) {
                 $this.updateMousePosition(e);
-                return $this.eventTriggered(this);
+                $this.eventTriggered(this);
             });
         } else {
             $(document).on('mouseover', 'a[data-tooltip]', function (e) {
                 $this.updateMousePosition(e);
-                return $this.eventTriggered(this);
+                $this.eventTriggered(this);
             });
         }
         $("body").append('<div id="tooltip"></div>');
@@ -67,10 +66,13 @@ FluidbookTooltip.prototype = {
             offsetX = 26 - w;
         }
 
+
         var top = this.mouseY + offsetY;
         var left = this.mouseX + offsetX;
+        var maxx = this.fluidbook.resize.ww - w;
+        var maxy = this.fluidbook.resize.hh - h;
 
-        $("#tooltip").attr('data-pos-x', x).attr('data-pos-y', y).css({top: Math.max(1, top), left: Math.max(1, left)});
+        $("#tooltip").attr('data-pos-x', x).attr('data-pos-y', y).css({top: Math.max(1, Math.min(top, maxy)), left: Math.max(1, Math.min(left, maxx))});
     },
 
     eventTriggered: function (target) {
@@ -109,7 +111,7 @@ FluidbookTooltip.prototype = {
         t.css('maxWidth', 250).html(text).show()
 
         var nbchars = t.text().length;
-        var maxWidth = Math.max(250, Math.min(750, nbchars*1.2));
+        var maxWidth = Math.min(this.fluidbook.resize.ww, Math.max(250, Math.min(750, nbchars * 1.2)));
 
         for (var w = 250; w <= maxWidth; w += 25) {
             if ((t.height() * 1.5) > t.width()) {
@@ -119,6 +121,13 @@ FluidbookTooltip.prototype = {
             }
         }
 
+        if (t.outerHeight() > this.fluidbook.resize.hh / 2) {
+            t.hide();
+            this.fluidbook.menu.__openView('text', text, function () {
+            });
+            return false;
+        }
+
         return true;
     },
     hideTooltip: function () {
index 8916c698810cef91a869fe40312ccdd448fd38bf..93bb4e208c13bd47e6369b84c4f7ff8af6417242 100644 (file)
@@ -55,7 +55,6 @@ a {
        -o-box-sizing: border-box;
 
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-       -ms-touch-action: double-tap-zoom pinch-zoom;
        -ms-scroll-chaining: chained;
 
        -webkit-font-smoothing: antialiased;
@@ -74,17 +73,15 @@ b, strong, h1, h2, h3, h4, h5, h6 {
        font-weight: 600;
 }
 
-.pan, .pan * {
-       -ms-touch-action: auto;
-       touch-action: auto;
-}
-
 html {
        user-select: text;
        -moz-user-select: text;
        -webkit-user-select: text;
        -o-user-select: text;
        -ms-user-select: text;
+       &.ios {
+               position: fixed;
+       }
 }
 
 body {
@@ -213,6 +210,7 @@ body, html {
 
 /* Pages */
 .background, .texts {
+       pointer-events: none;
        position: absolute;
        top: 0px;
        left: 0px;
@@ -239,6 +237,10 @@ body, html {
 
 /* Espaces forcés */
 
+#currentDoublePage{
+       pointer-events: none;
+}
+
 .page {
        overflow: hidden;
        position: absolute;
@@ -736,8 +738,6 @@ html.ios body.portrait #interface {
 .link.multimedia {
        position: absolute;
        z-index: 1 !important;
-       -ms-touch-action: manipulation;
-       touch-action: manipulation;
 
        &.notinteractive {
                pointer-events: none;
@@ -1424,6 +1424,13 @@ ul.chapters.shareList a.level0 img {
        display: block;
 }
 
+/* texts */
+.mview .text {
+       padding: 20px;
+       white-space: pre-line;
+       text-align: left;
+}
+
 /* Chapters */
 
 ul.chapters {