File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,28 @@ impl ClickTracker {
253
253
return ClickCount :: Single ;
254
254
} ;
255
255
256
+ match state {
257
+ ElementState :: Pressed if record. down_count == ClickCount :: Double => {
258
+ * record = ClickRecord {
259
+ time : now,
260
+ position : position. clone ( ) ,
261
+ down_count : ClickCount :: Single ,
262
+ up_count : record. up_count . clone ( ) ,
263
+ } ;
264
+ return ClickCount :: Single ;
265
+ }
266
+ ElementState :: Released if record. up_count == ClickCount :: Double => {
267
+ * record = ClickRecord {
268
+ time : now,
269
+ position : position. clone ( ) ,
270
+ down_count : record. down_count . clone ( ) ,
271
+ up_count : ClickCount :: Single ,
272
+ } ;
273
+ return ClickCount :: Single ;
274
+ }
275
+ _ => { }
276
+ }
277
+
256
278
let dx = position. x . abs_diff ( record. position . x ) ;
257
279
let dy = position. y . abs_diff ( record. position . y ) ;
258
280
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL ;
@@ -278,7 +300,7 @@ impl ClickTracker {
278
300
}
279
301
}
280
302
281
- #[ derive( Clone ) ]
303
+ #[ derive( Clone , PartialEq ) ]
282
304
enum ClickCount {
283
305
Single ,
284
306
Double ,
You can’t perform that action at this time.
0 commit comments