File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ const CLICK_FUNC_CHANNEL = "org.overte.context-menu.click";
2929const ACTIONS_CHANNEL = "org.overte.context-menu.actions" ;
3030const MAIN_CHANNEL = "org.overte.context-menu" ;
3131
32+ const DEBOUNCE_THRESHOLD_MS = 50 ;
33+
3234const SENSOR_TO_WORLD_MATRIX_INDEX = 65534 ;
3335const CAMERA_MATRIX_INDEX = 65529 ;
3436
@@ -178,6 +180,7 @@ let currentMenuInSubmenu = false;
178180let currentMenuTargetLine = Uuid . NULL ;
179181let mouseWasCaptured = false ;
180182let disableCounter = 0 ;
183+ let prevClickTime = Date . now ( ) ;
181184
182185function ContextMenu_DeleteMenu ( ) {
183186 currentMenuEntities . forEach ( ( _ , e ) => Entities . deleteEntity ( e ) ) ;
@@ -194,7 +197,9 @@ function ContextMenu_DeleteMenu() {
194197function ContextMenu_EntityClick ( eid , event ) {
195198 if ( ! event . isPrimaryButton ) { return ; }
196199 if ( ! currentMenuEntities . has ( eid ) ) { return ; }
200+ if ( Date . now ( ) < prevClickTime + DEBOUNCE_THRESHOLD_MS ) { return ; }
197201
202+ prevClickTime = Date . now ( ) ;
198203 currentMenuInSubmenu = false ;
199204
200205 try {
You can’t perform that action at this time.
0 commit comments