mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Lock d'un svg en double cliquant pour permettre plusieurs ajouts d'un
coup
This commit is contained in:
parent
21ff3c8ff7
commit
c0f405ebe8
@ -11,6 +11,7 @@ var loadingTask = pdfjsLib.getDocument(url);
|
||||
loadingTask.promise.then(function(pdf) {
|
||||
|
||||
var fontCaveat = null;
|
||||
var addLock = false;
|
||||
var copiedObject = null;
|
||||
var activeCanvas = null;
|
||||
var activeCanvasPointer = null;
|
||||
@ -88,6 +89,10 @@ loadingTask.promise.then(function(pdf) {
|
||||
document.getElementById('svg_selected_container').classList.add('d-none');
|
||||
document.getElementById('svg_selected').src = null;
|
||||
}
|
||||
addLock = false;
|
||||
document.querySelectorAll('.btn-svg').forEach(function(item) {
|
||||
item.style.borderWidth = "1px";
|
||||
});
|
||||
canvasEditions.forEach(function(canvasEdition, index) {
|
||||
var input_selected = document.querySelector('input[name="svg_2_add"]:checked');
|
||||
if(input_selected) {
|
||||
@ -124,6 +129,18 @@ loadingTask.promise.then(function(pdf) {
|
||||
document.getElementById(this.htmlFor).checked = true;
|
||||
document.getElementById(this.htmlFor).dispatchEvent(new Event("change"));
|
||||
});
|
||||
svgButton.addEventListener('click', function(event) {
|
||||
if(addLock) {
|
||||
svgButton.style.borderWidth = "1px";
|
||||
addLock = false;
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
svgButton.addEventListener('dblclick', function(event) {
|
||||
svgButton.style.borderWidth = "2px";
|
||||
addLock = true;
|
||||
});
|
||||
var svgImg = document.createElement('img');
|
||||
svgImg.src = svg.svg;
|
||||
svgImg.draggable = false;
|
||||
@ -187,6 +204,18 @@ loadingTask.promise.then(function(pdf) {
|
||||
document.getElementById(this.htmlFor).checked = true;
|
||||
document.getElementById(this.htmlFor).dispatchEvent(new Event("change"));
|
||||
});
|
||||
item.addEventListener('click', function(event) {
|
||||
if(addLock) {
|
||||
item.style.borderWidth = "1px";
|
||||
addLock = false;
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
item.addEventListener('dblclick', function(event) {
|
||||
item.style.borderWidth = "2px";
|
||||
addLock = true;
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('input[name="svg_2_add"]').forEach(function (item) {
|
||||
@ -626,6 +655,10 @@ loadingTask.promise.then(function(pdf) {
|
||||
}
|
||||
|
||||
addSvgInCanvas(this, input_selected.value, event.pointer.x, event.pointer.y);
|
||||
|
||||
if(addLock) {
|
||||
return;
|
||||
}
|
||||
input_selected.checked = false;
|
||||
input_selected.dispatchEvent(new Event("change"));
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user