@@ -10,6 +10,7 @@ import { NullEngine } from "core/Engines";
1010import type { Engine } from "core/Engines/engine" ;
1111import type { IPointerEvent , IUIEvent } from "core/Events" ;
1212import { PointerEventTypes } from "core/Events" ;
13+ import { InputManager } from "core/Inputs/scene.inputManager" ;
1314import { Vector3 } from "core/Maths/math.vector" ;
1415import { MeshBuilder } from "core/Meshes/meshBuilder" ;
1516import { UtilityLayerRenderer } from "core/Rendering/utilityLayerRenderer" ;
@@ -526,6 +527,39 @@ describe("InputManager", () => {
526527 expect ( tapCt ) . toBe ( 1 ) ;
527528 } ) ;
528529
530+ it ( "Doesn't fire onPointerOberservable for POINTERTAP when ExclusiveDoubleClickMode is enabled" , ( ) => {
531+ let tapCt = 0 ;
532+ let dblTapCt = 0 ;
533+
534+ scene ! . onPointerObservable . add ( ( ) => {
535+ tapCt ++ ;
536+ } , PointerEventTypes . POINTERTAP ) ;
537+
538+ scene ! . onPointerObservable . add ( ( ) => {
539+ dblTapCt ++ ;
540+ } , PointerEventTypes . POINTERDOUBLETAP ) ;
541+
542+ if ( deviceInputSystem ) {
543+ // Expect a single tap and double tap
544+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 1 ) ;
545+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 0 ) ;
546+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 1 ) ;
547+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 0 ) ;
548+
549+ // Expect only a double tap
550+ InputManager . ExclusiveDoubleClickMode = true ;
551+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 1 ) ;
552+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 0 ) ;
553+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 1 ) ;
554+ deviceInputSystem . changeInput ( DeviceType . Mouse , 0 , PointerInput . LeftClick , 0 ) ;
555+ }
556+ // Since this is static, we should reset it to false for other tests
557+ InputManager . ExclusiveDoubleClickMode = false ;
558+
559+ expect ( tapCt ) . toBe ( 1 ) ;
560+ expect ( dblTapCt ) . toBe ( 2 ) ;
561+ } ) ;
562+
529563 it ( "can fire onViewMatrixObservable on camera.update" , ( ) => {
530564 let viewMatrixChangedCt = 0 ;
531565
0 commit comments