예제 #1
0
    def mouseCursorPosCallback(self, xpos, ypos):

        mousePos = OpenGL3lib.returnOpenGLcoord((xpos, ypos))

        if (mousePos[0] >= self.x) and (mousePos[0] <= (self.x + self.width)):
            if (mousePos[1] >= self.y + self.height -
                    self.titleBarHeight) and (mousePos[1] <=
                                              (self.y + self.height)):
                self.MOUSE_OVER_TITLEBAR = True
            else:
                self.MOUSE_OVER_TITLEBAR = False
        else:
            self.MOUSE_OVER_TITLEBAR = False

        #print("mouse over me:", self.MOUSE_OVER_ME)
        self.dragged = False
        if (self.titleBarLeftClicked
                == True) and (self.previousMouseLeftBtnState
                              == "DOWN"):  # I have been dragged
            self.dragged = True
            self.mousedisplacement_x = mousePos[0] - self.previousMousePos[0]
            self.mousedisplacement_y = mousePos[1] - self.previousMousePos[1]
            self.moveBy(self.mousedisplacement_x, self.mousedisplacement_y)
        self.previousMousePos = mousePos

        #logging.debug("leftclicked:%s, dragged: %s, mouse move: %s, %s", self.leftClicked, self.dragged, self.mousedisplacement_x, self.mousedisplacement_y)
        super(Window, self).mouseCursorPosCallback(xpos, ypos)
예제 #2
0
	def mouseMovePlateTextureCallback(self, xpos, ypos):
		mousePos = OpenGL3lib.returnOpenGLcoord((xpos,ypos))
		
		if (self.leftClicked == True) and (self.previousMouseLeftBtnState == "DOWN") and (self.MOUSE_OVER_TITLEBAR == False): 
			self.textXdispl -= mousePos[0] - self.previousMousePosPlateText[0]
			self.textYdispl -= mousePos[1] - self.previousMousePosPlateText[1]
			
			self.airportPlateImage.translateTexture(self.textXdispl,self.textYdispl)
		self.previousMousePosPlateText = mousePos
예제 #3
0
    def mouseCursorPosCallback(self, xpos, ypos):
        mousePos = OpenGL3lib.returnOpenGLcoord((xpos, ypos))

        if (mousePos[0] >= self.x) and (mousePos[0] <= (self.x + self.width)):
            if (mousePos[1] >= self.y) and (mousePos[1] <=
                                            (self.y + self.height)):
                self.MOUSE_OVER_ME = True
            else:
                self.MOUSE_OVER_ME = False
        else:
            self.MOUSE_OVER_ME = False

        #print("mouse over me:", self.MOUSE_OVER_ME)
        self.dragged = False
        if (self.leftClicked == True) and (self.previousMouseLeftBtnState
                                           == "DOWN"):  # I have been dragged
            self.dragged = True
            self.mousedisplacement_x = mousePos[0] - self.previousMousePos[0]
            self.mousedisplacement_y = mousePos[1] - self.previousMousePos[1]
            if self.draggable == True:
                self.moveBy(self.mousedisplacement_x, self.mousedisplacement_y)
        self.previousMousePos = mousePos