Closed CreativeTechGuy closed 3 years ago
Also, I think there's some missing functionality also. In pixi
the ticker listener is called with this === Ticker
[ref] to allow the ticker handler function to access other properties of the ticker object (such as elapsedMS
, FPS
and more).
In the current implementation of useTick
[ref] the callback cannot access this
. I'd like to have access to that to match the functionality of Pixi.
Good point! We can add the ticker instance as the second argument as the hook will be often used with dash array function.
Feel free to create a PR, thanks!
Fixed in the new release https://github.com/inlet/react-pixi/releases/tag/v6.6.4
Thanks for contributing!
Oh dang you are fast. I didn't get a chance to reply. haha
I was going to ask why you wanted to pass a second argument instead of using .apply
but I see you did both! Wonderful. 😄
Description
The type for
useTick
as seen here indicates that the argument to the callback functiondelta
could possibly be undefined. Referencing the pixi source type TickerCallback it shows thatdt
is always present.I'd recommend using the type from pixijs to ensure that it's the same and doesn't diverge.
Steps to reproduce
Additional info
@inlet/react-pixi
version: 6.6.3React
version: 17.0.2ReactDOM
version: 17.0.2PIXI
version: 6.1.0