Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-mod_pdfannotator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-mod_pdfannotator
Commits
b255c857
Commit
b255c857
authored
4 years ago
by
hendrik.donath
Committed by
Friederike Schwager
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Strikeout and Highlight annotation are now possible to use for mobile devices
parent
06dca502
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
shared/index.js
+344
-348
344 additions, 348 deletions
shared/index.js
version.php
+1
-1
1 addition, 1 deletion
version.php
with
345 additions
and
349 deletions
shared/index.js
+
344
−
348
View file @
b255c857
...
@@ -5934,7 +5934,33 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -5934,7 +5934,33 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
svg.parentNode.appendChild(overlay);
svg.parentNode.appendChild(overlay);
document.addEventListener('mousemove',handleDocumentMousemove);
document.addEventListener('mousemove',handleDocumentMousemove);
(0,_utils.disableUserSelect)();
(0,_utils.disableUserSelect)();
}/**
}
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;
}
var rect=svg.getBoundingClientRect();
originY=e.touches[0].clientY;
originX=e.touches[0].clientX;
overlay=document.createElement('div');
overlay.style.position='absolute';
overlay.style.top=originY-rect.top+'px';
overlay.style.left=originX-rect.left+'px';
overlay.style.border='3px solid '+_utils.BORDER_COLOR;
overlay.style.borderRadius='3px';
svg.parentNode.appendChild(overlay);
document.addEventListener('touchmove',handleDocumentTouchmove);
(0,_utils.disableUserSelect)();
}
/**
* Handle document.mousemove event
* Handle document.mousemove event
*
*
* @param {Event} e The DOM event to handle
* @param {Event} e The DOM event to handle
...
@@ -5949,6 +5975,17 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -5949,6 +5975,17 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
}
}
}
}
function handleDocumentTouchmove(e){
var svg=overlay.parentNode.querySelector('svg.annotationLayer');
var rect=svg.getBoundingClientRect();
if(originX+(e.touches[0].clientX-originX)<rect.right){
overlay.style.width=e.touches[0].clientX-originX+'px';
}
if(originY+(e.touches[0].clientY-originY)<rect.bottom){
overlay.style.height=e.touches[0].clientY-originY+'px';
}
}
/**
/**
* Tests if the overlay is too small. An overlay is too small if the width or height are less 10 px or are NaN
* Tests if the overlay is too small. An overlay is too small if the width or height are less 10 px or are NaN
* @param {type} overlay
* @param {type} overlay
...
@@ -5992,46 +6029,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -5992,46 +6029,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
}
}
}
}
function handleDocumentTouchend(e){
function handeContentTouchstart(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;
}
var rect=svg.getBoundingClientRect();
originY=e.touches[0].clientY;
originX=e.touches[0].clientX;
overlay=document.createElement('div');
overlay.style.position='absolute';
overlay.style.top=originY-rect.top+'px';
overlay.style.left=originX-rect.left+'px';
overlay.style.border='3px solid '+_utils.BORDER_COLOR;
overlay.style.borderRadius='3px';
svg.parentNode.appendChild(overlay);
(0,_utils.disableUserSelect)();
}
function handeContentTouchmove(e) {
var svg=overlay.parentNode.querySelector('svg.annotationLayer');
var rect=svg.getBoundingClientRect();
if(originX+(e.touches[0].clientX-originX)<rect.right){
overlay.style.width=e.touches[0].clientX-originX+'px';
}
if(originY+(e.touches[0].clientY-originY)<rect.bottom){
overlay.style.height=e.touches[0].clientY-originY+'px';
}
}
function handeContentTouchend(e) {
document.documentElement.style.overflow = 'auto';
document.documentElement.style.overflow = 'auto';
document.getElementById('content-wrapper').style.overflow = 'auto';
document.getElementById('content-wrapper').style.overflow = 'auto';
document.body.style.overflow = 'auto';
document.body.style.overflow = 'auto';
//if the cursor is clicked nothing should happen!
if((typeof e.target.getAttribute('className')!='string') && e.target.className.indexOf('cursor') === -1){
if((typeof e.target.getAttribute('className')!='string') && e.target.className.indexOf('cursor') === -1){
document.removeEventListener('touchmove',handleDocumentTouchmove);
disableRect();
disableRect();
if(_type==='area'&&overlay){
if(_type==='area'&&overlay){
if(isOverlayTooSmall(overlay)){
if(isOverlayTooSmall(overlay)){
...
@@ -6057,12 +6062,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6057,12 +6062,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
}
}
}
}
function handeContentTouchcancel(e) {
document.documentElement.style.overflow = 'auto';
document.getElementById('content-wrapper').style.overflow = 'auto';
document.body.style.overflow = 'auto';
}
function handleToolbarClick(e){
function handleToolbarClick(e){
//delete Overlay
//delete Overlay
if(_type==='area'&&overlay){
if(_type==='area'&&overlay){
...
@@ -6074,6 +6073,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6074,6 +6073,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
deleteUndefinedRect();
deleteUndefinedRect();
}
}
function handleSubmitClick(e){
function handleSubmitClick(e){
var rects=void 0;
var rects=void 0;
if(_type!=='area'&&(rects=rectsSelection)){
if(_type!=='area'&&(rects=rectsSelection)){
...
@@ -6088,6 +6088,11 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6088,6 +6088,11 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
}
}
function handleCancelClick(e){
function handleCancelClick(e){
// When using on mobile devices the documentscrolling 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';
//delete Overlay
//delete Overlay
if(_type==='area'&&overlay){
if(_type==='area'&&overlay){
overlay.parentNode.removeChild(overlay);
overlay.parentNode.removeChild(overlay);
...
@@ -6110,8 +6115,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6110,8 +6115,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
deleteUndefinedRect();
deleteUndefinedRect();
}
}
/**
/**
* Handle document.keyup event
* Handle document.keyup event
*
*
...
@@ -6140,6 +6143,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6140,6 +6143,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
}
}
}
}
function initializeAnnotation(type,rects,color,svg){
function initializeAnnotation(type,rects,color,svg){
var node=void 0;
var node=void 0;
...
@@ -6172,6 +6176,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6172,6 +6176,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
return annotation;
return annotation;
}
}
/**
/**
* Save a rect annotation
* Save a rect annotation
*
*
...
@@ -6195,7 +6200,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6195,7 +6200,6 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
document.removeEventListener('mousemove',handleDocumentMousemove);
document.removeEventListener('mousemove',handleDocumentMousemove);
(0,_utils.enableUserSelect)();
(0,_utils.enableUserSelect)();
}
}
// Add the annotation
// Add the annotation
_PDFJSAnnotate2.default.getStoreAdapter()
_PDFJSAnnotate2.default.getStoreAdapter()
.addAnnotation(documentId,pageNumber,annotation)
.addAnnotation(documentId,pageNumber,annotation)
...
@@ -6261,12 +6265,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6261,12 +6265,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
document.addEventListener('mousedown',handleDocumentMousedown);
document.addEventListener('mousedown',handleDocumentMousedown);
document.addEventListener('keyup',handleDocumentKeyup);
document.addEventListener('keyup',handleDocumentKeyup);
var contentWrapper = document.getElementById('content-wrapper');
document.addEventListener('touchstart', handleDocumentTouchstart);
contentWrapper.addEventListener('touchstart',handeContentTouchstart);
document.addEventListener('touchend', handleDocumentTouchend);
contentWrapper.addEventListener('touchmove',handeContentTouchmove);
contentWrapper.addEventListener('touchend',handeContentTouchend);
contentWrapper.addEventListener('touchcancel',handeContentTouchcancel);
(0,_utils.disableUserSelect)();
}/**
}/**
* Disable rect behavior
* Disable rect behavior
*/function disableRect(){
*/function disableRect(){
...
@@ -6283,12 +6283,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
...
@@ -6283,12 +6283,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
document.removeEventListener('mousedown',handleDocumentMousedown);
document.removeEventListener('mousedown',handleDocumentMousedown);
document.removeEventListener('keyup',handleDocumentKeyup);
document.removeEventListener('keyup',handleDocumentKeyup);
var contentWrapper = document.getElementById('content-wrapper');
document.removeEventListener('touchstart', handleDocumentTouchstart);
contentWrapper.removeEventListener('touchstart',handeContentTouchstart);
document.removeEventListener('touchend', handleDocumentTouchend);
contentWrapper.removeEventListener('touchmove',handeContentTouchmove);
contentWrapper.removeEventListener('touchend',handeContentTouchend);
contentWrapper.removeEventListener('touchcancel',handeContentTouchcancel);
(0,_utils.disableUserSelect)();
}
}
/***/},
/***/},
/* 33 */
/* 33 */
...
...
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
b255c857
...
@@ -25,6 +25,6 @@
...
@@ -25,6 +25,6 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
component
=
'mod_pdfannotator'
;
// Full name of the plugin (used for diagnostics).
$plugin
->
component
=
'mod_pdfannotator'
;
// Full name of the plugin (used for diagnostics).
$plugin
->
version
=
202102020
0
;
// The current module version (Date: YYYYMMDDXX).
$plugin
->
version
=
202102020
1
;
// The current module version (Date: YYYYMMDDXX).
$plugin
->
release
=
'PDF Annotator v1.4 release 5'
;
$plugin
->
release
=
'PDF Annotator v1.4 release 5'
;
$plugin
->
requires
=
2016112900
;
// Requires this Moodle version.
$plugin
->
requires
=
2016112900
;
// Requires this Moodle version.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment