xushiting 2 år sedan
förälder
incheckning
b7b31b22d2
3 ändrade filer med 24 tillägg och 4 borttagningar
  1. 4 0
      src/graphic/Controls/UIControl.js
  2. 19 4
      src/graphic/Layer.js
  3. 1 0
      src/graphic/Service/StateService.js

+ 4 - 0
src/graphic/Controls/UIControl.js

@@ -149,6 +149,10 @@ export default class UIControl {
         dataService.deleteMagnifier(vectorId);
         break;
     }
+    this.layer.exit();
+    uiService.setLineCategory(VectorCategory.Line.NormalLine);
+    uiService.setPointCategory(VectorCategory.Point.NormalPoint);
+    this.focusVector = null;
   }
 
   //复制按钮

+ 19 - 4
src/graphic/Layer.js

@@ -324,6 +324,21 @@ export default class Layer {
         }
         break;
       case LayerEvents.AddCurveLine:
+        needAutoRedraw = true;
+        listenLayer.start(position);
+        if (listenLayer.modifyPoint) {
+          position = {
+            x: listenLayer.modifyPoint.x,
+            y: listenLayer.modifyPoint.y,
+          };
+        }
+
+        elementService.hideAll();
+        elementService.setPoint(position);
+        elementService.showPoint();
+        if (listenLayer.modifyPoint) {
+          elementService.execute(listenLayer.modifyPoint, position);
+        }
         break;
       case LayerEvents.AddCircle:
         needAutoRedraw = true;
@@ -681,6 +696,8 @@ export default class Layer {
       stateService.setFocusItem(focusItem);
       this.uiControl.focusVector = focusItem;
       stateService.clearDraggingItem();
+    } else {
+      this.uiControl.focusVector = null;
     }
 
     let position = coordinate.getXYFromScreen({
@@ -835,6 +852,7 @@ export default class Layer {
         needAutoRedraw = true;
         if (draggingItem && draggingItem.vectorId) {
           movePoint.finish(draggingItem.vectorId);
+          uiService.setPointCategory(VectorCategory.Point.NormalPoint);
         }
         this.history.save();
         break;
@@ -1104,6 +1122,7 @@ export default class Layer {
         if (Settings.isMobile) {
           stateService.clearEventName();
           this.exit();
+          uiService.setLineCategory(VectorCategory.Line.NormalLine);
         } else {
           stateService.setEventName(LayerEvents.AddLine);
         }
@@ -1118,7 +1137,6 @@ export default class Layer {
         stateService.setEventName(LayerEvents.AddingLine);
       } else {
         stateService.clearEventName();
-        this.exit();
       }
     }
   }
@@ -1126,9 +1144,6 @@ export default class Layer {
   exit() {
     stateService.clear();
     this.uiControl.clearUI();
-    this.uiControl.focusVector = null;
-    uiService.setPointCategory(VectorCategory.Point.NormalPoint);
-    uiService.setLineCategory(VectorCategory.Line.NormalLine);
   }
 
   stopAddVector() {

+ 1 - 0
src/graphic/Service/StateService.js

@@ -102,4 +102,5 @@ export default class StateService {
 }
 
 const stateService = new StateService();
+window.stateService = stateService;
 export { stateService };