lrstanley / bubblezone

helper utility for BubbleTea, allowing easy mouse event tracking
https://pkg.go.dev/github.com/lrstanley/bubblezone
MIT License
537 stars 17 forks source link

Add AnyInBoundsAndUpdate #15

Closed ThisGuyCodes closed 4 months ago

ThisGuyCodes commented 1 year ago

๐Ÿš€ Changes proposed by this PR

AnyInBounds discards the results of Update(). This makes it useless for value-based models, and doesn't let us use it to trigger tea.Cmds.

This PR adds AnyInBoundsAndUpdate (I'm not tied to the name); which doesn't discard the results of Update(), instead carrying updates to the model through the events, and returning the final tea.Model and resulting tea.Cmds.

I also refactored a bit to share the logic between these two functions, and changed said factored-out code to reduce allocations a bit.

๐Ÿงฐ Type of change

๐Ÿค Requirements