完成dy部分问题
This commit is contained in:
parent
80256a6042
commit
25029477cd
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
@ -59,7 +61,8 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
// 主图
|
// 主图
|
||||||
QuestionImageView(maxWidth, maxHeight, annotationState, controller, zoomState: zoomState, sateData: sateData, actualHeight: zoomFileModel.actualHeight!),
|
QuestionImageView(maxWidth, maxHeight, annotationState, controller,
|
||||||
|
zoomState: zoomState, sateData: sateData, actualHeight: zoomFileModel.actualHeight!),
|
||||||
// 继续批阅按钮
|
// 继续批阅按钮
|
||||||
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
||||||
// 上一题按钮
|
// 上一题按钮
|
||||||
|
|
@ -259,7 +262,8 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
final ZoomState zoomState;
|
final ZoomState zoomState;
|
||||||
final HomeworkReviewState sateData;
|
final HomeworkReviewState sateData;
|
||||||
final HomeworkReviewAnnotationsControlState annotationState;
|
final HomeworkReviewAnnotationsControlState annotationState;
|
||||||
QuestionImageView(this.maxWidth, this.maxHeight, this.annotationState, this.logic, {required this.actualHeight, required this.zoomState, required this.sateData, super.key});
|
QuestionImageView(this.maxWidth, this.maxHeight, this.annotationState, this.logic,
|
||||||
|
{required this.actualHeight, required this.zoomState, required this.sateData, super.key});
|
||||||
|
|
||||||
/// 获取数组指定倒数具体值的下标
|
/// 获取数组指定倒数具体值的下标
|
||||||
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
||||||
|
|
@ -300,7 +304,9 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
});
|
});
|
||||||
|
|
||||||
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
||||||
if (sateData.panQuestView != null && sateData.panQuestView == false && initPosition.value?.dy.abs().toInt().toDouble() != sateData.slide.value) {
|
if (sateData.panQuestView != null &&
|
||||||
|
sateData.panQuestView == false &&
|
||||||
|
initPosition.value?.dy.abs().toInt().toDouble() != sateData.slide.value) {
|
||||||
if (sateData.zoomOffset != null) {
|
if (sateData.zoomOffset != null) {
|
||||||
sateData.zoomOffset = Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
sateData.zoomOffset = Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +330,10 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
bool? res = await showDialog<bool>(
|
bool? res = await showDialog<bool>(
|
||||||
context: Get.context ?? context,
|
context: Get.context ?? context,
|
||||||
builder: (context1) {
|
builder: (context1) {
|
||||||
return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)), TextButton(child: quickText("确定", color: Theme.of(context1).primaryColor), onPressed: () => Navigator.pop(context1, true))]);
|
return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[
|
||||||
|
TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
|
||||||
|
TextButton(child: quickText("确定", color: Theme.of(context1).primaryColor), onPressed: () => Navigator.pop(context1, true))
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res == true) vnHandWritings.value = [];
|
if (res == true) vnHandWritings.value = [];
|
||||||
|
|
@ -444,7 +453,10 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
// 说明:“- imageHeightOffsetStart” 由于显示笔记的位置是以图片的位置开始,手势坐标是以左上角开始 所以需要减去上面空白位置
|
// 说明:“- imageHeightOffsetStart” 由于显示笔记的位置是以图片的位置开始,手势坐标是以左上角开始 所以需要减去上面空白位置
|
||||||
// if (theScale == 1) {
|
// if (theScale == 1) {
|
||||||
// }
|
// }
|
||||||
localPosition = Offset((localPosition.dx+(sateData.zoomOffset?.dx.abs()??0)) / theScale, (dy / theScale) - (imageHeightOffsetStart/ theScale));
|
localPosition = Offset(
|
||||||
|
(localPosition.dx + (sateData.zoomOffset?.dx.abs() ?? 0)) / theScale,
|
||||||
|
(dy / theScale) - (max(0, imageHeightOffsetStart) / theScale) + ((sateData.zoomOffset?.dy.abs() ?? 0) / theScale),
|
||||||
|
);
|
||||||
|
|
||||||
print("最终位置 : $localPosition");
|
print("最终位置 : $localPosition");
|
||||||
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
||||||
|
|
@ -462,7 +474,7 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
ignoring: isPen,
|
ignoring: isPen,
|
||||||
child: Zoom(
|
child: Zoom(
|
||||||
key: zoomKey.value,
|
key: zoomKey.value,
|
||||||
initTotalZoomOut: true, // 展示全部内容 初始化不产生滚动条
|
// initTotalZoomOut: true, // 展示全部内容 初始化不产生滚动条
|
||||||
zoomSensibility: 0.05,
|
zoomSensibility: 0.05,
|
||||||
scrollWeight: 4.r,
|
scrollWeight: 4.r,
|
||||||
doubleTapAnimDuration: Duration.zero,
|
doubleTapAnimDuration: Duration.zero,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue