revery-ui / revery

:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
https://www.outrunlabs.com/revery/
MIT License
8.06k stars 196 forks source link

fix(hooks): Spring - bug when active is toggled #1012

Closed bryphe closed 3 years ago

bryphe commented 3 years ago

Issue: When the spring hook is used, and the enabled flag is toggled, there can be a 'bounce' when the enabled flag is set back to true.

Defect: The spring is only tracking positions when enabled - so if the position changes while the spring is disabled, the spring will bounce from the last position set while enabled, to the current position.

Fix: When the spring is disabled, always set the current position to the target.