示例#1
0
    def create_widget(self, ix, iy, fx, fy):
        radius = math.hypot(ix - fx, iy - fy)
        pos = (ix - radius, iy - radius)
        size = (2 * radius, 2 * radius)

        return DraggableWidget(pos=pos, size=size)
示例#2
0
    def create_widget(self, ix, iy, fx, fy):
        pos = (min(ix, fx), min(iy, fy))
        size = (abs(fx - ix), abs(fy - iy))

        return DraggableWidget(pos=pos, size=size)
示例#3
0
 def create_widget(self,ix,iy,fx,fy):
     r = math.hypot(ix-fx, iy-fy)
     pos = (ix-r, iy-r)
     size = (2*r, 2*r)
     return DraggableWidget(pos = pos, size = size)