mcy_new #1
|
|
@ -429,11 +429,11 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
var zoomFile = zoomState.zoomFile.value!;
|
||||
// var imageHeightOffsetStart = zoomFile.imageHeightOffsetStart??0;
|
||||
var imageHeightOffsetStart = zoomState.zoomFile.value!.getZoomFileOffsetStart(zoomState.initScale.value ?? 1);
|
||||
print("位置:$localPosition; 图片所在位置:$imageHeightOffsetStart");
|
||||
// print("位置:$localPosition; 图片所在位置:$imageHeightOffsetStart");
|
||||
if (imageHeightOffsetStart == 0) return;
|
||||
|
||||
var dy = localPosition.dy;
|
||||
print(zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1));
|
||||
// print(zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1));
|
||||
if (dy < imageHeightOffsetStart || dy > zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1)) return; // 检查笔记是否超出图片范围
|
||||
|
||||
var theScale = zoomState.initScale.value ?? 1;
|
||||
|
|
@ -453,9 +453,19 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
// 说明:“- imageHeightOffsetStart” 由于显示笔记的位置是以图片的位置开始,手势坐标是以左上角开始 所以需要减去上面空白位置
|
||||
// if (theScale == 1) {
|
||||
// }
|
||||
// (dy / theScale) - (max(0, imageHeightOffsetStart) / theScale) + ((sateData.zoomOffset?.dy.abs() ?? 0) / theScale),
|
||||
|
||||
var zoomWtdthSpaceVal = zoomFile.getZoomFileOffsetStartWidth(zoomState.initScale.value ?? 1);
|
||||
|
||||
localPosition = Offset(
|
||||
(localPosition.dx + (sateData.zoomOffset?.dx.abs() ?? 0)) / theScale,
|
||||
(dy / theScale) - (max(0, imageHeightOffsetStart) / theScale) + ((sateData.zoomOffset?.dy.abs() ?? 0) / theScale),
|
||||
(localPosition.dx -
|
||||
zoomFile.getZoomFileOffsetStartWidth(zoomState.initScale.value ?? 1) +
|
||||
((zoomWtdthSpaceVal <= 0.1) ? (sateData.zoomOffset?.dx.abs() ?? 0) : 0)) /
|
||||
theScale,
|
||||
(dy -
|
||||
max(0, imageHeightOffsetStart) +
|
||||
((zoomFile.imageHeightOffsetStart == null || zoomFile.imageHeightOffsetStart! <= 0.1) ? (sateData.zoomOffset?.dy.abs() ?? 0) : 0)) /
|
||||
theScale,
|
||||
);
|
||||
|
||||
print("最终位置 : $localPosition");
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ class ZoomLogic extends GetxController {
|
|||
void onPanUpPosition(Offset val) async {
|
||||
// 手指在移动 非物体移动的位置
|
||||
var state = Get.find<HomeworkReviewLogic>().state;
|
||||
if (state.zoomOffset?.dy.toStringAsFixed(2) != val.dy.toStringAsFixed(2) || state.zoomOffset?.dx.toStringAsFixed(2) != val.dx.toStringAsFixed(2)) {
|
||||
if (state.zoomOffset?.dy.toStringAsFixed(2) != val.dy.toStringAsFixed(2) ||
|
||||
state.zoomOffset?.dx.toStringAsFixed(2) != val.dx.toStringAsFixed(2)) {
|
||||
// print('**************** 正在移动位置 YYY:${val.dy}');
|
||||
// print('**************** 正在移动位置 XXX:${val.dx}');
|
||||
state.zoomOffset = val;
|
||||
|
|
@ -190,6 +191,14 @@ class ZoomFileModel extends Object {
|
|||
return (viewHeight - (actualHeight! * zoom)) / 2;
|
||||
}
|
||||
|
||||
/// 获取宽度的缩放后的空间距离
|
||||
/// zoom 缩放比例
|
||||
double getZoomFileOffsetStartWidth(double zoom) {
|
||||
if (zoom >= 1 || actualWidth == null) return 0;
|
||||
|
||||
return (viewWidth - (actualWidth! * zoom)) / 2;
|
||||
}
|
||||
|
||||
/// 获取缩放比例后的底部图片位置
|
||||
/// zoom 缩放比例
|
||||
double getZoomFileHeightOffsetEnd(double zoom) {
|
||||
|
|
@ -197,7 +206,6 @@ class ZoomFileModel extends Object {
|
|||
var topSpaceDimensions = getZoomFileOffsetStart(zoom);
|
||||
return topSpaceDimensions + (actualHeight! * zoom);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 最终版
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import app_installer
|
||||
import app_settings
|
||||
import auto_updater_macos
|
||||
import connectivity_plus
|
||||
|
|
@ -16,7 +15,6 @@ import sqflite
|
|||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AppInstallerPlugin.register(with: registry.registrar(forPlugin: "AppInstallerPlugin"))
|
||||
AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin"))
|
||||
AutoUpdaterMacosPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterMacosPlugin"))
|
||||
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue