9
9
10
10
DEFAULT_RENDER_DEPTH = 10
11
11
12
+
12
13
class BoundRendererArtist :
13
14
def __init__ (self , artist : Artist , renderer : RendererBase , clip_box : Bbox ):
14
15
self ._artist = artist
@@ -43,6 +44,10 @@ def draw(self, renderer: RendererBase):
43
44
self ._artist .set_clip_box (clip_box_orig )
44
45
45
46
47
+ class SharedRenderDepth :
48
+ current_depth = 0
49
+
50
+
46
51
def view_wrapper (axes_class : Type [Axes ]) -> Type [Axes ]:
47
52
"""
48
53
Construct a ViewAxes, which subclasses, or wraps a specific Axes subclass.
@@ -144,7 +149,6 @@ def _init_vars(
144
149
self .__image_interpolation = image_interpolation
145
150
self .__max_render_depth = render_depth
146
151
self .__filter_function = filter_function
147
- self ._render_depth = 0
148
152
self .__scale_lines = True
149
153
self .__renderer = None
150
154
@@ -182,9 +186,9 @@ def draw(self, renderer: RendererBase = None):
182
186
# It is possible to have two axes which are views of each other
183
187
# therefore we track the number of recursions and stop drawing
184
188
# at a certain depth
185
- if (self . _render_depth >= self .__max_render_depth ):
189
+ if (SharedRenderDepth . current_depth >= self .__max_render_depth ):
186
190
return
187
- self . _render_depth += 1
191
+ SharedRenderDepth . current_depth += 1
188
192
# Set the renderer, causing get_children to return the view's
189
193
# children also...
190
194
self .__renderer = renderer
@@ -193,7 +197,7 @@ def draw(self, renderer: RendererBase = None):
193
197
194
198
# Get rid of the renderer...
195
199
self .__renderer = None
196
- self . _render_depth -= 1
200
+ SharedRenderDepth . current_depth -= 1
197
201
198
202
def get_linescaling (self ) -> bool :
199
203
"""
0 commit comments