From 8f7f1188b0363b01d13d4630ba83e324494470dc Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Sun, 17 Apr 2022 16:28:29 +0800
Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E8=BE=85?=
=?UTF-8?q?=E5=8A=A9=E8=AE=BE=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../canvas/components/Editor/index.vue | 45 +++++++++++--------
.../PanelStyle/PanelAidedDesign.vue | 2 +-
2 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue
index 860f710ab9..3dd8928e7c 100644
--- a/frontend/src/components/canvas/components/Editor/index.vue
+++ b/frontend/src/components/canvas/components/Editor/index.vue
@@ -16,7 +16,7 @@
-
+
@@ -293,15 +293,20 @@ function resetPositionBox() {
* @param {any} item
*/
function addItemToPositionBox(item) {
- const pb = positionBox
- if (item.x <= 0 || item.y <= 0) return
+ try {
+ const pb = positionBox
+ if (item.x <= 0 || item.y <= 0) return
- for (let i = item.x - 1; i < item.x - 1 + item.sizex; i++) {
- for (let j = item.y - 1; j < item.y - 1 + item.sizey; j++) {
- if (pb[j][i]) {
- pb[j][i].el = item
+ for (let i = item.x - 1; i < item.x - 1 + item.sizex; i++) {
+ for (let j = item.y - 1; j < item.y - 1 + item.sizey; j++) {
+ if (pb[j][i]) {
+ pb[j][i].el = item
+ }
}
}
+ } catch (e) {
+ // igonre
+ console.log('addItemToPositionBox failed')
}
}
@@ -878,7 +883,7 @@ export default {
data() {
return {
boardSetVisible: false,
- psDebug: false, // 定位调试模式
+ psDebug: true, // 定位调试模式
editorX: 0,
editorY: 0,
start: { // 选中区域的起点
@@ -1014,8 +1019,10 @@ export default {
watch: {
matrixCount: {
handler(newVal, oldVal) {
- const pointScale = newVal.x / oldVal.x
- this.changeScale(pointScale)
+ if (newVal && oldVal) {
+ this.changeComponentSizePoint(newVal.x / oldVal.x)
+ }
+ this.changeScale()
}
},
customStyle: {
@@ -1241,17 +1248,17 @@ export default {
},
// 修改矩阵点
changeComponentSizePoint(pointScale) {
- this.componentData.forEach((item, index) => {
- item.x = (item.x - 1) * pointScale + 1
- item.y = (item.y - 1) * pointScale + 1
- item.sizex = item.sizex * pointScale
- item.sizey = item.sizey * pointScale
- // this.componentData[index] = item
- })
+ if (pointScale) {
+ this.componentData.forEach((item, index) => {
+ item.x = (item.x - 1) * pointScale + 1
+ item.y = (item.y - 1) * pointScale + 1
+ item.sizex = item.sizex * pointScale
+ item.sizey = item.sizey * pointScale
+ })
+ }
},
- changeScale(pointScale) {
- this.changeComponentSizePoint(pointScale)
+ changeScale() {
// 1.3 版本重新设计仪表板定位方式,基准画布宽高为 1600*900 宽度自适应当前画布获取缩放比例scaleWidth
// 高度缩放比例scaleHeight = scaleWidth 基础矩阵为128*72 矩阵原始宽度12.5*12.5 矩阵高度可以调整
diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelAidedDesign.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelAidedDesign.vue
index ce8adfa350..e5cd9868b3 100644
--- a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelAidedDesign.vue
+++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelAidedDesign.vue
@@ -6,7 +6,7 @@
width="400"
trigger="click"
>
-
+
From 4fb6ed465971b91e1791f94d95453ce8da33e35a Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Sun, 17 Apr 2022 16:29:10 +0800
Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E8=BE=85?=
=?UTF-8?q?=E5=8A=A9=E8=AE=BE=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/canvas/components/Editor/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue
index 3dd8928e7c..9e6c00fedf 100644
--- a/frontend/src/components/canvas/components/Editor/index.vue
+++ b/frontend/src/components/canvas/components/Editor/index.vue
@@ -883,7 +883,7 @@ export default {
data() {
return {
boardSetVisible: false,
- psDebug: true, // 定位调试模式
+ psDebug: false, // 定位调试模式
editorX: 0,
editorY: 0,
start: { // 选中区域的起点