Просмотр исходного кода

Merge branch 'master' of http://192.168.0.115:3000/bill/traffic-laser

# Conflicts:
#	server/test/SS-t-P1d6CwREny2/attach/sceneStore
xushiting 2 лет назад
Родитель
Сommit
7391ad5a65
2 измененных файлов с 26 добавлено и 21 удалено
  1. 8 3
      src/graphic/Renderer/Draw.js
  2. 18 18
      src/views/graphic/menus.ts

+ 8 - 3
src/graphic/Renderer/Draw.js

@@ -6,6 +6,7 @@ import VectorType from "../enum/VectorType.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import ElementEvents from "../enum/ElementEvents.js";
 import { elementService } from "../Service/ElementService.js";
+import UIEvents from "@/graphic/enum/UIEvents.js";
 
 const imgCache = {}
 const help = {
@@ -121,6 +122,7 @@ export default class Draw {
   }
 
   drawBackGroundImg(vector) {
+    console.log(vector)
     const img = vector.imageData
     const width = help.getReal(img.width)
     const height = help.getReal(img.height)
@@ -535,9 +537,9 @@ export default class Draw {
     setStyle && help.setVectorStyle(ctx, null, "Text");
 
     const pt = coordinate.getScreenXY(position);
-    const text = ctx.measureText("foo");
+    const text = ctx.measureText(txt);
     pt.x -= text.width / 2
-    pt.y -= (text.actualBoundingBoxAscent + text.actualBoundingBoxDescent) / 2
+    pt.y += (text.actualBoundingBoxAscent + text.actualBoundingBoxDescent) / 2
     if (angle) {
       ctx.translate(pt.x, pt.y);
       ctx.rotate(angle);
@@ -552,14 +554,17 @@ export default class Draw {
   drawText(vector) {
     help.setVectorStyle(this.context, vector);
     this.context.fillStyle = vector.color
+    const oldFont = this.context.font
     this.context.font = `${vector.fontSize}px Microsoft YaHei`
     this.drawTextByInfo(vector.center, vector.value, 0, false);
+    this.context.font = oldFont
   }
 
   drawLine(vector) {
-    if (vector.category === "ArrowLine") {
+    if ([UIEvents.Arrow, UIEvents.MeasureLine].includes(vector.category)) {
       return this.drawArrow(vector);
     }
+    console.log(vector)
     let start = dataService.getPoint(vector.startId);
     start = coordinate.getScreenXY(start);
     let end = dataService.getPoint(vector.endId);

+ 18 - 18
src/views/graphic/menus.ts

@@ -72,27 +72,27 @@ export const templateMenusRaw = [
 ]
 
 export const mainMenusRaw: MenusRaw = [
-  { key: UIType.CurveRoad, text: "弯路" },
-  { key: UIType.Road, text: "直路" },
+  // { key: UIType.CurveRoad, text: "弯路" },
+  // { key: UIType.Road, text: "直路" },
   { key: UIType.Line, text: "画线" },
-  {
-    key: UITypeExtend.road,
-    text: "道路",
-    children: [
-      { key: UIType.OneEdgeOneLanRoad, text: "单向单车道直路" },
-      { key: UIType.OneEdgeTwoLanRoad, text: "单向双车道直路" },
-      { key: UIType.OneEdgeThreeLanRoad, text: "单向三车道直路" },
-      { key: UIType.TwoEdgeOneLanRoad, text: "双向单车道直路" },
-      { key: UIType.TwoEdgeTwoLanRoad, text: "双向双车道直路" },
-      { key: UIType.TwoEdgeThreeLanRoad, text: "双向三车道直路" },
-      { key: UITypeExtend.structure, text: "道路结构", extend: structureMenusRaw },
-      { key: UITypeExtend.template, text: "道路模板", extend: templateMenusRaw },
-    ]
-  },
-  { key: UIType.Img, text: "图例" },
+  // {
+  //   key: UITypeExtend.road,
+  //   text: "道路",
+  //   children: [
+  //     { key: UIType.OneEdgeOneLanRoad, text: "单向单车道直路" },
+  //     { key: UIType.OneEdgeTwoLanRoad, text: "单向双车道直路" },
+  //     { key: UIType.OneEdgeThreeLanRoad, text: "单向三车道直路" },
+  //     { key: UIType.TwoEdgeOneLanRoad, text: "双向单车道直路" },
+  //     { key: UIType.TwoEdgeTwoLanRoad, text: "双向双车道直路" },
+  //     { key: UIType.TwoEdgeThreeLanRoad, text: "双向三车道直路" },
+  //     { key: UITypeExtend.structure, text: "道路结构", extend: structureMenusRaw },
+  //     { key: UITypeExtend.template, text: "道路模板", extend: templateMenusRaw },
+  //   ]
+  // },
+  // { key: UIType.Img, text: "图例" },
   { key: UIType.MeasureLine, text: "测量" },
   { key: UIType.Text, text: "文字" },
-  { key: UIType.magnifier, text: "放大镜" },
+  { key: UIType.Magnifier, text: "放大镜" },
   { key: UITypeExtend.photo, text: "照片库" },
   { key: UITypeExtend.setup, text: "设置" },
 ];