no message
This commit is contained in:
parent
a13cab2c96
commit
adc07a9346
|
|
@ -281,7 +281,6 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
double containerWidth = constraints.maxWidth;
|
||||
double containerHeight = constraints.maxHeight;
|
||||
|
||||
print('LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL');
|
||||
return $LocalAndNetworkSwitch(
|
||||
zoomGlobalKey: zoomGlobalKey,
|
||||
containerWidth: containerWidth,
|
||||
|
|
@ -300,7 +299,6 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
print('更新需要上传的文件');
|
||||
},
|
||||
imageBuilder: (imageBuilderContext, imageProvider) {
|
||||
print('PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP');
|
||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
||||
if (imagInfoModel == null || (imagInfoModel?.boxHeight != containerHeight || imagInfoModel?.boxWidth != containerWidth)) {
|
||||
if (_imageStreamListener != null) _imageStream?.removeListener(_imageStreamListener!);
|
||||
|
|
@ -313,7 +311,6 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
height: info.image.height.toDouble(),
|
||||
width: info.image.width.toDouble(),
|
||||
);
|
||||
printJson(imagInfoModel!.toJson());
|
||||
Future.delayed(Duration.zero, () {
|
||||
ref.read(zoomHeightProvider.notifier).setState(imagInfoModel?.scaleHeight ?? 0.0);
|
||||
});
|
||||
|
|
@ -339,35 +336,21 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
globalPosition = details.localPosition;
|
||||
Offset localPosition = globalPosition!;
|
||||
|
||||
print('绝对位置:X:${details.position.dx}; Y:${details.position.dy}');
|
||||
print('相对位置:X:${globalPosition!.dx}; Y:${globalPosition!.dy}');
|
||||
|
||||
// if (imagInfoModel != null &&
|
||||
// (localPosition.dy < imagInfoModel!.imageHeightOffsetStart! || localPosition.dy > imagInfoModel!.imageHeightOffsetend!)) {
|
||||
// // 笔迹画出图片区域 直接断笔
|
||||
// var dataVal = ref.read(drawMarkingProvider).data;
|
||||
// if (dataVal.length - 1 > -1 && dataVal[dataVal.length - 1].data != null) {
|
||||
// var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser));
|
||||
// var newVal1 = ref.read(drawMarkingProvider).offsets..add(null);
|
||||
// ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal(newVal, newVal1));
|
||||
// }
|
||||
// illegalArea = true;
|
||||
// return;
|
||||
// }
|
||||
// illegalArea = false;
|
||||
// Offset localPosition = (context.findRenderObject() as RenderBox).globalToLocal(details.localPosition);
|
||||
// if (widget.graffitiSwitch.openBrush || widget.graffitiSwitch.openEraser) {
|
||||
|
||||
// if (imagInfoModel?.scaleHeight != null) {
|
||||
// localPosition = Offset(localPosition.dx, localPosition.dy - imagInfoModel!.scaleHeight!);
|
||||
// }
|
||||
var zoomState = _zoomKey.currentState;
|
||||
if (zoomState != null) {
|
||||
print(zoomState);
|
||||
if (imagInfoModel != null &&
|
||||
(localPosition.dy < imagInfoModel!.imageHeightOffsetStart! || localPosition.dy > imagInfoModel!.imageHeightOffsetend!)) {
|
||||
// 笔迹画出图片区域 直接断笔
|
||||
var dataVal = ref.read(drawMarkingProvider).data;
|
||||
if (dataVal.length - 1 > -1 && dataVal[dataVal.length - 1].data != null) {
|
||||
var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser));
|
||||
var newVal1 = ref.read(drawMarkingProvider).offsets..add(null);
|
||||
ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal(newVal, newVal1));
|
||||
}
|
||||
illegalArea = true;
|
||||
return;
|
||||
}
|
||||
illegalArea = false;
|
||||
|
||||
double remainingHeight = imagInfoModel!.imageHeightOffsetStart!; // 剩余高度
|
||||
var _scaleY = (zoomInfo?.scale ?? 1);
|
||||
if (remainingHeight > 1) {
|
||||
localPosition = Offset(localPosition.dx, localPosition.dy - remainingHeight);
|
||||
|
||||
|
|
@ -386,42 +369,22 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
localPosition = Offset(localPosition.dx / imagInfoModel!.zoom, localPosition.dy / imagInfoModel!.zoom);
|
||||
if (zoomOffset != null) {
|
||||
// 如果滚动条有触动就加上滚动条滚动的位置
|
||||
var density = (imagInfoModel!.boxWidth / imagInfoModel!.scaleWidth!);
|
||||
localPosition = Offset(localPosition.dx + zoomOffset!.dx.abs() / imagInfoModel!.zoom, localPosition.dy);
|
||||
}
|
||||
}
|
||||
|
||||
// if (zoomInfo != null) {
|
||||
// localPosition = Offset(details.position.dx, localPosition.dy);
|
||||
// }
|
||||
|
||||
// print('移动位置 zoomOffset==>dx:${zoomOffset?.dx}');
|
||||
// print('移动位置 zoomOffset==>dy:${zoomOffset?.dy}');
|
||||
|
||||
// print('缩放的比例:${_scaleY}');
|
||||
// print('原本的dy:${globalPosition?.dy}');
|
||||
// print('原本的dx:${globalPosition?.dx}');
|
||||
// print('本来的Y轴:${localPosition.dy}');
|
||||
// print('还原后的Y轴:${localPosition.dy * _scaleY}');
|
||||
|
||||
var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser, data: localPosition));
|
||||
var newVal1 = ref.read(drawMarkingProvider).offsets..add(localPosition);
|
||||
ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal(newVal, newVal1));
|
||||
},
|
||||
onPointerDown: (PointerDownEvent event) {
|
||||
print('手指按下....${event.pointer}');
|
||||
},
|
||||
// onPointerDown: (PointerDownEvent event) {
|
||||
// },
|
||||
onPointerUp: (PointerUpEvent details) {
|
||||
print('离开.............');
|
||||
if (btnEnum != ReviewMarksBottomBtnsEnum.HANDWRITING) return;
|
||||
|
||||
globalPosition = null;
|
||||
// 如果在空白区域 非试题图片区域就返回
|
||||
if (illegalArea) return;
|
||||
// if (graffitiSwitch.openBrush || graffitiSwitch.openEraser) {
|
||||
// var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser));
|
||||
// ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal(newVal));
|
||||
// }
|
||||
|
||||
globalPosition = null;
|
||||
|
||||
var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser));
|
||||
var newVal1 = ref.read(drawMarkingProvider).offsets..add(null);
|
||||
|
|
@ -440,7 +403,7 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
|||
decoration: const BoxDecoration(color: const Color.fromRGBO(249, 250, 254, 1)),
|
||||
),
|
||||
maxZoomWidth: containerWidth,
|
||||
canvasColor: Colors.red,
|
||||
canvasColor: Colors.transparent,
|
||||
backgroundColor: Colors.transparent,
|
||||
maxZoomHeight: imagInfoModel?.scaleHeight != null ? (imagInfoModel!.scaleHeight! / imagInfoModel!.zoom) : null,
|
||||
initScale: initScale ?? 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue