diff --git a/shared/index.js b/shared/index.js
index 060b6c8f5696cebcd2af83b79b92462d9ff112ca..5e00dc97f4e4b61b552c3469ecbd8f0b5d420830 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -6321,15 +6321,17 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
var input=void 0;
var pos = void 0;
var _textSize=void 0;
- var _textColor=void 0;/**
+ var _textColor=void 0;
+ var svg=void 0;
+ var rect=void 0;/**
* Handle document.mouseup event
*
*
* @param {Event} e The DOM event to handle
*/function handleDocumentMouseup(e){ // betrifft textbox
- if(input||!(0,_utils.findSVGAtPoint)(e.clientX,e.clientY)){
+ if(input||!(svg=(0,_utils.findSVGAtPoint)(e.clientX,e.clientY))){
return;
- }
+ }
let scrollTop = window.pageYOffset;
input=document.createElement('input');
input.setAttribute('id','pdf-annotate-text-input');
@@ -6344,10 +6346,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
input.addEventListener('keyup',handleInputKeyup);
document.body.appendChild(input);
input.focus();
+ rect=svg.getBoundingClientRect();
pos = {x: e.clientX, y: e.clientY };
- }/**
+ }
+ /**
* Handle input.blur event
- */function handleInputBlur(){saveText();}/**
+ */function handleInputBlur(){
+ saveText();
+ }/**
* Handle input.keyup event
*
* @param {Event} e The DOM event to handle
@@ -6359,14 +6365,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
var clientX=parseInt(pos.x,10);
//text size additional to y to render the text right under the mouse click
var clientY=parseInt(pos.y,10);
- var svg=(0,_utils.findSVGAtPoint)(clientX,clientY);
+ //var svg=(0,_utils.findSVGAtPoint)(clientX,clientY);
if(!svg){
return{v:void 0};
}
var _getMetadata=(0,_utils.getMetadata)(svg);
var documentId=_getMetadata.documentId;
var pageNumber=_getMetadata.pageNumber;
- var rect=svg.getBoundingClientRect();
+
var annotation=Object.assign({type:'textbox',size:_textSize,color:_textColor,content:input.value.trim()},(0,_utils.scaleDown)(svg,{x:(0,_utils.roundDigits)(clientX-rect.left,4),y:(0,_utils.roundDigits)(clientY-rect.top,4),width:(0,_utils.roundDigits)(input.offsetWidth,4),height:(0,_utils.roundDigits)(input.offsetHeight,4)}));
_PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId,pageNumber,annotation)
.then(function(annotation){
@@ -6393,9 +6399,22 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
* @param {String} textColor The color of the text
*/function setText(){var textSize=arguments.length<=0||arguments[0]===undefined?12:arguments[0];var textColor=arguments.length<=1||arguments[1]===undefined?'000000':arguments[1];_textSize=parseInt(textSize,10);_textColor=textColor;}/**
* Enable text behavior
- */function enableText(){if(_enabled){return;}_enabled=true;document.getElementById('content-wrapper').classList.add('cursor-text');document.addEventListener('mouseup',handleDocumentMouseup);}/**
+ */function enableText(){
+ if(_enabled){
+ return;
+ }
+ _enabled=true;
+ document.getElementById('content-wrapper').classList.add('cursor-text');
+ document.addEventListener('mouseup',handleDocumentMouseup);
+ }/**
* Disable text behavior
- */function disableText(){if(!_enabled){return;}_enabled=false;document.getElementById('content-wrapper').classList.remove('cursor-text');document.removeEventListener('mouseup',handleDocumentMouseup);}
+ */function disableText(){
+ if(!_enabled){return;
+ }
+ _enabled=false;
+ document.getElementById('content-wrapper').classList.remove('cursor-text');
+ document.removeEventListener('mouseup',handleDocumentMouseup);
+ }
/***/},
/* 34 */
/***/function(module,exports,__webpack_require__){
diff --git a/styles.css b/styles.css
index c515833cb555556b8673f3d1c7cdd9d1b0b6ebda..418ed21179288d487c55b7393e6985cadb1e7a8b 100644
--- a/styles.css
+++ b/styles.css
@@ -860,4 +860,9 @@ header, section, footer, aside, nav, main, article, figure {
.path-mod-pdfannotator .pdfannotator-statistic #chart-container {
min-height: 500px;
+}
+
+.toolbaritem .pdfannotator_text {
+ display: inline-block;
+ visibility: visible;
}
\ No newline at end of file
diff --git a/templates/index.mustache b/templates/index.mustache
index 62fbfa0e44597b399ad23eaec50e6e310569a1ad..c583313ecb3cecc5b23dc43f65ba113f9a3b231c 100644
--- a/templates/index.mustache
+++ b/templates/index.mustache
@@ -16,7 +16,7 @@
{{#usestudenttextbox}}
<span class="toolbaritem">
- <button class="text" type="button" title="{{# str }} text, pdfannotator {{/ str }}" data-tooltype="text">{{# pix }}text_color_picker,pdfannotator, {{# str }} text, pdfannotator {{/ str }} {{/ pix}}</button>
+ <button class="pdfannotator_text text" type="button" title="{{# str }} text, pdfannotator {{/ str }}" data-tooltype="text">{{# pix }}text_color_picker,pdfannotator, {{# str }} text, pdfannotator {{/ str }} {{/ pix}}</button>
<select class="text-size"></select>
<div class="text-color"></div>
</span>
diff --git a/version.php b/version.php
index 236c60560415dfcdab0a642baf9b0186c1ed8dab..a8c7720aa8fe4b0b0121ed42ec0b956c5266aaa8 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 = 2021030505; // The current module version (Date: YYYYMMDDXX).
+$plugin->version = 2021031902; // The current module version (Date: YYYYMMDDXX).
$plugin->release = 'PDF Annotator v1.4 release 5';
$plugin->requires = 2016112900; // Requires this Moodle version.