From 4b17604e66bf33bfc6cba5e5ce475fddb9466b4a Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Fri, 29 Oct 2021 22:24:39 +0200 Subject: [PATCH] =?UTF-8?q?M=C3=AAme=20fonctionnement=20pour=20le=20curseu?= =?UTF-8?q?r=20et=20le=20click/dblclick=20pour=20l'ajout=20de=20texte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/app.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index dddc9d9..b1ad772 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -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 {