From 9f990769a22808c0cc47c51f64296351ceb455c2 Mon Sep 17 00:00:00 2001
From: "hendrik.donath" <Donath@itc.rwth-aachen.de>
Date: Thu, 4 Feb 2021 13:11:23 +0100
Subject: [PATCH] Fixed a scrolling bug, added some comments

---
 shared/index.js | 16 ++++++++++------
 version.php     |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/shared/index.js b/shared/index.js
index 1a9f5ae..784ad46 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -5936,15 +5936,17 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
             (0,_utils.disableUserSelect)();
         }
 
+        // Handle document.touchstart event
         function handleDocumentTouchstart(e){
-            document.documentElement.style.overflow = 'hidden';
-            document.getElementById('content-wrapper').style.overflow = 'hidden';
-            document.body.style.overflow = 'hidden';
-
             var svg=void 0;
             if(_type!=='area'||!(svg=(0,_utils.findSVGAtPoint)(e.touches[0].clientX,e.touches[0].clientY))){
                 return;
             }
+            // Disable scrolling on the page.
+            document.documentElement.style.overflow = 'hidden';
+            document.getElementById('content-wrapper').style.overflow = 'hidden';
+            document.body.style.overflow = 'hidden';
+
             var rect=svg.getBoundingClientRect();
             originY=e.touches[0].clientY;
             originX=e.touches[0].clientX;
@@ -5975,6 +5977,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
             }
         }
 
+        // Handle document.touchmove event
         function handleDocumentTouchmove(e){
             var svg=overlay.parentNode.querySelector('svg.annotationLayer');
             var rect=svg.getBoundingClientRect();
@@ -6028,8 +6031,9 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
                 }
             }
         }
-
+        // Handle document.touchend event
         function handleDocumentTouchend(e){
+            // Enable the scrolling again 
             document.documentElement.style.overflow = 'auto';
             document.getElementById('content-wrapper').style.overflow = 'auto';
             document.body.style.overflow = 'auto';
@@ -6088,7 +6092,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
         }
         
         function handleCancelClick(e){
-            // When using on mobile devices the documentscrolling will be prevented, here we have to allow it again
+            // When using on mobile devices scrolling will be prevented, here we have to allow it again.
             document.documentElement.style.overflow = 'auto';
             document.getElementById('content-wrapper').style.overflow = 'auto';
             document.body.style.overflow = 'auto';
diff --git a/version.php b/version.php
index ea0afee..cfe331d 100644
--- a/version.php
+++ b/version.php
@@ -25,6 +25,6 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'mod_pdfannotator'; // Full name of the plugin (used for diagnostics).
-$plugin->version   = 2021020300; // The current module version (Date: YYYYMMDDXX).
+$plugin->version   = 2021020400; // The current module version (Date: YYYYMMDDXX).
 $plugin->release  = 'PDF Annotator v1.4 release 5';
 $plugin->requires  = 2016112900; // Requires this Moodle version.
-- 
GitLab