From ee2f7a97abc91d3dbafe3b6612719a4aa3e5bdc8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 七月 2020 12:03:49 +0800
Subject: [PATCH] 2020-07-03

---
 src/views/printTemplate/print.js |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js
index 5a8acfa..b2cbe6f 100644
--- a/src/views/printTemplate/print.js
+++ b/src/views/printTemplate/print.js
@@ -22,6 +22,8 @@
       elements.forEach(element => {
         element.left = element.left * ratio
         element.top = element.top * ratio
+        element.oriwidth = element.width
+        element.oriheight = element.height
         element.width = element.width * ratio
         element.height = element.height * ratio
 
@@ -39,6 +41,7 @@
           element.imgHeight = element.imgHeight * ratio
         }
       })
+
       return new Promise(resolve => {
         this.sketchothers(context, elements, selectId, ratio, resolve)
       })
@@ -68,10 +71,10 @@
     }
 
     if (selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
-      context.shadowBlur = 10
-      context.shadowColor = '#757575'
+      context.shadowBlur = 5
+      context.shadowColor = '#1890ff'
       context.fillStyle = 'white'
-      context.fillRect(element.left, element.top, element.width, element.height)
+      context.fillRect(element.left, element.top, element.width || 1, element.height || 1)
       context.shadowBlur = 0
     }
 
@@ -85,13 +88,24 @@
     }
 
     // 璁剧疆鑳屾櫙鑹�
-    if (element.background && element.background !== 'white') {
+    if (!element.borderSize && (element.oriwidth === 1 || element.oriheight === 1)) { // 绾�
+      context.strokeStyle = element.background
+      context.beginPath()
+      if (element.oriwidth === 1) {
+        context.moveTo(element.left, element.top)
+        context.lineTo(element.left, element.top + element.height)
+      } else {
+        context.moveTo(element.left, element.top + element.height)
+        context.lineTo(element.left + element.width, element.top + element.height)
+      }
+      context.stroke()
+    } else if (element.background && element.background !== 'white') {
       context.fillStyle = element.background
       context.fillRect(element.left, element.top, element.width, element.height)
     }
 
     if (selectId === element.uuid && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰�
-      context.strokeStyle = 'black'
+      context.strokeStyle = '#1890ff'
       context.beginPath()
       context.moveTo(element.left + element.width - 7, element.top + element.height - 2)
       context.lineTo(element.left + element.width - 2, element.top + element.height - 7)

--
Gitblit v1.8.0