original_docstring:  Process a mouse motion event with a pressed button. 
docstring: Process a mouse motion event with a pressed button.
docstring_tokens: Process a mouse motion event with a pressed button .
code: def motion(self, x, y):
          """ Process a mouse motion event with a pressed button. """
          rs = 0.5
          dx = x - self.x_start
          dy = y - self.y_start
  
          if (self.action == MouseActions.ROTATE_XY):
              self.xform.rotate_x += rs*dy
              self.xform.rotate_y += rs*dx
  
          elif (self.action == MouseActions.ROTATE_Z):
              self.xform.rotate_z += rs*(dx+dy)
  
          elif (self.action == MouseActions.TRANSLATE_XY):
              wx, wy, wz = self.extent.get_widths()
              sx = wy / 200.0
              sy = wy / 200.0
              self.xform.translate_x +=  sx*dx
              self.xform.translate_y += -sy*dy
  
          elif (self.action == MouseActions.ZOOM):
              self.xform.scale += 0.05*(dx+dy)
              if ( self.xform.scale < 0.01):
                  self.xform.scale = 0.01
          else:
              print("Unknown action\n", action)
  
          self.x_start = x
          self.y_start = y
          glutPostRedisplay()
code_tokens: def motion ( self , x , y ) : rs = 0.5 dx = x - self . x_start dy = y - self . y_start if ( self . action == MouseActions . ROTATE_XY ) : self . xform . rotate_x += rs * dy self . xform . rotate_y += rs * dx elif ( self . action == MouseActions . ROTATE_Z ) : self . xform . rotate_z += rs * ( dx + dy ) elif ( self . action == MouseActions . TRANSLATE_XY ) : wx , wy , wz = self . extent . get_widths ( ) sx = wy / 200.0 sy = wy / 200.0 self . xform . translate_x += sx * dx self . xform . translate_y += - sy * dy elif ( self . action == MouseActions . ZOOM ) : self . xform . scale += 0.05 * ( dx + dy ) if ( self . xform . scale < 0.01 ) : self . xform . scale = 0.01 else : print ( "Unknown action\n" , action ) self . x_start = x self . y_start = y glutPostRedisplay ( )
short_docstring: Process a mouse motion event with a pressed button.
short_docstring_tokens: Process a mouse motion event with a pressed button .
comment: """ Process a mouse motion event with a pressed button. """