Changeset 1814

Show
Ignore:
Timestamp:
08/01/07 23:55:34 (1 year ago)
Author:
arj..@yirdis.nl
Message:

also attempt matrix updating for items marked for bb recalculation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/gaphas/view.py

    r1813 r1814  
    559559        Update view status according to the items updated by the canvas. 
    560560        """ 
    561         if not self.window: return True 
     561        if not self.window: return 
    562562 
    563563        dirty_items = self._dirty_items 
    564564        dirty_matrix_items = self._dirty_matrix_items 
    565  
    566         # Do not update items that require a full update (or are removed) 
    567         dirty_matrix_items = dirty_matrix_items.difference(dirty_items) 
    568565 
    569566        try: 
     
    580577 
    581578                self.update_matrix(i) 
    582                 i2v = self.get_matrix_i2v(i).transform_point 
    583                 x0, y0 = i2v(bounds.x, bounds.y) 
    584                 x1, y1 = i2v(bounds.x1, bounds.y1) 
    585                 vbounds = Rectangle(x0, y0, x1=x1, y1=y1) 
    586                 self._qtree.add(i, vbounds, bounds) 
    587  
    588                 # TODO: find an elegant way to update parent bb's. 
    589                 #parent = self.canvas.get_parent(i) 
    590                 #if parent: 
    591                 #    try: 
    592                 #        parent_bounds = self._qtree.get_bounds(parent) 
    593                 #    except KeyError: 
    594                 #        pass # No bounds, do nothing 
    595                 #    else: 
    596                 #        if not vbounds in parent_bounds: 
    597                 #            self.set_item_bounding_box(parent, vbounds + parent_bounds) 
     579 
     580                if i not in dirty_items: 
     581                    # Only matrix has changed, so calculate new bb based 
     582                    # on quadtree data (= bb in item coordinates). 
     583                    i2v = self.get_matrix_i2v(i).transform_point 
     584                    x0, y0 = i2v(bounds.x, bounds.y) 
     585                    x1, y1 = i2v(bounds.x1, bounds.y1) 
     586                    vbounds = Rectangle(x0, y0, x1=x1, y1=y1) 
     587                    self._qtree.add(i, vbounds, bounds) 
     588 
     589                # Request bb recalculation for all 'really' dirty items 
    598590                self.queue_draw_item(i) 
    599591