Skip to content

Commit

Permalink
fix: restrict the range of index
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Nov 16, 2023
1 parent 98ce47c commit ae5e110
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions katrain/gui/badukpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ def draw_hover_contents(self, *_args):
animating_pv = self.animating_pv
if animating_pv:
pv, node, start_time, _ = animating_pv
up_to_move = self.get_animate_pv_index()
up_to_move = min( len(pv), self.get_animate_pv_index())
self.draw_pv(pv, node, up_to_move)

if getattr(self.katrain.game, "region_of_interest", None):
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def get_animate_pv_index(self):
if self.animating_pv:
pv, node, start_time, _ = self.animating_pv
delay = self.katrain.config("general/anim_pv_time", 0.5)
return (time.time() - start_time) / max(delay, 0.1)
return min(len(pv), (time.time() - start_time) / max(delay, 0.1))
else:
return 0

Expand Down

0 comments on commit ae5e110

Please sign in to comment.