add 'Long press to zoom' setting

This commit is contained in:
2024-11-05 15:34:05 +08:00
parent adb6cdd0c1
commit afa320e863
4 changed files with 24 additions and 2 deletions

View File

@@ -167,7 +167,8 @@
"Download All": "下载全部",
"Order": "顺序",
"minAppVersion @version is required": "需要最低App版本 @version",
"Remove": "移除"
"Remove": "移除",
"Long press to zoom": "长按缩放"
},
"zh_TW": {
"Home": "首頁",
@@ -337,6 +338,7 @@
"Download All": "下載全部",
"Order": "順序",
"minAppVersion @version is required": "需要最低App版本 @version",
"Remove": "移除"
"Remove": "移除",
"Long press to zoom": "長按縮放"
}
}

View File

@@ -111,6 +111,7 @@ class _Settings with ChangeNotifier {
'language': 'system', // system, zh-CN, zh-TW, en-US
'cacheSize': 2048, // in MB
'downloadThreads': 5,
'enableLongPressToZoom': true,
};
operator [](String key) {

View File

@@ -223,6 +223,9 @@ class _GalleryModeState extends State<_GalleryMode>
@override
void handleLongPressDown(Offset location) {
if(!appdata.settings['enableLongPressToZoom']) {
return;
}
var photoViewController = photoViewControllers[reader.page]!;
double target = photoViewController.getInitialScale!.call()! * 1.75;
var size = MediaQuery.of(context).size;
@@ -234,6 +237,9 @@ class _GalleryModeState extends State<_GalleryMode>
@override
void handleLongPressUp(Offset location) {
if(!appdata.settings['enableLongPressToZoom']) {
return;
}
var photoViewController = photoViewControllers[reader.page]!;
double target = photoViewController.getInitialScale!.call()!;
photoViewController.animateScale?.call(target);
@@ -509,6 +515,9 @@ class _ContinuousModeState extends State<_ContinuousMode>
@override
void handleLongPressDown(Offset location) {
if(!appdata.settings['enableLongPressToZoom']) {
return;
}
double target = photoViewController.getInitialScale!.call()! * 1.75;
var size = MediaQuery.of(context).size;
photoViewController.animateScale?.call(
@@ -519,6 +528,9 @@ class _ContinuousModeState extends State<_ContinuousMode>
@override
void handleLongPressUp(Offset location) {
if(!appdata.settings['enableLongPressToZoom']) {
return;
}
double target = photoViewController.getInitialScale!.call()!;
photoViewController.animateScale?.call(target);
}

View File

@@ -54,6 +54,13 @@ class _ReaderSettingsState extends State<ReaderSettings> {
widget.onChanged?.call("autoPageTurningInterval");
},
).toSliver(),
_SwitchSetting(
title: 'Long press to zoom'.tl,
settingKey: 'enableLongPressToZoom',
onChanged: () {
widget.onChanged?.call('enableLongPressToZoom');
},
).toSliver(),
],
);
}