Changeset 544:ea396ebc7a92


Ignore:
Timestamp:
09/07/13 19:26:32 (8 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Rebase:
38636337313431303133393462636233363736336361356561366464656338653130613033336437
Message:

Less leaky object movement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/area_editor.py

    r543 r544  
    188188    def reset_objs(self):
    189189        # Reset the object state - needed when changing stuff
     190        old_drawable = self.drawables[:]
    190191        self.drawables = []
    191192        self.overlay_drawables = []
     
    634635            corrected_pos = self._level_coordinates(ev.pos)
    635636            snapped_pos = self.snap_to_grid(corrected_pos)
    636             self._update_pos(self.move_obj, snapped_pos)
     637            self._move_obj(self.move_obj, snapped_pos)
    637638        if old_pos != self.mouse_pos and (self.cur_poly or self._draw_lines
    638639                                          or self._move_point_mode
     
    873874                    edit_dlg.cleanup()
    874875
    875     def _update_pos(self, obj, new_pos):
     876    def _move_obj(self, obj, new_pos):
     877        new_coords = self.level.point_to_pymunk(new_pos)
     878        shape = obj.get_shape()
     879        shape.body.position = (new_coords[0], new_coords[1])
     880        self.invalidate()
     881
     882    def _update_pos(self, obj, new_pos, final=False):
    876883        data = self.level.lookup[obj]
    877884        new_coords = self.level.point_to_pymunk(new_pos)
Note: See TracChangeset for help on using the changeset viewer.