diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart index 5d1f227..2a28c2f 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart @@ -283,6 +283,35 @@ class QuestionImageView extends HookWidget with EventBusMixin> vnHandWritings) { + timer?.cancel(); + timer = Timer(const Duration(milliseconds: timeoutDuration), () { + if (_activePointers > 2) { + _activePointers = 0; + if (vnHandWritings.value.last != null) { + vnHandWritings.value.add(null); // 增加空点以分隔不同的线段 + sateData.handwritings = vnHandWritings.value; // 添加笔迹数据 + } + } + }); + } + + /// 获取最后一个点的坐标位置 + Offset? getLastDrop(List vals, int index) { + Offset? lastDrop; + if (vals.isNotEmpty) { + lastDrop = vals[index] as Offset?; + // if (lastDrop == null) { + // index -= 1; + // if (index > -1) { + // lastDrop = getLastDrop(vals, index); + // } + // } + + } + return lastDrop; + } + @override Widget build(BuildContext context) { final theMaxHeight = useState(maxHeight); @@ -431,16 +460,17 @@ class QuestionImageView extends HookWidget with EventBusMixin 0) { - _activePointers = 0; - if (vnHandWritings.value.last != null) { - vnHandWritings.value.add(null); // 增加空点以分隔不同的线段 - sateData.handwritings = vnHandWritings.value; // 添加笔迹数据 - } - } - }); + toTimer(vnHandWritings); + // timer?.cancel(); + // timer = Timer(const Duration(milliseconds: timeoutDuration), () { + // if (_activePointers > 2) { + // _activePointers = 0; + // if (vnHandWritings.value.last != null) { + // vnHandWritings.value.add(null); // 增加空点以分隔不同的线段 + // sateData.handwritings = vnHandWritings.value; // 添加笔迹数据 + // } + // } + // }); sateData.panQuestView = true; }, onPointerUp: (PointerUpEvent details) { @@ -460,7 +490,7 @@ class QuestionImageView extends HookWidget with EventBusMixin 40 || (lastDrop.dy - localPosition.dy).abs() > 40)) { + /// 当前X点和上一个x点相差 大于10判定为多个手指 + return; + } // print("最终位置 : $localPosition"); vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition); sateData.handwritings = vnHandWritings.value;