|
@@ -15,6 +15,9 @@ import 'package:fis_measure/process/primitives/location.dart';
|
|
|
import 'package:fis_measure/utils/canvas.dart';
|
|
|
import 'package:fis_measure/view/gesture/cross_position_indicator.dart';
|
|
|
import 'package:fis_measure/view/gesture/positioned_cursor.dart';
|
|
|
+import 'package:fis_measure/view/gesture/positioned_touch_cursor.dart';
|
|
|
+import 'package:fis_ui/index.dart';
|
|
|
+import 'package:flutter/foundation.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:vid/us/vid_us_mode.dart';
|
|
|
|
|
@@ -23,6 +26,7 @@ import '../items/item_feature.dart';
|
|
|
|
|
|
/// 直线
|
|
|
class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
+ late final touchState = Get.find<ITouchPointState>();
|
|
|
late final mouseState = Get.find<IMouseState>();
|
|
|
StraightLine(ItemMeta meta, IMeasureItem? parent) : super(meta, parent);
|
|
|
|
|
@@ -81,8 +85,7 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
doFeatureFinish();
|
|
|
|
|
|
///重置十字样式
|
|
|
- mouseState.crossIndicatorStyleChanged
|
|
|
- .emit(this, CrossIndicatorStyle.nomal);
|
|
|
+ changeCrossIndicatorStyle(CrossIndicatorStyle.nomal);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -101,11 +104,16 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
switch (args.pointType) {
|
|
|
case PointInfoType.touchDown:
|
|
|
startPoint = args; // 设置线段起点
|
|
|
+ handleTouchBeforeStart(startPoint!); // 开始绘制前动态设置第一个起点
|
|
|
break;
|
|
|
case PointInfoType.touchUp:
|
|
|
- break; // 按下立即抬起无事发生
|
|
|
+ startPoint = args; // 设置线段起点
|
|
|
+ feature?.startPoint = args;
|
|
|
+ state = ItemStates.running;
|
|
|
+ break;
|
|
|
case PointInfoType.touchMove:
|
|
|
- handleMouseDownWhileWaiting(startPoint!); // 通过设置的起点开始一个绘制事件
|
|
|
+ feature?.startPoint = args;
|
|
|
+ feature?.endPoint = args;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -134,6 +142,16 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
state = ItemStates.running;
|
|
|
}
|
|
|
|
|
|
+ void handleTouchBeforeStart(PointInfo args) {
|
|
|
+ // 转换为Area逻辑位置
|
|
|
+ final point = args.toAreaLogicPoint();
|
|
|
+ // feature = StraightLineFeature(this, point, point);
|
|
|
+ if (args.hostVisualArea != null) {
|
|
|
+ handleTissueTM(args.hostVisualArea!.mode.modeType, point);
|
|
|
+ feature!.hostVisualArea = args.hostVisualArea;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// 处理TissueTimeMotion模式
|
|
|
void handleTissueTM(VidUsModeType mode, DPoint point) {
|
|
|
if (mode == VidUsModeType.TissueTM || mode == VidUsModeType.Doppler) {
|
|
@@ -141,13 +159,11 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
case MeasureTypes.TimeSpan:
|
|
|
feature = StraightLineTimeMotionFeature(this, point, point,
|
|
|
ifHorizontal: false);
|
|
|
- mouseState.crossIndicatorStyleChanged
|
|
|
- .emit(this, CrossIndicatorStyle.vertical);
|
|
|
+ changeCrossIndicatorStyle(CrossIndicatorStyle.vertical);
|
|
|
break;
|
|
|
case MeasureTypes.VerticalDistance:
|
|
|
feature = StraightLineTimeMotionFeature(this, point, point);
|
|
|
- mouseState.crossIndicatorStyleChanged
|
|
|
- .emit(this, CrossIndicatorStyle.horizontal);
|
|
|
+ changeCrossIndicatorStyle(CrossIndicatorStyle.horizontal);
|
|
|
break;
|
|
|
case MeasureTypes.Slope:
|
|
|
feature = StraightLineSlopeFeature(this, point, point);
|
|
@@ -157,8 +173,7 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
break;
|
|
|
case MeasureTypes.Pht:
|
|
|
feature = StraightLinePhtFeature(this, point, point);
|
|
|
- mouseState.crossIndicatorStyleChanged
|
|
|
- .emit(this, CrossIndicatorStyle.vertical);
|
|
|
+ changeCrossIndicatorStyle(CrossIndicatorStyle.vertical);
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
@@ -166,6 +181,14 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
feature = StraightLineFeature(this, point, point);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ void changeCrossIndicatorStyle(CrossIndicatorStyle e) {
|
|
|
+ if (kIsMobile) {
|
|
|
+ touchState.crossIndicatorStyleChanged.emit(this, e);
|
|
|
+ } else {
|
|
|
+ mouseState.crossIndicatorStyleChanged.emit(this, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class StraightLineFeature extends MeasureItemFeature {
|
|
@@ -191,7 +214,7 @@ class StraightLineFeature extends MeasureItemFeature {
|
|
|
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
- if (startPoint == endPoint) return;
|
|
|
+ if (startPoint == endPoint && kIsWeb) return;
|
|
|
|
|
|
drawId(canvas, size, idText);
|
|
|
|
|
@@ -217,7 +240,8 @@ class StraightLineTimeMotionFeature extends StraightLineFeature {
|
|
|
final bool ifHorizontal;
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
- if (startPoint == endPoint) return;
|
|
|
+ if (startPoint == endPoint && kIsWeb) return;
|
|
|
+
|
|
|
drawId(canvas, size, idText);
|
|
|
|
|
|
final startOffset = convert2ViewPoint(size, startPoint).toOffset();
|
|
@@ -239,7 +263,7 @@ class StraightLineSlopeFeature extends StraightLineFeature {
|
|
|
: super(refItem, startPoint, endPoint);
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
- if (startPoint == endPoint) return;
|
|
|
+ if (startPoint == endPoint && kIsWeb) return;
|
|
|
|
|
|
drawId(canvas, size, idText);
|
|
|
|
|
@@ -260,7 +284,8 @@ class StraightLinePhtFeature extends StraightLineFeature {
|
|
|
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
- if (startPoint == endPoint) return;
|
|
|
+ if (startPoint == endPoint && kIsWeb) return;
|
|
|
+
|
|
|
drawId(canvas, size, idText);
|
|
|
final distanceToCenter = (startPoint.y - regionCenter.y);
|
|
|
//TODO:[Gavin] 偏移量比例系数待精确
|