Browse Source

set isSnapped 4 spline

melon.yin 2 years ago
parent
commit
01c12b1f3f
2 changed files with 3 additions and 2 deletions
  1. 1 0
      lib/process/primitives/area_abstract.dart
  2. 2 2
      lib/process/primitives/spline.dart

+ 1 - 0
lib/process/primitives/area_abstract.dart

@@ -26,6 +26,7 @@ abstract class AreaItemAbstract extends MeasureItem<AreaItemFeatureAbstract> {
 }
 }
 
 
 abstract class AreaItemFeatureAbstract extends MeasureItemFeature {
 abstract class AreaItemFeatureAbstract extends MeasureItemFeature {
+  bool isSnapped = false;
   AreaItemFeatureAbstract(AreaItemAbstract refItem) : super(refItem);
   AreaItemFeatureAbstract(AreaItemAbstract refItem) : super(refItem);
 
 
   @override
   @override

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

@@ -65,7 +65,7 @@ class Spline extends AreaItemAbstract with AutoSnapMixin {
       }
       }
       doCalculate();
       doCalculate();
 
 
-      checkAutoSnap(args);
+      f.isSnapped = checkAutoSnap(args);
     }
     }
     return true;
     return true;
   }
   }
@@ -99,7 +99,7 @@ class SplineFeature extends AreaItemFeatureAbstract {
   void paint(Canvas canvas, Size size) {
   void paint(Canvas canvas, Size size) {
     if (innerPoints.isEmpty) return;
     if (innerPoints.isEmpty) return;
     final paintPoints = innerPoints;
     final paintPoints = innerPoints;
-    if ((refItem as AutoSnapMixin).snapState) {
+    if (isSnapped) {
       paintPoints.removeLast();
       paintPoints.removeLast();
     }
     }
     drawId(canvas, size);
     drawId(canvas, size);