|
@@ -16,6 +16,8 @@ import 'package:fis_measure/utils/prompt_box.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'dart:ui' as ui;
|
|
import 'dart:ui' as ui;
|
|
|
|
|
|
|
|
+import 'package:flutter/services.dart';
|
|
|
|
+
|
|
class URMTraceMeasure extends Trace {
|
|
class URMTraceMeasure extends Trace {
|
|
URMTraceMeasure(super.meta, super.parent);
|
|
URMTraceMeasure(super.meta, super.parent);
|
|
static bool needPerfusion = false;
|
|
static bool needPerfusion = false;
|
|
@@ -133,6 +135,47 @@ class URMTraceMeasure extends Trace {
|
|
PromptBox.dismiss();
|
|
PromptBox.dismiss();
|
|
waitingResult = false;
|
|
waitingResult = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /// 自动结束检测
|
|
|
|
+ @override
|
|
|
|
+ bool checkAutoSnap(PointInfo current, [bool autoFinishFeature = true]) {
|
|
|
|
+ if (feature == null || feature!.innerPoints.length < 3) {
|
|
|
|
+ isSmartMove = false;
|
|
|
|
+ return _syncState(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // final viewport = feature!.hostVisualArea!.viewport!;
|
|
|
|
+
|
|
|
|
+ if (isAutoSnap == false) return false;
|
|
|
|
+ final pixelSize = application.displaySize;
|
|
|
|
+
|
|
|
|
+ final p1 = feature!.innerPoints.first.scale2Size(pixelSize);
|
|
|
|
+ final p2 = current.scale2Size(pixelSize);
|
|
|
|
+ final length = (p1 - p2).length;
|
|
|
|
+ if (length > snapThreshold * 2.0 && !isSmartMove) {
|
|
|
|
+ isSmartMove = true;
|
|
|
|
+ }
|
|
|
|
+ if (length < snapThreshold && isSmartMove) {
|
|
|
|
+ feature!.innerPoints.last = feature!.innerPoints.first.clone();
|
|
|
|
+
|
|
|
|
+ /// 此处的最后一个点,方便计算,但是绘制时要剔除
|
|
|
|
+ // feature!.innerPoints.removeLast();
|
|
|
|
+
|
|
|
|
+ HapticFeedback.heavyImpact();
|
|
|
|
+ if (autoFinishFeature) {
|
|
|
|
+ handleFinish();
|
|
|
|
+ }
|
|
|
|
+ isSmartMove = false;
|
|
|
|
+ return _syncState(true);
|
|
|
|
+ } else {
|
|
|
|
+ return _syncState(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool _syncState(bool isSnap) {
|
|
|
|
+ snapState = isSnap;
|
|
|
|
+ return snapState;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
class TracePerfusionImageFeature extends TraceFeature {
|
|
class TracePerfusionImageFeature extends TraceFeature {
|