Skip to content

Commit

Permalink
animation functions are now called before render
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalkolar committed Dec 20, 2022
1 parent 771a665 commit e671cab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions fastplotlib/layouts/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def set_viewport_rect(self, *args):
self.viewport.rect = self.get_rect()

def render(self):
# does not flush
self.controller.update_camera(self.camera)
self.viewport.render(self.scene, self.camera)

Expand Down
6 changes: 3 additions & 3 deletions fastplotlib/layouts/_gridplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def __getitem__(self, index: Union[Tuple[int, int], str]):
return self._subplots[index[0], index[1]]

def render(self):
for subplot in self:
subplot.render()

for f in self._animate_funcs:
f()

for subplot in self:
subplot.render()

self.renderer.flush()
self.canvas.request_draw()

Expand Down
4 changes: 2 additions & 2 deletions fastplotlib/layouts/_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def get_rect(self):
return rect

def render(self):
super(Subplot, self).render()

for f in self._animate_funcs:
f()

super(Subplot, self).render()

def add_animations(self, *funcs: callable):
if not all([callable(f) for f in funcs]):
raise TypeError(
Expand Down

0 comments on commit e671cab

Please sign in to comment.