Browse Source

finish once after item changed

melon.yin 2 years ago
parent
commit
8990267b7d

+ 6 - 0
lib/interfaces/process/items/item.dart

@@ -60,6 +60,12 @@ abstract class IMeasureItem {
   /// 清空
   void clear();
 
+  /// 完成一次测量
+  void finishOnce();
+
+  /// 取消一次测量
+  void cancelOnce();
+
   /// 分配新序号
   int assignId();
 

+ 1 - 1
lib/process/calcuators/depth.dart

@@ -39,7 +39,7 @@ class TissueConvexDepthCal extends Calculator<Location, double> {
     final layout = ref.feature!.hostVisualArea!.displayRegion;
     final viewport = ref.feature!.hostVisualArea!.viewport!;
     final physical = viewport.physical! as ConvexTissuePhysicalCoordinate;
-    final point = ref.feature!.point;
+    final point = ref.feature!.point.clone();
 
     point.addOffset(-layout.left, -layout.top);
 

+ 8 - 0
lib/process/items/item.dart

@@ -114,6 +114,14 @@ abstract class MeasureItem<T extends MeasureItemFeature> extends IMeasureItem {
     measuredFeatures.clear();
   }
 
+  @override
+  void finishOnce() {
+    doFeatureFinish();
+  }
+
+  @override
+  void cancelOnce() {}
+
   @protected
   void doFeatureUpdate() {
     featureUpdated.emit(this, feature);

+ 0 - 5
lib/process/items/item_feature.dart

@@ -80,12 +80,7 @@ abstract class MeasureItemFeature implements IMeasureItemFeature {
       letterSpacing: letterSpacing,
     );
 
-    final layout = hostVisualArea!.displayRegion;
-    // final offsetX = layout.left * size.width;
-    // final offsetY = layout.top * size.height;
     final point = innerPoints[0];
-    point.addOffset(layout.left, layout.top);
-
     // TODO : fix bug
 
     final width = boundingTextSize(displayText, style).width;

+ 2 - 2
lib/process/primitives/location.dart

@@ -88,7 +88,8 @@ class TissueConvexLocationFeature extends LocationFeature {
 
   @override
   void paint(Canvas canvas, Size size) {
-    drawId(canvas, size);
+    super.paint(canvas, size);
+    final point = this.point.clone();
 
     final layout = hostVisualArea!.displayRegion;
     point.addOffset(-layout.left, -layout.top);
@@ -124,7 +125,6 @@ class TissueConvexLocationFeature extends LocationFeature {
     }
 
     canvas.drawDashLine(viewStartPoint, viewPoint, 1, 10, paintPan);
-    super.paint(canvas, size);
   }
 
   /// 找到直线(圆心到当前点)和扇形内圈的交叉点

+ 1 - 0
lib/process/workspace/application.dart

@@ -248,6 +248,7 @@ class Application implements IApplication {
   @override
   void switchItemByName(String name) {
     _updateOperateType(MeasureOperateType.measure);
+    activeMeasureItem?.finishOnce();
     // TODO: create from map
     if (name == MeasureTerms.Distance) {
       activeMeasureItem = StraightLine.createDistance(

+ 2 - 2
pubspec.lock

@@ -149,8 +149,8 @@ packages:
     dependency: "direct main"
     description:
       path: "."
-      ref: "5888e1f67b"
-      resolved-ref: "5888e1f67b5ab2c60f32f556f95f23e8cb10e89f"
+      ref: "4a9569e"
+      resolved-ref: "4a9569e000e29ce50501d404d5e1b2254278be05"
       url: "http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git"
     source: git
     version: "0.0.1"