diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-01-11 19:48:50 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-01-11 19:48:50 (GMT) |
commit | d87b2bf231461b9bb1a42dbbf904366b78e523e5 (patch) | |
tree | 748743da806a4c6846260c2a8e1c3f4683d44e82 | |
parent | 85aac4be684f1233d534ab10f19dc48d57a3b88d (diff) |
Selection disapear - SL #4375
If there are a selection already finished, should be painted,
when draw the selected area. Redraw can be triggered by events
externals to what the user do, like canvas scroll due to
open or close subtoolbars,
or a window opened over the canvas (ObjectChooser)
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | Area.py | 13 | ||||
-rw-r--r-- | Desenho.py | 5 |
2 files changed, 13 insertions, 5 deletions
@@ -189,6 +189,7 @@ class Area(Gtk.DrawingArea): self.last = [] self.keep_aspect_ratio = False self.keep_shape_ratio = False + self._selection_finished = False self._set_screen_dpi() @@ -281,6 +282,15 @@ class Area(Gtk.DrawingArea): return x, y, width, height = self.get_selection_bounds() + if self._selection_finished: + ctx.save() + selection_surface = self.get_selection() + ctx.translate(x, y) + ctx.set_source_surface(selection_surface) + ctx.rectangle(0, 0, width, height) + ctx.paint() + ctx.restore() + ctx.save() ctx.set_line_width(1) ctx.set_source_rgba(1., 1., 1., 1.) @@ -1433,6 +1443,7 @@ class Area(Gtk.DrawingArea): self._selection_horizontal_scale = 1.0 self._selection_vertical_scale = 1.0 self.selection_resized_surface = None + self._selection_finished = False def set_selection_bounds(self, x, y, width, height): """ @@ -1469,6 +1480,7 @@ class Area(Gtk.DrawingArea): selection_ctx.set_source_surface(self.temp_canvas) selection_ctx.paint() self.selection_resized_surface = None + self._selection_finished = True if clear_background: self.pending_clean_selection_background = True @@ -1569,6 +1581,7 @@ class Area(Gtk.DrawingArea): self.set_selection_bounds(0, 0, width, height) self.desenha = True self._selmove = True + self._selection_finished = True self.tool['name'] = 'marquee-rectangular' self.emit('select') @@ -681,11 +681,6 @@ class Desenho: widget.oldy = coords[1] new_x, new_y = x + dx, y + dy - widget.temp_ctx.save() - widget.temp_ctx.translate(new_x, new_y) - widget.temp_ctx.set_source_surface(selection_surface) - widget.temp_ctx.paint() - widget.temp_ctx.restore() widget.set_selection_start(new_x, new_y) widget.queue_draw() |