Jelajahi Sumber

更新完成

xushiting 1 tahun lalu
induk
melakukan
46e6186eb0

+ 5 - 0
src/view/case/draw/board/editCAD/Controls/UIControl.js

@@ -267,6 +267,7 @@ export default class UIControl {
               rotate:customImage.angle,
               scale:customImage.scale
           };
+          break;
         case VectorType.Circle:
           const circle = floorplanService.getCircle(item.vectorId);
           if (!circle) {
@@ -277,6 +278,7 @@ export default class UIControl {
               type: type,
               color: circle.color,
           };
+          break;
         case VectorType.Rectangle:
           const rectangle = floorplanService.getRectangle(item.vectorId);
           if (!rectangle) {
@@ -287,6 +289,7 @@ export default class UIControl {
               type: type,
               color: rectangle.color,
           };
+          break;
         case VectorType.Wall:
           const wall = floorplanService.getWall(item.vectorId);
           if (!wall) {
@@ -297,6 +300,7 @@ export default class UIControl {
               type: type,
               color: wall.color,
           };
+          break;
         case VectorType.Arrow:
           const arrow = floorplanService.getArrow(item.vectorId);
           if (!arrow) {
@@ -307,6 +311,7 @@ export default class UIControl {
               type: type,
               color: arrow.color,
           };
+          break;
       }
     }
     

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

@@ -32,7 +32,7 @@ export default class Tag extends Geometry {
     }
 
     setFontLenAndHeight(){
-        let height = 0;
+        let height = 1;
         let row = 0;
         let textValues = [];
         textValues[0] = '';

+ 25 - 3
src/view/case/draw/board/editCAD/Renderer/Draw.js

@@ -218,7 +218,8 @@ export default class Draw {
             sideWidth = Math.max(sideWidth,this.context.measureText(fontInfo.textValues[i]).width, this.context.measureText(parseFloat(fontInfo.textValues[i]).toFixed(2)).width)
         }
         geometry.sideWidth = sideWidth
-        geometry.sideThickness = fontInfo.height * geometry.fontSize * 2
+        geometry.sideThickness = fontInfo.height * (geometry.fontSize)
+        
         geometry.setPoints2d()
 
         let points2d = geometry.points2d
@@ -229,7 +230,10 @@ export default class Draw {
 
         let pt = coordinate.getScreenXY({ x: geometry.center.x, y: geometry.center.y })
         const fontWidth1 = geometry.sideWidth
-        let dy = (points[3].y - points[0].y)/fontInfo.textValues.length
+        //let dy = (points[3].y - points[0].y)/fontInfo.textValues.length/2
+        let dy = geometry.sideThickness/fontInfo.height/2
+        console.log('dy:'+dy)
+        console.log('(points[3].y - points[0].y):'+(points[3].y - points[0].y));
         for(let i=0;i<fontInfo.textValues.length;++i){
             // const line1 = mathUtil.createLine1({ x: (points[0].x + points[3].x) / 2, y: (points[0].y + points[3].y) / 2 }, { x: (points[2].x + points[1].x) / 2, y: (points[2].y + points[1].y) / 2 })
             // const fontStart1 = mathUtil.getDisPointsLine(line1, pt, fontWidth1 / 2, fontWidth1 / 2)
@@ -239,10 +243,28 @@ export default class Draw {
             // } else {
             //     this.context.fillText(geometry.value, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
             // }
-            this.context.fillText(fontInfo.textValues[i], pt.x - fontWidth1/2, pt.y - geometry.sideThickness/2+dy*i)
+            //let count = (2*(i-(fontInfo.textValues.length-1))+1)
+            let count = 1 * (fontInfo.textValues.length-i)
+            count = 2* count  - fontInfo.textValues.length
+            console.log('count:'+count)
+            this.context.fillText(fontInfo.textValues[i], pt.x - fontWidth1/2, pt.y + dy*count)
         }
 
 
+
+        // this.context.beginPath()
+        // this.context.arc(pt.x, pt.y, 2 * coordinate.ratio, 0, Math.PI * 2, true)
+        // this.context.stroke()
+        // this.context.fill()
+
+        // this.context.beginPath()
+        // this.context.moveTo(points[0].x, points[0].y)
+        // this.context.lineTo(points[1].x, points[1].y)
+        // this.context.lineTo(points[2].x, points[2].y)
+        // this.context.lineTo(points[3].x, points[3].y)
+        // this.context.closePath();
+        // this.context.stroke()
+
         this.context.restore()
     }