Revert "Remove draw_all
from drawing context"
This reverts commit 2d369f78 Signed-off-by: Dan Yeaw <dan@yeaw.me>
This commit is contained in:
parent
9c6e324add
commit
1f7a43aba3
@ -176,6 +176,7 @@ The view context passed to the Items draw() method has the following properties:
|
||||
- focused - True if the item has the focus
|
||||
- hovered - True if the mouse pointer if over the item. Only the top-most item is marked as hovered.
|
||||
- dropzone - The item is marked as the drop zone. When this happens then an item is dragged over the item, and if it is dropped, it will become a child of this item.
|
||||
- draw_all - True if everything drawable on the item should be drawn, for example, when calculating the bounding boxes of an item.
|
||||
|
||||
The View automatically calculates the bounding box for the item, based on the items drawn in the draw (context) function (this is only done when really necessary, e.g., after an update of the item). The bounding box is in viewport coordinates.
|
||||
|
||||
@ -401,6 +402,7 @@ DrawContext(
|
||||
focused=(item is view.focused_item),
|
||||
hovered=(item is view.hovered_item),
|
||||
dropzone=(item is view.dropzone_item),
|
||||
draw_all=self.draw_all,
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -209,6 +209,7 @@ Special context for drawing the item. It contains a cairo context and properties
|
||||
focused=(item is view.focused_item),
|
||||
hovered=(item is view.hovered_item),
|
||||
dropzone=(item is view.dropzone_item),
|
||||
draw_all=self.draw_all,
|
||||
)
|
||||
|
||||
Class: ``gaphas.painter.ItemPainter``
|
||||
|
@ -187,6 +187,8 @@ class Item:
|
||||
- view: the view that is to be rendered to
|
||||
- selected, focused, hovered, dropzone: view state of items
|
||||
(True/False)
|
||||
- draw_all: a request to draw everything, for bounding box
|
||||
calculations
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -86,6 +86,9 @@ class DrawContext(Context):
|
||||
|
||||
|
||||
class ItemPainter(Painter):
|
||||
|
||||
draw_all = False
|
||||
|
||||
def draw_item(self, item, cairo):
|
||||
view = self.view
|
||||
cairo.save()
|
||||
@ -102,6 +105,7 @@ class ItemPainter(Painter):
|
||||
focused=(item is view.focused_item),
|
||||
hovered=(item is view.hovered_item),
|
||||
dropzone=(item is view.dropzone_item),
|
||||
draw_all=self.draw_all,
|
||||
)
|
||||
)
|
||||
|
||||
@ -241,6 +245,8 @@ class BoundingBoxPainter(Painter):
|
||||
bounding boxes (in canvas coordinates) for the items.
|
||||
"""
|
||||
|
||||
draw_all = True
|
||||
|
||||
def __init__(self, item_painter=None, view=None):
|
||||
super().__init__(view)
|
||||
self.item_painter = item_painter or ItemPainter(view)
|
||||
|
Loading…
x
Reference in New Issue
Block a user