This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/components/structures Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ export default class PictureInPictureDragger extends React.Component<IProps> {
70
70
( ) => this . animationCallback ( ) ,
71
71
( ) => requestAnimationFrame ( ( ) => this . scheduledUpdate . trigger ( ) ) ,
72
72
) ;
73
+ private startingPositionX = 0 ;
74
+ private startingPositionY = 0 ;
73
75
74
76
private _moving = false ;
75
77
public get moving ( ) : boolean {
@@ -192,11 +194,19 @@ export default class PictureInPictureDragger extends React.Component<IProps> {
192
194
event . stopPropagation ( ) ;
193
195
194
196
this . mouseHeld = true ;
197
+ this . startingPositionX = event . pageX ;
198
+ this . startingPositionY = event . pageY ;
195
199
} ;
196
200
197
201
private onMoving = ( event : MouseEvent ) : void => {
198
202
if ( ! this . mouseHeld ) return ;
199
203
204
+ if ( Math . abs ( this . startingPositionX - event . pageX ) < 5 && Math . abs ( this . startingPositionY - event . pageY ) < 5 ) {
205
+ // User needs to move the widget by at least five pixels.
206
+ // Improves click detection when using a touchpad or with nervous hands.
207
+ return ;
208
+ }
209
+
200
210
event . preventDefault ( ) ;
201
211
event . stopPropagation ( ) ;
202
212
You can’t perform that action at this time.
0 commit comments