Browse Source

兼容高密度设备

bill 2 years ago
parent
commit
f2512af000

File diff suppressed because it is too large
+ 1 - 1
server/test/SS-t-P1d6CwREny2/attach/sceneStore


+ 24 - 15
src/graphic/Renderer/Draw.js

@@ -8,6 +8,7 @@ import ElementEvents from "../enum/ElementEvents.js";
 import { elementService } from "../Service/ElementService.js";
 import UIEvents from "@/graphic/enum/UIEvents.js";
 import VectorCategory from "@/graphic/enum/VectorCategory.js";
+import Settings from "@/graphic/Settings.js";
 
 const imgCache = {};
 const help = {
@@ -26,19 +27,18 @@ const help = {
 
     return [
       itemsEntry.reduce((prev, [item, attr]) => {
-        if (
-          item &&
-          // item.type === VectorType[geoType] &&
-          geoId === item.vectorId
-        ) {
-          if (Style[attr]) {
-            const style = Style[attr][geoType] || Style[attr][item.category]
-            if (style) {
-              currentAttr = attr;
-              return style;
-            }
+        if (!item) return prev
+        const selected = geoId === item.vectorId || (
+          item.parent && Object.keys(item.parent).some(id => id === geoId)
+        );
+        if (selected && Style[attr]) {
+          const style = Style[attr][geoType] || Style[attr][vector.category]
+          if (style) {
+            currentAttr = attr;
+            return style;
           }
         }
+
         return prev;
       }, Style[geoType]),
       currentAttr,
@@ -615,7 +615,7 @@ export default class Draw {
     }
     const pt = coordinate.getScreenXY({ x: vector.x, y: vector.y });
     const ctx = this.context;
-    const [style, attr] = help.setVectorStyle(
+    let [style, attr] = help.setVectorStyle(
       ctx,
       vector,
       [vector.category, vector.geoType, "Point"]
@@ -647,6 +647,16 @@ export default class Draw {
       ctx.restore();
     }
 
+    if (Settings.selectBasePointId === vector.vectorId) {
+      style = {
+        ...style,
+        fillStyle: "red",
+        out: style.out && {
+          ...style.out,
+          strokeStyle: "red",
+        }
+      }
+    }
     draw(style)
     if (style.out) {
       draw(style.out)
@@ -767,9 +777,8 @@ export default class Draw {
 
     const drawPoints = () => {
       // if (attr) {
-      console.log("???")
-        this.drawPoint(dataService.getPoint(vector.startId))
-        this.drawPoint(dataService.getPoint(vector.endId))
+      //   this.drawPoint(dataService.getPoint(vector.startId))
+      //   this.drawPoint(dataService.getPoint(vector.endId))
       // }
     }
 

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

@@ -124,23 +124,23 @@ export const mainMenusRaw: MenusRaw = [
 ];
 
 if (import.meta.env.DEV) {
-  mainMenusRaw.unshift(
-    { key: UIType.CurveRoad, text: "弯路" }
-  )
-  mainMenusRaw.splice(1, 0, {
-    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 },
-    ]
-  },)
+  // mainMenusRaw.unshift(
+  //   { key: UIType.CurveRoad, text: "弯路" }
+  // )
+  // mainMenusRaw.splice(1, 0, {
+  //   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 },
+  //   ]
+  // },)
 }
 
 export const photoMenusRaw: MenusRaw = [