Browse Source

修正测量目标超出区域的问题 #0011937

gavin.chen 1 year ago
parent
commit
7a72925085
1 changed files with 8 additions and 3 deletions
  1. 8 3
      lib/process/primitives/polyline.dart

+ 8 - 3
lib/process/primitives/polyline.dart

@@ -101,8 +101,13 @@ class Polyline extends AreaItemAbstract with AutoSnapMixin {
       }
     } else if (state == ItemStates.running) {
       if (feature == null) return false;
-      DPoint newPoint =
-          lastStartPoint.clone().addVector(args - splineTouchStartPoint);
+      PointInfo newPoint = PointInfo.fromOffset(
+          lastStartPoint
+              .clone()
+              .addVector(args - splineTouchStartPoint)
+              .toOffset(),
+          args.pointType);
+      newPoint.hostVisualArea = args.hostVisualArea;
       final f = feature!;
       if (args.pointType == PointInfoType.touchUp) {
         if (!isOtherPointNeedOffset) {
@@ -120,7 +125,7 @@ class Polyline extends AreaItemAbstract with AutoSnapMixin {
         f.innerPoints.add(lastStartPoint);
       }
       if (args.pointType == PointInfoType.touchMove) {
-        if (isMoveTargetOutOfRange(args)) return true;
+        if (isMoveTargetOutOfRange(newPoint)) return true;
         isOtherPointNeedOffset = true;
         f.innerPoints.last = newPoint;
       }