mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt gesture
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -279,10 +279,12 @@ class MyApp extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (plCtr.isDesktopPip) {
|
if (plCtr.isDesktopPip) {
|
||||||
// plCtr.exitDesktopPip();
|
plCtr.exitDesktopPip().whenComplete(
|
||||||
// return;
|
() => plCtr.initialFocalPoint = Offset.zero,
|
||||||
// }
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Get.back();
|
Get.back();
|
||||||
|
|||||||
@@ -262,14 +262,16 @@ class PlPlayerController {
|
|||||||
late bool isDesktopPip = false;
|
late bool isDesktopPip = false;
|
||||||
late Rect _lastWindowBounds;
|
late Rect _lastWindowBounds;
|
||||||
|
|
||||||
void exitDesktopPip() {
|
Offset initialFocalPoint = Offset.zero;
|
||||||
isDesktopPip = false;
|
|
||||||
|
|
||||||
windowManager
|
Future<void> exitDesktopPip() async {
|
||||||
..setTitleBarStyle(TitleBarStyle.normal)
|
isDesktopPip = false;
|
||||||
..setMinimumSize(const Size(400, 700))
|
await Future.wait([
|
||||||
..setBounds(_lastWindowBounds)
|
windowManager.setTitleBarStyle(TitleBarStyle.normal),
|
||||||
..setAlwaysOnTop(false);
|
windowManager.setMinimumSize(const Size(400, 700)),
|
||||||
|
windowManager.setBounds(_lastWindowBounds),
|
||||||
|
windowManager.setAlwaysOnTop(false),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> enterDesktopPip() async {
|
Future<void> enterDesktopPip() async {
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
late final RxBool showRestoreScaleBtn = false.obs;
|
late final RxBool showRestoreScaleBtn = false.obs;
|
||||||
|
|
||||||
Offset _initialFocalPoint = Offset.zero;
|
|
||||||
GestureType? _gestureType;
|
GestureType? _gestureType;
|
||||||
|
|
||||||
//播放器放缩
|
//播放器放缩
|
||||||
@@ -810,7 +809,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
if (details.pointerCount == 2) {
|
if (details.pointerCount == 2) {
|
||||||
interacting = true;
|
interacting = true;
|
||||||
}
|
}
|
||||||
_initialFocalPoint = details.localFocalPoint;
|
plPlayerController.initialFocalPoint = details.localFocalPoint;
|
||||||
// if (kDebugMode) {
|
// if (kDebugMode) {
|
||||||
// debugPrint("_initialFocalPoint$_initialFocalPoint");
|
// debugPrint("_initialFocalPoint$_initialFocalPoint");
|
||||||
// }
|
// }
|
||||||
@@ -819,8 +818,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
void _onInteractionUpdate(ScaleUpdateDetails details) {
|
void _onInteractionUpdate(ScaleUpdateDetails details) {
|
||||||
showRestoreScaleBtn.value = transformationController.value.row0.x != 1.0;
|
showRestoreScaleBtn.value = transformationController.value.row0.x != 1.0;
|
||||||
if (interacting || _initialFocalPoint == Offset.zero) return;
|
if (interacting || plPlayerController.initialFocalPoint == Offset.zero) {
|
||||||
Offset cumulativeDelta = details.localFocalPoint - _initialFocalPoint;
|
return;
|
||||||
|
}
|
||||||
|
Offset cumulativeDelta =
|
||||||
|
details.localFocalPoint - plPlayerController.initialFocalPoint;
|
||||||
if (details.pointerCount == 2 && cumulativeDelta.distance < 1.5) {
|
if (details.pointerCount == 2 && cumulativeDelta.distance < 1.5) {
|
||||||
interacting = true;
|
interacting = true;
|
||||||
_gestureType = null;
|
_gestureType = null;
|
||||||
@@ -955,7 +957,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
} else if (_gestureType == GestureType.center) {
|
} else if (_gestureType == GestureType.center) {
|
||||||
// 全屏
|
// 全屏
|
||||||
const double threshold = 2.5; // 滑动阈值
|
const double threshold = 2.5; // 滑动阈值
|
||||||
double cumulativeDy = details.localFocalPoint.dy - _initialFocalPoint.dy;
|
double cumulativeDy =
|
||||||
|
details.localFocalPoint.dy - plPlayerController.initialFocalPoint.dy;
|
||||||
|
|
||||||
void fullScreenTrigger(bool status) {
|
void fullScreenTrigger(bool status) {
|
||||||
plPlayerController.triggerFullScreen(status: status);
|
plPlayerController.triggerFullScreen(status: status);
|
||||||
@@ -1014,7 +1017,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
plPlayerController.onChangedSliderEnd();
|
plPlayerController.onChangedSliderEnd();
|
||||||
}
|
}
|
||||||
interacting = false;
|
interacting = false;
|
||||||
_initialFocalPoint = Offset.zero;
|
plPlayerController.initialFocalPoint = Offset.zero;
|
||||||
_gestureType = null;
|
_gestureType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user