@@ -18,6 +18,7 @@ public sealed partial class BiliPlayer : PlayerControlBase
18
18
private Rect _transportControlTriggerRect ;
19
19
private DispatcherTimer ? _cursorTimer ;
20
20
21
+ private bool _isHolding ;
21
22
private double _lastSpeed ;
22
23
private double _cursorStayTime ;
23
24
private double _mtcStayTime ;
@@ -127,6 +128,23 @@ private void HookRootPointerEvents()
127
128
_overlayContainer . PointerExited += OnRootPointerExited ;
128
129
_overlayContainer . PointerPressed += OnRootPointerPressed ;
129
130
_overlayContainer . PointerCanceled += OnRootPointerCanceled ;
131
+ _overlayContainer . PointerReleased += OnRootPointerReleased ;
132
+ }
133
+
134
+ private void OnGestureRecognizerHolding ( GestureRecognizer sender , HoldingEventArgs args )
135
+ {
136
+ _isHolding = true ;
137
+ if ( args . HoldingState == HoldingState . Started )
138
+ {
139
+ _lastSpeed = ViewModel . Speed ;
140
+ ViewModel . SetSpeedCommand . Execute ( 3d ) ;
141
+ }
142
+ else
143
+ {
144
+ _lastSpeed = _lastSpeed == 0 ? 1.0 : _lastSpeed ;
145
+ ViewModel . SetSpeedCommand . Execute ( _lastSpeed ) ;
146
+ _lastSpeed = 0 ;
147
+ }
130
148
}
131
149
132
150
private void UnhookRootPointerEvents ( )
@@ -138,18 +156,20 @@ private void UnhookRootPointerEvents()
138
156
_overlayContainer . PointerExited -= OnRootPointerExited ;
139
157
_overlayContainer . PointerPressed -= OnRootPointerPressed ;
140
158
_overlayContainer . PointerCanceled -= OnRootPointerCanceled ;
159
+ _overlayContainer . PointerReleased -= OnRootPointerReleased ;
141
160
}
142
161
}
143
162
144
163
private void HookInteractionControlEvents ( )
145
164
{
146
165
_interactionControl . Tapped += OnCoreTapped ;
147
166
_interactionControl . DoubleTapped += OnCoreDoubleTapped ;
148
- _interactionControl . Holding += OnCoreHolding ;
149
167
_interactionControl . ManipulationMode = ManipulationModes . TranslateX | ManipulationModes . TranslateY ;
150
168
_interactionControl . ManipulationStarted += OnInteractionControlManipulationStarted ;
151
169
_interactionControl . ManipulationDelta += OnInteractionControlManipulationDelta ;
152
170
_interactionControl . ManipulationCompleted += OnInteractionControlManipulationCompleted ;
171
+ _interactionControl . ContextRequested += OnInteractionControlContextRequested ;
172
+ _gestureRecognizer . Holding += OnGestureRecognizerHolding ;
153
173
}
154
174
155
175
private void UnhookInteractionControlEvents ( )
@@ -158,10 +178,11 @@ private void UnhookInteractionControlEvents()
158
178
{
159
179
_interactionControl . Tapped -= OnCoreTapped ;
160
180
_interactionControl . DoubleTapped -= OnCoreDoubleTapped ;
161
- _interactionControl . Holding -= OnCoreHolding ;
162
181
_interactionControl . ManipulationStarted -= OnInteractionControlManipulationStarted ;
163
182
_interactionControl . ManipulationDelta -= OnInteractionControlManipulationDelta ;
164
183
_interactionControl . ManipulationCompleted -= OnInteractionControlManipulationCompleted ;
184
+ _interactionControl . ContextRequested -= OnInteractionControlContextRequested ;
185
+ _gestureRecognizer . Holding -= OnGestureRecognizerHolding ;
165
186
}
166
187
}
167
188
@@ -237,6 +258,12 @@ private void OnViewModelInitialized(object? sender, EventArgs e)
237
258
238
259
private void OnCoreTapped ( object sender , TappedRoutedEventArgs e )
239
260
{
261
+ if ( _isHolding )
262
+ {
263
+ _isHolding = false ;
264
+ return ;
265
+ }
266
+
240
267
var isManual = SettingsToolkit . ReadLocalSetting ( SettingNames . MTCBehavior , MTCBehavior . Automatic ) == MTCBehavior . Manual ;
241
268
if ( isManual )
242
269
{
@@ -274,21 +301,6 @@ private void OnCoreDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
274
301
}
275
302
}
276
303
277
- private void OnCoreHolding ( object sender , HoldingRoutedEventArgs e )
278
- {
279
- if ( e . HoldingState == HoldingState . Started )
280
- {
281
- _lastSpeed = ViewModel . Speed ;
282
- ViewModel . SetSpeedCommand . Execute ( 3d ) ;
283
- }
284
- else
285
- {
286
- _lastSpeed = _lastSpeed == 0 ? 1.0 : _lastSpeed ;
287
- ViewModel . SetSpeedCommand . Execute ( _lastSpeed ) ;
288
- _lastSpeed = 0 ;
289
- }
290
- }
291
-
292
304
private void OnViewModelInnerPropertyChanged ( object ? sender , PropertyChangedEventArgs e )
293
305
{
294
306
if ( _overlayContainer is not null )
0 commit comments