|
@@ -4,14 +4,10 @@ import 'package:fis_measure/interfaces/date_types/point.dart';
|
|
|
import 'package:fis_measure/interfaces/enums/items.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/item.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/item_metas.dart';
|
|
|
-import 'package:fis_measure/interfaces/process/items/terms.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/types.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/point_info.dart';
|
|
|
-import 'package:fis_measure/process/calcuators/heart_rate.dart';
|
|
|
import 'package:fis_measure/process/calcuators/time_motion.dart';
|
|
|
import 'package:fis_measure/process/items/item.dart';
|
|
|
-import 'package:fis_measure/process/primitives/combos/depth2baseline.dart';
|
|
|
-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';
|
|
@@ -91,11 +87,16 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- PointInfo? startPoint;
|
|
|
+ PointInfo? firstTouchStartPoint;
|
|
|
+ bool isFirstPointMove = false;
|
|
|
+ DPoint? secondTouchStartPoint;
|
|
|
+ bool isSecondPointMove = false;
|
|
|
@override
|
|
|
bool onExecuteTouch(PointInfo args) {
|
|
|
if (state == ItemStates.finished) {
|
|
|
if (args.pointType == PointInfoType.touchDown) {
|
|
|
+ isFirstPointMove = false;
|
|
|
+ isSecondPointMove = false;
|
|
|
state = ItemStates.waiting;
|
|
|
}
|
|
|
}
|
|
@@ -103,28 +104,47 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
|
|
|
if (state == ItemStates.waiting) {
|
|
|
switch (args.pointType) {
|
|
|
case PointInfoType.touchDown:
|
|
|
- startPoint = args; // 设置线段起点
|
|
|
- handleTouchBeforeStart(startPoint!); // 开始绘制前动态设置第一个起点
|
|
|
- break;
|
|
|
- case PointInfoType.touchUp:
|
|
|
- startPoint = args; // 设置线段起点
|
|
|
- feature?.startPoint = args;
|
|
|
- state = ItemStates.running;
|
|
|
+ firstTouchStartPoint = args; // 设置线段起点
|
|
|
+ handleTouchBeforeStart(firstTouchStartPoint!); // 开始绘制前动态设置第一个起点
|
|
|
break;
|
|
|
case PointInfoType.touchMove:
|
|
|
+ isFirstPointMove = true;
|
|
|
+ args.addOffset(0, -0.2); // 添加偏移
|
|
|
feature?.startPoint = args;
|
|
|
feature?.endPoint = args;
|
|
|
break;
|
|
|
+ case PointInfoType.touchUp:
|
|
|
+ if (isFirstPointMove) {
|
|
|
+ args.addOffset(0, -0.2); // 添加偏移
|
|
|
+ }
|
|
|
+ firstTouchStartPoint = args; // 设置线段起点
|
|
|
+ feature?.startPoint = args;
|
|
|
+ state = ItemStates.running;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
} else if (state == ItemStates.running) {
|
|
|
- if (args.pointType == PointInfoType.touchUp) {
|
|
|
- doFeatureFinish();
|
|
|
- }
|
|
|
- if (args.pointType == PointInfoType.touchMove) {
|
|
|
- doCalculate();
|
|
|
- feature?.endPoint = args;
|
|
|
+ switch (args.pointType) {
|
|
|
+ case PointInfoType.touchDown:
|
|
|
+ secondTouchStartPoint = args;
|
|
|
+ break;
|
|
|
+ case PointInfoType.touchMove:
|
|
|
+ isSecondPointMove = true;
|
|
|
+ doCalculate();
|
|
|
+ feature?.endPoint = firstTouchStartPoint!
|
|
|
+ .clone()
|
|
|
+ .addVector(args - secondTouchStartPoint!);
|
|
|
+ break;
|
|
|
+ case PointInfoType.touchUp:
|
|
|
+ if (!isSecondPointMove) {
|
|
|
+ feature?.endPoint = args;
|
|
|
+ doCalculate();
|
|
|
+ }
|
|
|
+ doFeatureFinish();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return true;
|