1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Même fonctionnement pour le curseur et le click/dblclick pour l'ajout de

texte
This commit is contained in:
Vincent LAURENT 2021-10-29 22:24:39 +02:00
parent 9f8d0b2fa1
commit 4b17604e66

View File

@ -253,14 +253,21 @@ loadingTask.promise.then(function(pdf) {
document.getElementById(this.htmlFor).dispatchEvent(new Event("change"));
});
item.addEventListener('click', function(event) {
if(addLock) {
if(event.detail > 1 && document.getElementById(this.htmlFor).checked){
stateAddLock(true);
}
if(event.detail > 1 && !document.getElementById(this.htmlFor).checked){
stateAddLock(false);
}
if(event.detail > 1) {
return;
}
});
item.addEventListener('dblclick', function(event) {
stateAddLock(true);
if(!document.getElementById(this.htmlFor).checked) {
return;
}
document.getElementById(this.htmlFor).checked = false;
document.getElementById(this.htmlFor).dispatchEvent(new Event("change"));
event.preventDefault();
});
});
@ -276,8 +283,20 @@ loadingTask.promise.then(function(pdf) {
document.getElementById('svg_selected').src = null;
}
stateAddLock(false);
var input_selected = document.querySelector('input[name="svg_2_add"]:checked');
if(input_selected) {
document.body.style.setProperty('cursor', 'copy');
} else {
document.body.style.removeProperty('cursor');
}
document.querySelectorAll('.btn-svg').forEach(function(item) {
if(input_selected && item.htmlFor == input_selected.id) {
item.style.setProperty('cursor', 'copy');
} else {
item.style.removeProperty('cursor');
}
});
canvasEditions.forEach(function(canvasEdition, index) {
var input_selected = document.querySelector('input[name="svg_2_add"]:checked');
if(input_selected) {
canvasEdition.defaultCursor = 'copy';
} else {