Skip to content

Commit

Permalink
resizable animation: allow giving 0 args
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Oct 27, 2023
1 parent f6eb526 commit 2826811
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resize_animation.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ func (r *ResizeAnimation[T]) KeyFramesCount() int {

// BuildNormal implements Animation.
func (r *ResizeAnimation[T]) BuildNormal(currentKeyFrame KeyFrame, _ StarterFunc) {
// This may happen if user forgot to pass size vectors. In this case just allow to build unchanged widget.
if int(currentKeyFrame) > len(r.sizes)-1 {
r.widget.Build()

return
}

r.trickCursorBefore(r.sizes[currentKeyFrame], imgui.Vec2{})

r.widget.Size(r.sizes[currentKeyFrame].X, r.sizes[currentKeyFrame].Y).Build()
Expand Down

0 comments on commit 2826811

Please sign in to comment.