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

Correction de comportement avec le mode séléction active et l'ajout de texte

This commit is contained in:
Vincent LAURENT 2021-11-09 00:22:00 +01:00
parent af19a4ff93
commit 1687f7c0ff

View File

@ -25,6 +25,7 @@ loadingTask.promise.then(function(pdf) {
var windowWidth = window.innerWidth;
var menu = document.getElementById('offcanvasTop')
var menuOffcanvas = new bootstrap.Offcanvas(menu)
var currentCursor = null;
if(localStorage.getItem('pdfHistory')) {
pdfHistory = JSON.parse(localStorage.getItem('pdfHistory'));
@ -557,8 +558,8 @@ loadingTask.promise.then(function(pdf) {
if(item == 'text') {
var textbox = new fabric.Textbox('Texte à modifier', {
left: x - 10,
top: y - 10,
left: x,
top: y - 20,
width: 300,
fontSize: 20,
fontFamily: 'Monospace'
@ -762,10 +763,16 @@ loadingTask.promise.then(function(pdf) {
activeCanvas = this;
activeCanvasPointer = event.pointer;
});
canvasEdition.on('mouse:down:before', function(event) {
currentCursor = this.defaultCursor;
});
canvasEdition.on('mouse:down', function(event) {
if(event.target) {
return;
}
if(currentCursor != 'copy') {
return;
}
var input_selected = document.querySelector('input[name="svg_2_add"]:checked');
if(!input_selected) {
return;