File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -523,6 +523,21 @@ export function generateTrigger(
523
523
} ;
524
524
}
525
525
526
+ // ======================= Action: PointDown ========================
527
+ const pointDownToShow = showActions . has ( 'pointDown' ) ;
528
+ const pointDownToHide = hideActions . has ( 'pointDown' ) ;
529
+ if ( pointDownToShow || pointDownToHide ) {
530
+ cloneProps . onPointDown = ( event : React . PointerEvent < HTMLElement > , ...args : any [ ] ) => {
531
+ if ( openRef . current && pointDownToHide ) {
532
+ triggerOpen ( false ) ; // to hide
533
+ } else if ( ! openRef . current && pointDownToShow ) {
534
+ setMousePosByEvent ( event ) ;
535
+ triggerOpen ( true ) ;
536
+ }
537
+ // origin methods
538
+ originChildProps . onPointDown ?.( event , ...args ) ;
539
+ }
540
+ }
526
541
// ======================= Action: Click ========================
527
542
if ( clickToShow || clickToHide ) {
528
543
cloneProps . onClick = (
@@ -541,7 +556,7 @@ export function generateTrigger(
541
556
} ;
542
557
}
543
558
544
- // Click to hide is special action since click popup element should not hide
559
+ // Click/PointDown to hide is special action since click popup element should not hide
545
560
useWinClick (
546
561
mergedOpen ,
547
562
clickToHide ,
@@ -552,7 +567,7 @@ export function generateTrigger(
552
567
inPopupOrChild ,
553
568
triggerOpen ,
554
569
) ;
555
-
570
+
556
571
// ======================= Action: Hover ========================
557
572
const hoverToShow = showActions . has ( 'hover' ) ;
558
573
const hoverToHide = hideActions . has ( 'hover' ) ;
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export type BuildInPlacements = Record<string, AlignType>;
104
104
105
105
export type StretchType = string ;
106
106
107
- export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu' ;
107
+ export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu' | 'pointDown' ;
108
108
109
109
export type AnimationType = string ;
110
110
You can’t perform that action at this time.
0 commit comments