]> _ Git - fluidbook-html5.git/commitdiff
wait #6921 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 May 2024 11:17:07 +0000 (13:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 May 2024 11:17:07 +0000 (13:17 +0200)
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.utils.js

index 5d68fb62ff0db01102418afb4deffd089ebf19d9..b0f7813f3697a76d0d4adc16cfbf8d8a3736812e 100644 (file)
@@ -140,6 +140,7 @@ FluidbookMenu.prototype = {
     },
 
     openPDF: function (uid, callback) {
+        let $this=this;
         var infos = this.fluidbook.settings.pdfLinks[uid];
         let c = this.getCaption('', 'nocaption', 'nocaption');
         c += '<div class="content"><div class="pdf-holder"><iframe class="pdf view ' + infos.interface + '" data-width="' + infos.width + '" data-height="' + infos.height + '" data-total-height="' + infos.totalHeight + '" frameborder="0" scrolling="no" src="pdfjs/web/viewer.html?&file=../../data/links/' + infos.file + '#zoom=page-width"></iframe></div></div>';
@@ -147,6 +148,12 @@ FluidbookMenu.prototype = {
         if (callback != undefined) {
             callback();
         }
+
+        $('iframe.pdf.view').each(function () {
+            relayIframeScrollToView($(this));
+        });
+
+
         this.fluidbook.displayLoader();
     },
 
index 685b47281bdf40bbdd9cbbac998a1fa1f39e5984..e82276a0fb5df0a5d96b12d13e55fb5b57fd6259 100644 (file)
@@ -156,3 +156,19 @@ function parseTransformOriginComponent(c) {
     }
 }
 
+function relayIframeScrollToView(iframe) {
+    var view = iframe.parent().parent();
+    console.log(view, this);
+    $(this).on('load', function () {
+        var body = $(this).contents().find('body');
+        var m = 25;
+        $(body).on('mousewheel', function (e) {
+            var d = (e.deltaY * m);
+            var v = '-=' + d;
+            if (e.deltaY < 0) {
+                v = '+=' + (d * -1);
+            }
+            $(view).scrollTo(v);
+        });
+    });
+}