From 4eae7af1ce6cd0ea8ac6485e26528625e83c3c70 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十月 2021 15:18:57 +0800
Subject: [PATCH] 2021-10-12

---
 src/views/printTemplate/print.js |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js
index 4247780..81c5792 100644
--- a/src/views/printTemplate/print.js
+++ b/src/views/printTemplate/print.js
@@ -4,7 +4,7 @@
    * @param  {Object}    configs      閰嶇疆淇℃伅
    * @param  {Boolean}   selectId     缂栬緫鍏冪礌
    */
-  static sketch (configs, selectId) {
+  static sketch (configs, selectId, debug = false) {
     if (!configs.height || !configs.width) return
 
     if (configs.height / configs.width > 10 || configs.width / configs.height > 10) return
@@ -43,7 +43,7 @@
       })
 
       return new Promise(resolve => {
-        this.sketchothers(context, elements, selectId, ratio, resolve)
+        this.sketchothers(context, elements, selectId, debug, ratio, resolve)
       })
     } else {
       return new Promise(resolve => {
@@ -57,7 +57,7 @@
    * @param  {Object}    context    鐢诲竷瀵硅薄
    * @param  {Object}    elements   鍥剧墖鏂囧瓧淇℃伅
    */
-  static sketchothers (context, elements, selectId, ratio, resolve) {
+  static sketchothers (context, elements, selectId, debug, ratio, resolve) {
     let element = elements.splice(0, 1)[0] // 閫愪釜缁樺埗鍥剧墖鏂囧瓧
     let textLineSpace = 5 // 缁樺埗鏃惰闂磋窛锛岄槻姝㈡枃瀛楅噸鍙�
     context.save()
@@ -70,7 +70,7 @@
       context.translate(-_cx, -_cy) // 鎭㈠鍘熺偣
     }
 
-    if (selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
+    if (debug || selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
       context.shadowBlur = 5
       context.shadowColor = '#1890ff'
       context.fillStyle = 'white'
@@ -104,7 +104,7 @@
       context.fillRect(element.left, element.top, element.width, element.height)
     }
 
-    if (selectId === element.uuid && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
+    if ((debug || selectId === element.uuid) && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
       context.strokeStyle = '#1890ff'
       context.beginPath()
       context.moveTo(element.left + element.width - 7, element.top + element.height - 2)
@@ -117,7 +117,7 @@
     if (!element.width || !element.height) {
       context.restore() // 閲嶇疆鐢诲竷
       if (elements.length > 0) {
-        this.sketchothers(context, elements, selectId, ratio, resolve)
+        this.sketchothers(context, elements, selectId, debug, ratio, resolve)
       } else {
         this.cachesketch(context, resolve)
       }
@@ -258,7 +258,7 @@
 
       context.restore() // 閲嶇疆鐢诲竷
       if (elements.length > 0) {
-        this.sketchothers(context, elements, selectId, ratio, resolve)
+        this.sketchothers(context, elements, selectId, debug, ratio, resolve)
       } else {
         this.cachesketch(context, resolve)
       }
@@ -301,7 +301,7 @@
 
         context.restore() // 閲嶇疆鐢诲竷
         if (elements.length > 0) {
-          this.sketchothers(context, elements, selectId, ratio, resolve)
+          this.sketchothers(context, elements, selectId, debug, ratio, resolve)
         } else {
           this.cachesketch(context, resolve)
         }
@@ -314,7 +314,7 @@
   
           context.restore() // 閲嶇疆鐢诲竷
           if (elements.length > 0) {
-            this.sketchothers(context, elements, selectId, ratio, resolve)
+            this.sketchothers(context, elements, selectId, debug, ratio, resolve)
           } else {
             this.cachesketch(context, resolve)
           }
@@ -343,7 +343,7 @@
 
         context.restore() // 閲嶇疆鐢诲竷
         if (elements.length > 0) {
-          this.sketchothers(context, elements, selectId, ratio, resolve)
+          this.sketchothers(context, elements, selectId, debug, ratio, resolve)
         } else {
           this.cachesketch(context, resolve)
         }
@@ -353,7 +353,7 @@
   
           context.restore() // 閲嶇疆鐢诲竷
           if (elements.length > 0) {
-            this.sketchothers(context, elements, selectId, ratio, resolve)
+            this.sketchothers(context, elements, selectId, debug, ratio, resolve)
           } else {
             this.cachesketch(context, resolve)
           }
@@ -385,7 +385,7 @@
         
         context.restore() // 閲嶇疆鐢诲竷
         if (elements.length > 0) {
-          this.sketchothers(context, elements, selectId, ratio, resolve)
+          this.sketchothers(context, elements, selectId, debug, ratio, resolve)
         } else {
           this.cachesketch(context, resolve)
         }
@@ -395,7 +395,7 @@
   
           context.restore() // 閲嶇疆鐢诲竷
           if (elements.length > 0) {
-            this.sketchothers(context, elements, selectId, ratio, resolve)
+            this.sketchothers(context, elements, selectId, debug, ratio, resolve)
           } else {
             this.cachesketch(context, resolve)
           }
@@ -404,7 +404,7 @@
       image.onerror = () => {
         context.restore() // 閲嶇疆鐢诲竷
         if (elements.length > 0) {
-          this.sketchothers(context, elements, selectId, ratio, resolve)
+          this.sketchothers(context, elements, selectId, debug, ratio, resolve)
         } else {
           this.cachesketch(context, resolve)
         }

--
Gitblit v1.8.0