Przeglądaj źródła

更新功能。

xushiting 1 rok temu
rodzic
commit
6a123496a7

+ 24 - 1
src/view/case/draw/board/editCAD/Controls/UIControl.js

@@ -96,7 +96,30 @@ export default class UIControl{
             case 'update':
                 if(type == VectorType.Tag){
                     const tag = floorplanService.getTag(item.vectorId)
-                    tag.setValue(value)
+                    if(value.hasOwnProperty('version')){
+                        tag.setColor(value.color)
+                        tag.setFontSize(value.fontSize)
+                        tag.setValue(value.content)
+                    }
+                    else{
+                        tag.setValue(value)
+                    }
+                }
+                else if(type == VectorType.Arrow){
+                    const arrow = floorplanService.getArrow(item.vectorId)
+                    arrow.setColor(value.color)
+                }
+                else if(type == VectorType.Wall){
+                    const wall = floorplanService.getWall(item.vectorId)
+                    wall.setColor(value.color)
+                }
+                else if(type == VectorType.Rectangle){
+                    const rectangle = floorplanService.getRectangle(item.vectorId)
+                    rectangle.setColor(value.color)
+                }
+                else if(type == VectorType.Circle){
+                    const circle = floorplanService.getCircle(item.vectorId)
+                    circle.setColor(value.color)
                 }
                 else if(type == VectorType.Table){
                     const table = floorplanService.getTable(item.vectorId)

+ 5 - 0
src/view/case/draw/board/editCAD/Geometry/Arrow.js

@@ -10,6 +10,7 @@ export default class Arrow extends Geometry {
         this.startPoint = startPoint
         this.endPoint = endPoint
         this.floor = floor?floor:0
+        this.color = 'black';
         this.geoType = VectorType.Arrow
         this.setId(vectorId)
     }
@@ -42,4 +43,8 @@ export default class Arrow extends Geometry {
             mathUtil.clonePoint(this.endPoint,newPosition)
         }
     }
+
+    setColor(color) {
+        this.color = color
+    }
 }

+ 5 - 0
src/view/case/draw/board/editCAD/Geometry/Circle.js

@@ -11,6 +11,7 @@ export default class Circle extends Geometry {
         this.radius = radius
         this.points = [];                       //顺时针
         this.setPoints()
+        this.color = 'black';
         this.floor = floor?floor:0
         this.geoType = VectorType.Circle
         this.setId(vectorId)
@@ -137,4 +138,8 @@ export default class Circle extends Geometry {
         }
         return lastIndex;
     }
+
+    setColor(color) {
+        this.color = color
+    }
 }

+ 1 - 0
src/view/case/draw/board/editCAD/Geometry/Geometry.js

@@ -4,6 +4,7 @@ import { mathUtil } from '../MathUtil.js'
 export default class Geometry {
     constructor() {
         this.len = null
+        this.version = 2;
     }
 
     setId(vectorId) {

+ 5 - 0
src/view/case/draw/board/editCAD/Geometry/Rectangle.js

@@ -11,6 +11,7 @@ export default class Rectangle extends Geometry {
         this.floor = floor?floor:0
         this.angle = 0;
         this.setPoints(leftTopPosition,rightDownPosition)
+        this.color = 'black';
         this.geoType = VectorType.Rectangle
         this.setId(vectorId)
     }
@@ -147,4 +148,8 @@ export default class Rectangle extends Geometry {
         }
         return null;
     }
+
+    setColor(color) {
+        this.color = color
+    }
 }

+ 11 - 0
src/view/case/draw/board/editCAD/Geometry/Tag.js

@@ -15,6 +15,9 @@ export default class Tag extends Geometry {
         this.sideWidth = 30 //像素
         this.sideThickness = 30 //像素
 
+        this.color = 'black';
+        this.fontSize = '12px';
+
         this.geoType = VectorType.Tag
         this.setId(vectorId)
     }
@@ -89,4 +92,12 @@ export default class Tag extends Geometry {
     setValue(value) {
         this.value = value
     }
+
+    setColor(color) {
+        this.color = color
+    }
+
+    setFontSize(fontSize) {
+        this.fontSize = fontSize
+    }
 }

+ 5 - 0
src/view/case/draw/board/editCAD/Geometry/Wall.js

@@ -7,6 +7,7 @@ export default class Wall extends Geometry {
         this.start = pointId1
         this.end = pointId2
         this.floor = floor?floor:0
+        this.color = 'black';
         this.geoType = VectorType.Wall
         this.setId(vectorId)
     }
@@ -28,4 +29,8 @@ export default class Wall extends Geometry {
             return null
         }
     }
+
+    setColor(color) {
+        this.color = color
+    }
 }