mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-03 17:20:16 +08:00
@@ -1,12 +1,15 @@
|
|||||||
import 'package:flutter/gestures.dart'
|
import 'package:flutter/gestures.dart'
|
||||||
show
|
show
|
||||||
|
PointerDownEvent,
|
||||||
GestureRecognizer,
|
GestureRecognizer,
|
||||||
RecognizerCallback,
|
RecognizerCallback,
|
||||||
ScaleGestureRecognizer,
|
ScaleGestureRecognizer,
|
||||||
|
PointerPanZoomStartEvent,
|
||||||
LongPressGestureRecognizer;
|
LongPressGestureRecognizer;
|
||||||
|
|
||||||
mixin PlayerGestureMixin on GestureRecognizer {
|
mixin PlayerGestureMixin on GestureRecognizer {
|
||||||
bool isPosAllowed = true;
|
bool isPosAllowed = true;
|
||||||
|
bool _isPosAllowed = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
T? invokeCallback<T>(
|
T? invokeCallback<T>(
|
||||||
@@ -14,7 +17,7 @@ mixin PlayerGestureMixin on GestureRecognizer {
|
|||||||
RecognizerCallback<T> callback, {
|
RecognizerCallback<T> callback, {
|
||||||
String Function()? debugReport,
|
String Function()? debugReport,
|
||||||
}) {
|
}) {
|
||||||
if (!isPosAllowed) return null;
|
if (!_isPosAllowed) return null;
|
||||||
return super.invokeCallback(name, callback, debugReport: debugReport);
|
return super.invokeCallback(name, callback, debugReport: debugReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,6 +32,24 @@ class PlayerScaleGestureRecognizer extends ScaleGestureRecognizer
|
|||||||
super.trackpadScrollCausesScale,
|
super.trackpadScrollCausesScale,
|
||||||
super.trackpadScrollToScaleFactor,
|
super.trackpadScrollToScaleFactor,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
void _handleAllowedPointer() {
|
||||||
|
if (isReadyState) {
|
||||||
|
_isPosAllowed = isPosAllowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void addAllowedPointer(PointerDownEvent event) {
|
||||||
|
_handleAllowedPointer();
|
||||||
|
super.addAllowedPointer(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void addAllowedPointerPanZoom(PointerPanZoomStartEvent event) {
|
||||||
|
_handleAllowedPointer();
|
||||||
|
super.addAllowedPointerPanZoom(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlayerLongPressGestureRecognizer extends LongPressGestureRecognizer
|
class PlayerLongPressGestureRecognizer extends LongPressGestureRecognizer
|
||||||
@@ -40,4 +61,12 @@ class PlayerLongPressGestureRecognizer extends LongPressGestureRecognizer
|
|||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
void addAllowedPointer(PointerDownEvent event) {
|
||||||
|
if (state == .ready) {
|
||||||
|
_isPosAllowed = isPosAllowed;
|
||||||
|
}
|
||||||
|
super.addAllowedPointer(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ $ImageCachePatch = "lib/scripts/image_cache.patch"
|
|||||||
|
|
||||||
$ImageAnimPatch = "lib/scripts/image_anim.patch"
|
$ImageAnimPatch = "lib/scripts/image_anim.patch"
|
||||||
|
|
||||||
|
$ScaleGesturePatch = "lib/scripts/scale_gesture.patch"
|
||||||
|
|
||||||
# TODO: remove
|
# TODO: remove
|
||||||
# https://github.com/flutter/flutter/issues/90223
|
# https://github.com/flutter/flutter/issues/90223
|
||||||
$ModalBarrierPatch = "lib/scripts/modal_barrier.patch"
|
$ModalBarrierPatch = "lib/scripts/modal_barrier.patch"
|
||||||
@@ -38,7 +40,7 @@ $picks = @()
|
|||||||
$reverts = @()
|
$reverts = @()
|
||||||
$patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch,
|
$patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch,
|
||||||
$NavigationBarPatch, $PaddingPatch, $ImageCachePatch, $ImageAnimPatch,
|
$NavigationBarPatch, $PaddingPatch, $ImageCachePatch, $ImageAnimPatch,
|
||||||
$LayoutBuilderPatch)
|
$LayoutBuilderPatch, $ScaleGesturePatch)
|
||||||
|
|
||||||
switch ($platform.ToLower()) {
|
switch ($platform.ToLower()) {
|
||||||
"android" {
|
"android" {
|
||||||
|
|||||||
13
lib/scripts/scale_gesture.patch
Normal file
13
lib/scripts/scale_gesture.patch
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart
|
||||||
|
index fe3cdf27a41..7fe56080bc1 100644
|
||||||
|
--- a/packages/flutter/lib/src/gestures/scale.dart
|
||||||
|
+++ b/packages/flutter/lib/src/gestures/scale.dart
|
||||||
|
@@ -398,6 +398,8 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
|
||||||
|
|
||||||
|
_ScaleState _state = _ScaleState.ready;
|
||||||
|
|
||||||
|
+ bool get isReadyState => _state == _ScaleState.ready;
|
||||||
|
+
|
||||||
|
Matrix4? _lastTransform;
|
||||||
|
|
||||||
|
/// {@template flutter.gestures.scale.trackpadScrollCausesScale}
|
||||||
Reference in New Issue
Block a user