From eaf8cefc140c688133caf89079b65a12c999922f Mon Sep 17 00:00:00 2001 From: jureg Date: Wed, 31 Mar 2021 12:48:20 +0200 Subject: [PATCH 1/4] change minimum height --- PdfjsAnnotationsAssets.php | 1 - views/index.php | 26 ++++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/PdfjsAnnotationsAssets.php b/PdfjsAnnotationsAssets.php index b850a1f..99ebc75 100644 --- a/PdfjsAnnotationsAssets.php +++ b/PdfjsAnnotationsAssets.php @@ -38,7 +38,6 @@ class PdfjsAnnotationsAssets extends AssetBundle 'assets/prettify.min.js', 'assets/materialize.min.js', - 'views/app.js', 'assets/pdfjsAnnotations/pdfannotate.js', 'assets/pdfjsAnnotations/arrow.fabric.js', 'assets/pdfjsAnnotations/script.js', diff --git a/views/index.php b/views/index.php index 945d1c0..6b4e6bf 100644 --- a/views/index.php +++ b/views/index.php @@ -178,7 +178,7 @@ function initCanvasEvents(canvas, currentPage){ canvas.on('mouse:up', function(o){ if(isDown && isDragged){ USER_DIALOG.dialog(); -0 + if (USER_DIALOG.dialog("isOpen")=="true") { return; } @@ -220,7 +220,7 @@ function initCanvasEvents(canvas, currentPage){ ELEMENTS[uuid] = group; USER_DIALOG.rect = group; - USER_DIALOG.dialog({ title: DEFAULT_DIALOG_TITLE, draggable: false }); + USER_DIALOG.dialog({ title: DIALOG_TITLE_DEFAULT, draggable: false }); USER_DIALOG.dialog( "open" ); // Hides rotating point @@ -232,33 +232,35 @@ function initCanvasEvents(canvas, currentPage){ isDragged = false; }); - //in progress + //WIP // function resizeAndRemoveScale(e){ // var o = e.target; // var scaleX = o.scaleX; // var scaleY = o.scaleY; +// console.log(o.height); // o.set('width', o.width * scaleX); // o.set('height', o.height * scaleY); // o.set('scaleX', 1); // o.set('scaleY', 1); // o.set('zoomX', 1); // o.set('zoomY', 1); +// console.log(o.height); // // $.each(o._objects, function(index, element){ // var width_change =(element.width - (element.width * scaleX))/2; // var height_change = (element.height - (element.height * scaleY))/2; -// element.set('width', element.width * scaleX); -// element.set('height', element.height * scaleY); +// element.set('width', o.width); +// element.set('height', o.height); // element.set('top', element.top + height_change); // element.set('left', element.left + width_change); // element.set('scaleX', 1); // element.set('scaleY', 1); // element.set('zoomX', 1); // element.set('zoomY', 1); -// if(element.type == "textBox"){ -// debugger; -// rows = element.text.split('\\r\\n').length + 1; -// element.set('top', element.top + 5 + (((o.height * o.scaleY) / o.scale) * scale - 2) - (10 * scale * rows) - 4,); +// debugger; +// if(element.type == "textbox"){ +// var rows = element.text.split('\\r\\n').length + 1; +// element.set('top', element.top + (o.height - (10 * scale * rows) - 4)); // } // }); // } @@ -271,7 +273,7 @@ function preventScalingUnderMinSize(e){ target = e.target.group; } } - var minHeight = 75; + var minHeight = 50; var minWidth = 100; var height = canvas.height / scale; var rect_width = (target.width * target.scaleX) / scale; @@ -354,8 +356,8 @@ function getTagFromRectangle(rect, uuid){ rect.set('width', 100 * scale); rect_width = (rect.width * rect.scaleX); } - if (rect_height < 75){ - rect.set('height', 75* scale); + if (rect_height < 50){ + rect.set('height', 50* scale); rect_height = (rect.height * rect.scaleY); } return { From 0d4110524b844f2eeb24252447da2e45cfae4f62 Mon Sep 17 00:00:00 2001 From: jureg Date: Wed, 31 Mar 2021 12:52:05 +0200 Subject: [PATCH 2/4] reverse some changes --- PdfjsAnnotationsAssets.php | 1 + views/index.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PdfjsAnnotationsAssets.php b/PdfjsAnnotationsAssets.php index 99ebc75..b850a1f 100644 --- a/PdfjsAnnotationsAssets.php +++ b/PdfjsAnnotationsAssets.php @@ -38,6 +38,7 @@ class PdfjsAnnotationsAssets extends AssetBundle 'assets/prettify.min.js', 'assets/materialize.min.js', + 'views/app.js', 'assets/pdfjsAnnotations/pdfannotate.js', 'assets/pdfjsAnnotations/arrow.fabric.js', 'assets/pdfjsAnnotations/script.js', diff --git a/views/index.php b/views/index.php index 6b4e6bf..aa3e8b7 100644 --- a/views/index.php +++ b/views/index.php @@ -220,7 +220,7 @@ function initCanvasEvents(canvas, currentPage){ ELEMENTS[uuid] = group; USER_DIALOG.rect = group; - USER_DIALOG.dialog({ title: DIALOG_TITLE_DEFAULT, draggable: false }); + USER_DIALOG.dialog({ title: DEFAULT_DIALOG_TITLE, draggable: false }); USER_DIALOG.dialog( "open" ); // Hides rotating point From 7b8bfc375cb7f6a90c60d8b693ecfc0875a28372 Mon Sep 17 00:00:00 2001 From: jureg Date: Wed, 31 Mar 2021 12:58:21 +0200 Subject: [PATCH 3/4] change width to 40 --- views/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/index.php b/views/index.php index aa3e8b7..88274f5 100644 --- a/views/index.php +++ b/views/index.php @@ -273,7 +273,7 @@ function preventScalingUnderMinSize(e){ target = e.target.group; } } - var minHeight = 50; + var minHeight = 40; var minWidth = 100; var height = canvas.height / scale; var rect_width = (target.width * target.scaleX) / scale; @@ -356,8 +356,8 @@ function getTagFromRectangle(rect, uuid){ rect.set('width', 100 * scale); rect_width = (rect.width * rect.scaleX); } - if (rect_height < 50){ - rect.set('height', 50* scale); + if (rect_height < 40){ + rect.set('height', 40* scale); rect_height = (rect.height * rect.scaleY); } return { From 9802f0bb5948e6fd1387d567ca5fd592c71ec4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matja=C5=BE=20Zagorc?= Date: Mon, 19 Apr 2021 14:29:12 +0200 Subject: [PATCH 4/4] added PDFAnnotate.ready event --- views/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/views/index.php b/views/index.php index 88274f5..1a40de4 100644 --- a/views/index.php +++ b/views/index.php @@ -9,6 +9,9 @@ var scale = 0; var pdf = null; +PDFAnnotate.ready = function () { + console.log("Plugin initialized successfully. You can override this function by calling PDFAnnotate.ready = function() {}"); +}; function initPdf(scale){ pdf = new PDFAnnotate("pdf-container", "$pdfFilePath", { @@ -17,7 +20,9 @@ function initPdf(scale){ console.log(page, oldData, newData); }, ready() { - console.log("Plugin initialized successfully"); + if (PDFAnnotate.ready) { + PDFAnnotate.ready(); + } }, scale: scale, pageImageCompression: 'MEDIUM', // FAST, MEDIUM, SLOW(Helps to control the new PDF file size)