예제 #1
0
    def calc(self, mx, my):
        '''
        args: mx,my screen coordinates of mouse
        return self or none
        '''
        #put the mouse coordinates in item space
        mx -= self.x
        my -= self.y
        mouse = Vector((mx, my))
        rmatrix = Matrix.Rotation(-1 * self.rot, 2)
        mouse = (1 / self.scale) * (rmatrix * mouse)

        if self.calc_mode == "POLY_LOOP":
            if pmu.point_inside_loop(self.poly_bound, mouse):
                #print(self.id)
                return True
            else:
                return False

        if self.calc_mode == "ICON_QUAD":  #TODO, make this actually test based on the icon quad
            if pmu.point_inside_loop(self.poly_bound, mouse):
                #print(self.id)
                return True
            else:
                return False
예제 #2
0
    def calc(self, mx, my, precision=False, push_now=False):
        '''
        args: mx,my screen coordinates of mouse
        return self or none
        '''
        #put the mouse coordinates in item space
        mx -= self.x
        my -= self.y
        mouse = Vector((mx, my))
        rmatrix = Matrix.Rotation(-1 * self.rot, 2)
        mouse = (1 / self.scale) * (rmatrix * mouse)

        if pmu.point_inside_loop(self.cheap_box, mouse):
            pctg = mouse[0] / (self.width - 2 * self.corner_radius
                               ) + .5  #TODO may need to add scale here
            if pctg > 1:
                if not precision:
                    self.pctg = 1
            else:
                if not precision:
                    self.pctg = pctg

            if push_now:
                self.push_to_prop()
            return True
        else:
            return False
예제 #3
0
 def calc(self,mx,my,precision = False, push_now = False):
     '''
     args: mx,my screen coordinates of mouse
     return self or none
     '''
     #put the mouse coordinates in item space
     mx -= self.x
     my -= self.y
     mouse = Vector((mx,my))
     rmatrix = Matrix.Rotation(-1*self.rot,2)
     mouse = (1/self.scale)*(rmatrix*mouse)
     
     if pmu.point_inside_loop(self.cheap_box,mouse):
         pctg = mouse[0]/(self.width-2*self.corner_radius) + .5 #TODO may need to add scale here
         if pctg > 1:
             if not precision:
                 self.pctg = 1
         else:
             if not precision:
                 self.pctg = pctg
         
         if push_now:
             self.push_to_prop()   
         return True
     else: return False
예제 #4
0
    def calc(self, mx, my):
        '''
        args: mx,my screen coordinates of mouse
        return self or none
        '''
        #put the mouse coordinates in item space
        mx -= self.x
        my -= self.y
        mouse = Vector((mx,my))
        rmatrix = Matrix.Rotation(-1*self.rot,2)
        mouse = (1/self.scale)*(rmatrix*mouse)
        
        if self.calc_mode == "POLY_LOOP":
            if pmu.point_inside_loop(self.poly_bound,mouse):
                #print(self.id)
                return True
            else: return False

        if self.calc_mode == "ICON_QUAD": #TODO, make this actually test based on the icon quad
            if pmu.point_inside_loop(self.poly_bound,mouse):
                #print(self.id)
                return True
            else: return False
예제 #5
0
    def calc(self, mx, my, push_now=False):
        '''
        args: mx,my screen coordinates of mouse
        return self or none
        '''
        #put the mouse coordinates in item space
        mx -= self.x
        my -= self.y
        mouse = Vector((mx, my))
        rmatrix = Matrix.Rotation(-1 * self.rot, 2)
        mouse = (1 / self.scale) * (rmatrix * mouse)

        if pmu.point_inside_loop(self.poly_bound, mouse):
            return True
        else:
            return False
예제 #6
0
 def calc(self,mx,my,push_now = False):
     '''
     args: mx,my screen coordinates of mouse
     return self or none
     '''
     #put the mouse coordinates in item space
     mx -= self.x
     my -= self.y
     mouse = Vector((mx,my))
     rmatrix = Matrix.Rotation(-1*self.rot,2)
     mouse = (1/self.scale)*(rmatrix*mouse)
     
     if pmu.point_inside_loop(self.poly_bound,mouse):  
         return True
     else: 
         return False