Skip to content

Commit 16255a4

Browse files
author
Victor Nazzaro
committed
Improves performance and bug fixes
1 parent 04df052 commit 16255a4

File tree

7 files changed

+25
-6
lines changed

7 files changed

+25
-6
lines changed

dist/pdf-annotate.js

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/UI/pen.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const isFirefox = /firefox/i.test(navigator.userAgent);
2121
* Handle document.touchdown or document.pointerdown event
2222
*/
2323
function handleDocumentPointerdown(e) {
24+
e.preventDefault();
2425
path = null;
2526
lines = [];
2627
_candraw = true;
@@ -67,12 +68,18 @@ function saveToStorage(x, y){
6768
* @param {Event} e The DOM event to be handled
6869
*/
6970
function handleDocumentPointermove(e) {
71+
if(!e.srcElement.classList.contains('annotationLayer')){
72+
return;
73+
}
7074
if(_candraw){
7175
savePoint(e.clientX, e.clientY);
7276
}
7377
}
7478

7579
function handleDocumentPointermoveChrome(e){
80+
if(!e.srcElement.classList.contains('annotationLayer')){
81+
return;
82+
}
7683
if(_candraw){
7784
savePoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
7885
}

src/UI/text.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ function handleDocumentMouseup(e) {
2121
if (input || !findSVGAtPoint(e.clientX, e.clientY)) {
2222
return;
2323
}
24-
24+
if(!e.srcElement.classList.contains('annotationLayer')){
25+
return;
26+
}
2527
input = document.createElement('input');
2628
input.setAttribute('id', 'pdf-annotate-text-input');
2729
input.setAttribute('placeholder', 'Enter text');

web/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ render();
208208
}
209209

210210
function setPen(size, color) {
211+
console.trace();
211212
let modified = false;
212213

213214
if (penSize !== size) {

0 commit comments

Comments
 (0)