def drag(self, pos): if not self.last_drag_pos: self.last_drag_pos = self.start_drag delta = ui._subpoints(self.last_drag_pos, pos) self.last_drag_pos = pos self.drawer.move_map(delta)
def drag(self, pos): if not self.last_drag_pos: self.last_drag_pos = self.start_drag delta = ui._subpoints(self.last_drag_pos, pos) x, y = freeciv.func.get_map_view_origin() #print 'drag', x + delta[0], y + delta[1] freeciv.func.set_mapview_origin(x + delta[0], y + delta[1]) self.last_drag_pos = pos
def draw_clipped(self, surf, pos, clip): rect = graphics.Rect(clip) cliptex = graphics.create_surface(rect[2], rect[3]) relpos = ui._subpoints(pos, (rect[0], rect[1])) self.draw(cliptex, relpos) surf.blit(cliptex, (rect[0], rect[1]))
def event(self, ev): if ev.type == pygame.MOUSEBUTTONDOWN: myabspos = ui._subpoints(ev.abs_pos, ev.pos) self.shown = True ui.add_overlay(self.scroll, myabspos) elif ev.type == pygame.MOUSEBUTTONUP: self.shown = False if self.scroll in ui.overlays: ui.overlays.remove(self.scroll)