Changeset 167:bb297f3f99f4


Ignore:
Timestamp:
Sep 3, 2013, 9:21:43 AM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Message:

Allow using right mouse button to drag level display

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/area_editor.py

    r166 r167  
    154154        self.mouse_pos = None
    155155        self.cur_poly = None
     156        self._mouse_drag = False
    156157
    157158    def _level_coordinates(self, pos):
     
    222223            self.invalidate()
    223224
     225    def mouse_drag(self, ev):
     226        if self._mouse_drag:
     227            old_pos = self.mouse_pos
     228            self.mouse_pos = ev.pos
     229            diff = (-self.mouse_pos[0] + old_pos[0],
     230                    -self.mouse_pos[1] + old_pos[1])
     231            self._move_view(diff)
     232            self.invalidate()
     233
    224234    def mouse_down(self, ev):
    225235        if ev.button == 4:  # Scroll up
     
    231241        elif ev.button == 7:  # Scroll right
    232242            self._move_view((10, 0))
    233         elif self.cur_poly:
     243        elif self.cur_poly and ev.button == 1:
    234244            # Add a point
    235245            self.level.add_point(self.cur_poly,
    236246                                 self._level_coordinates(ev.pos))
     247        elif ev.button == 3:
     248            self._mouse_drag = True
     249
     250    def mouse_up(self, ev):
     251        if ev.button == 3:
     252            self._mouse_drag = False
    237253
    238254    def close_poly(self):
Note: See TracChangeset for help on using the changeset viewer.