Conversation
| "dependencies": { | ||
| "@aics/simularium-observables-manager": "^0.1.0", | ||
| "@aics/simularium-viewer": "^1.2.5", | ||
| "@aics/simularium-viewer": "file:../agentviz-viewer", |
There was a problem hiding this comment.
You probably don't want this to go to master, I'm guessing?
There was a problem hiding this comment.
It should already be updated.... try reloading.
|
So to understand the change, you are no longer trying to round the actual time to ns, except for display purposes. The onTimechange is now called with the raw slider value and it wasn't before. |
|
Well before I was more or less converting everything to micro seconds for the slider and then back again to set time. This is how the slider was set up in the example app |
| const handleTimeChange = (sliderValue: number | [number, number]): void => { | ||
| const time = convertSliderValueToNs(sliderValue as number); | ||
| onTimeChange(time); | ||
| onTimeChange(sliderValue as number); // slider can be a list of numbers, but we're just using a single value |
There was a problem hiding this comment.
I don't quite understand this comment; is it saying something about the behavior of the slider input element or something different?
There was a problem hiding this comment.
the type definition for sliderValue in the handleTimeChange function signature allows either number or array of 2 numbers, but onTimeChange only allows a number ?
Addressing : https://aicsjira.corp.alleninstitute.org/browse/AGENTVIZ-748
I didn't fully debug why it wasn't working before, but when I made the slider calculations simpler it worked.
I also formatted the playhead to have 3 digits and covert to units so it's not showing "2000k ns" for example.
Lastly, I changed the function call when you click on the slider, which was autoplaying instead of just going to the new time if the simulation is paused.
Future work: still need to do some deboucing probably to keep someone from just clicking all over the slider. Also, a loading state indicator would probably be good.
Pull request recommendations:
Thanks for contributing!