]> _ Git - fluidbook-html5.git/commitdiff
wait #7193 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Nov 2024 18:40:12 +0000 (19:40 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Nov 2024 18:40:12 +0000 (19:40 +0100)
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.pagetransitions.js
js/libs/fluidbook/fluidbook.tooltip.js

index a91a0c92ea6eebffe0e7231d71ccf27aa2e2a890..66d411682e71ae3d61fadb61e2e3ceebf327d989 100644 (file)
@@ -28,7 +28,7 @@ FluidbookBookmarks.prototype = {
         var $this = this;
         $(document).on(this.fluidbook.input.clickEvent, '.bookmark', function () {
             $this.toggleBookmark(parseInt($(this).attr('data-page')));
-            $this.fluidbook.tooltip.hideTooltip();
+            $this.fluidbook.tooltip.hideTooltip('bookmark');
             return false;
         });
 
index 3d973e247a7bf6653fef2cf2309de528702508ed..2ba85a85bc59cab34bbc1e93da99971c3798e73f 100644 (file)
@@ -160,7 +160,7 @@ FluidbookMenu.prototype = {
     openingView: function (callback, view) {
         var $this = this;
         this.fluidbook.resize.resizeView();
-        this.fluidbook.tooltip.hideTooltip();
+        this.fluidbook.tooltip.hideTooltip('openingView');
         var mview = $('#view .mview:last');
 
         $("#view").attr('aria-hidden', 'false');
index 2c541509c4b345a8b5525111b46458831bbe59e1..d322341f802e0fad2db49eb01efde74f6aa38639 100644 (file)
@@ -91,7 +91,7 @@ FluidbookPageTransition.prototype = {
 
         $(this.fluidbook).trigger('fluidbook.beforePageTransition');
 
-        this.fluidbook.tooltip.hideTooltip();
+        this.fluidbook.tooltip.hideTooltip('beforePageTransition');
         pageNr = this.normalizeTransitionPageNr(pageNr);
         if (transitionType === undefined) {
             transitionType = this.getTransitionType(pageNr);
@@ -464,7 +464,7 @@ FluidbookPageTransition.prototype = {
             turningPages: turning.flip
         }]);
         var $this = this;
-        this.fluidbook.tooltip.hideTooltip();
+        this.fluidbook.tooltip.hideTooltip('beforeTransition');
         $(".axis_y").removeClass('axis_y');
         $(".axis_x").removeClass('axis_x');
         $("#links").hide();
index 7e4aa63ca65d23669cedd8f21e42119c6c464f50..25e16e480bd08b5d2937c06b814e2a04ed0a8752 100644 (file)
@@ -14,7 +14,7 @@ FluidbookTooltip.prototype = {
         $(window).on('mousemove', function (e) {
             if ($this.type === 'keyboard') {
                 $this.type = 'mouse';
-                $this.hideTooltip();
+                $this.hideTooltip('mousemove');
             }
             $this.updateMousePosition(e);
         });
@@ -25,10 +25,21 @@ FluidbookTooltip.prototype = {
 
 
         $(document).on(this.fluidbook.input.hoverEvent, '[data-tooltip]', function (e) {
-            $this.type = 'mouse';
-            $this.updateMousePosition(e);
-            $this.eventTriggered(this);
+            if (!$this.fluidbook.input.isUsingTouch()) {
+                $this.type = 'mouse';
+                $this.updateMousePosition(e);
+                $this.eventTriggered(this);
+            }
         });
+
+        $(document).on('click', '[data-tooltip]', function (e) {
+            if ($this.fluidbook.input.isUsingTouch()) {
+                $this.type = 'touch';
+                $this.updateMousePosition(e);
+                $this.eventTriggered(this);
+            }
+        });
+
         $(document).on('focus', '[data-tooltip],[data-keyboard-tooltip]', function (e) {
             if ($('body').hasClass('keyboard-navigating')) {
                 $this.type = 'keyboard';
@@ -38,10 +49,10 @@ FluidbookTooltip.prototype = {
             }
         });
         $(document).on('blur', '[data-tooltip],[data-keyboard-tooltip]', function (e) {
-            $this.hideTooltip();
+            $this.hideTooltip('blur');
         });
         $(document).on(this.fluidbook.input.clickEvent, '[data-tooltip-hide-on-click]', function () {
-            $this.hideTooltip();
+            $this.hideTooltip('hide on click');
         });
 
         $("body").append('<div id="tooltip" role="tooltip"></div>');
@@ -88,8 +99,7 @@ FluidbookTooltip.prototype = {
         var maxy = this.fluidbook.resize.hh - h;
 
         $("#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))
+            top: Math.max(1, Math.min(top, maxy)), left: Math.max(1, Math.min(left, maxx))
         });
     },
 
@@ -146,11 +156,11 @@ FluidbookTooltip.prototype = {
 
         if (fluidbook.input.isUsingTouch()) {
             $(document).one("touchstart", function () {
-                $this.hideTooltip();
+                $this.hideTooltip('touchstart');
             });
         } else {
             $(target).one('mouseout', function () {
-                $this.hideTooltip();
+                $this.hideTooltip('mouseout');
             });
         }
 
@@ -162,13 +172,14 @@ FluidbookTooltip.prototype = {
         this.displayTooltip(text, style, css);
         let $this = this;
         setTimeout(function () {
-            $this.hideTooltip();
+            $this.hideTooltip('afterDuration');
         }, duration);
     },
 
     displayTooltip: function (text, style, css) {
+        console.log('displayTooltip', text, style, css);
         if (text === '-') {
-            return this.hideTooltip();
+            return this.hideTooltip('before displayTooltip');
         }
         if ($('.fixedTooltip:visible').length > 0) {
             return;
@@ -218,11 +229,14 @@ FluidbookTooltip.prototype = {
         this.updateTooltipPosition();
         return true;
     },
-    hideTooltip: function () {
+
+    hideTooltip: function (where) {
+        console.log('hide tooltip', where);
         $("#tooltip").hide().text('');
     },
+
     showFixedTooltip: function (e, posX, posY, css) {
-        this.hideTooltip();
+        this.hideTooltip("beforeFixedTooltip");
         $(e).attr('data-pos-x', posX).attr('data-pos-y', posY).css(css).show();
         $(document).one(this.fluidbook.input.clickEvent, '*', function () {
             $(e).hide();