@@ -83,7 +83,7 @@ impl MessageHandler<InputPreprocessorMessage, ()> for InputPreprocessorMessageHa
8383 let mouse_state = editor_mouse_state. to_mouse_state ( & self . viewport_bounds ) ;
8484 self . mouse . position = mouse_state. position ;
8585
86- self . translate_mouse_event ( mouse_state, responses) ;
86+ self . translate_mouse_event ( mouse_state, true , responses) ;
8787 }
8888 InputPreprocessorMessage :: PointerMove { editor_mouse_state, modifier_keys } => {
8989 self . handle_modifier_keys ( modifier_keys, responses) ;
@@ -94,15 +94,15 @@ impl MessageHandler<InputPreprocessorMessage, ()> for InputPreprocessorMessageHa
9494 responses. push_back ( InputMapperMessage :: PointerMove . into ( ) ) ;
9595
9696 // While any pointer button is already down, additional button down events are not reported, but they are sent as `pointermove` events
97- self . translate_mouse_event ( mouse_state, responses) ;
97+ self . translate_mouse_event ( mouse_state, false , responses) ;
9898 }
9999 InputPreprocessorMessage :: PointerUp { editor_mouse_state, modifier_keys } => {
100100 self . handle_modifier_keys ( modifier_keys, responses) ;
101101
102102 let mouse_state = editor_mouse_state. to_mouse_state ( & self . viewport_bounds ) ;
103103 self . mouse . position = mouse_state. position ;
104104
105- self . translate_mouse_event ( mouse_state, responses) ;
105+ self . translate_mouse_event ( mouse_state, false , responses) ;
106106 }
107107 } ;
108108 }
@@ -114,12 +114,12 @@ impl MessageHandler<InputPreprocessorMessage, ()> for InputPreprocessorMessageHa
114114}
115115
116116impl InputPreprocessorMessageHandler {
117- fn translate_mouse_event ( & mut self , new_state : MouseState , responses : & mut VecDeque < Message > ) {
117+ fn translate_mouse_event ( & mut self , new_state : MouseState , allow_first_button_down : bool , responses : & mut VecDeque < Message > ) {
118118 for ( bit_flag, key) in [ ( MouseKeys :: LEFT , Key :: Lmb ) , ( MouseKeys :: RIGHT , Key :: Rmb ) , ( MouseKeys :: MIDDLE , Key :: Mmb ) ] {
119119 // Calculate the intersection between the two key states
120120 let old_down = self . mouse . mouse_keys & bit_flag == bit_flag;
121121 let new_down = new_state. mouse_keys & bit_flag == bit_flag;
122- if !old_down && new_down {
122+ if !old_down && new_down && ( allow_first_button_down || self . mouse . mouse_keys != MouseKeys :: NONE ) {
123123 responses. push_back ( InputMapperMessage :: KeyDown ( key) . into ( ) ) ;
124124 }
125125 if old_down && !new_down {
0 commit comments