Przeglądaj źródła

Made alt modifier information get sent while mouse button 1 is still pressed

Gyedo Jeon 18 lat temu
rodzic
commit
e44724fc4b
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      direct/src/directtools/DirectSession.py

+ 8 - 0
direct/src/directtools/DirectSession.py

@@ -118,6 +118,7 @@ class DirectSession(DirectObject):
         self.fControl = 0
         self.fControl = 0
         self.fAlt = 0
         self.fAlt = 0
         self.fShift = 0
         self.fShift = 0
+        self.fMouse1 = 0 # [gjeon] to update alt key information while mouse1 is pressed
 
 
         self.pos = VBase3()
         self.pos = VBase3()
         self.hpr = VBase3()
         self.hpr = VBase3()
@@ -374,8 +375,10 @@ class DirectSession(DirectObject):
     def inputHandler(self, input):
     def inputHandler(self, input):
         # Deal with keyboard and mouse input
         # Deal with keyboard and mouse input
         if input == 'mouse1-up':
         if input == 'mouse1-up':
+            self.fMouse1 = 0 # [gjeon] to update alt key information while mouse1 is pressed
             messenger.send('DIRECT-mouse1Up')
             messenger.send('DIRECT-mouse1Up')
         elif input.find('mouse1') != -1:
         elif input.find('mouse1') != -1:
+            self.fMouse1 = 1 # [gjeon] to update alt key information while mouse1 is pressed
             modifiers = self.getModifiers(input, 'mouse1')
             modifiers = self.getModifiers(input, 'mouse1')
             messenger.send('DIRECT-mouse1', sentArgs = [modifiers])
             messenger.send('DIRECT-mouse1', sentArgs = [modifiers])
         elif input == 'mouse2-up':
         elif input == 'mouse2-up':
@@ -398,6 +401,11 @@ class DirectSession(DirectObject):
             self.fControl = 0
             self.fControl = 0
         elif input == 'alt':
         elif input == 'alt':
             self.fAlt = 1
             self.fAlt = 1
+            # [gjeon] to update alt key information while mouse1 is pressed
+            if self.fMouse1:
+                modifiers = DIRECT_NO_MOD
+                modifiers |= DIRECT_ALT_MOD
+                messenger.send('DIRECT-mouse1', sentArgs = [modifiers])
         elif input == 'alt-up':
         elif input == 'alt-up':
             self.fAlt = 0
             self.fAlt = 0
         elif input == 'page_up':
         elif input == 'page_up':