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(
523523 } ;
524524 }
525525
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+ }
526541 // ======================= Action: Click ========================
527542 if ( clickToShow || clickToHide ) {
528543 cloneProps . onClick = (
@@ -541,7 +556,7 @@ export function generateTrigger(
541556 } ;
542557 }
543558
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
545560 useWinClick (
546561 mergedOpen ,
547562 clickToHide ,
@@ -552,7 +567,7 @@ export function generateTrigger(
552567 inPopupOrChild ,
553568 triggerOpen ,
554569 ) ;
555-
570+
556571 // ======================= Action: Hover ========================
557572 const hoverToShow = showActions . has ( 'hover' ) ;
558573 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>;
104104
105105export type StretchType = string ;
106106
107- export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu' ;
107+ export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu' | 'pointDown' ;
108108
109109export type AnimationType = string ;
110110
You can’t perform that action at this time.
0 commit comments