Convert Image and Video annotators to TypeScript#483
Conversation
I know this is still a draft but I was curious. By looking at it I guess if you had a decent framerate image sequence with large images and a slow network you would get a bit of loading->frame->loading->frame stuttering. This is easier to update now that the onload is in one location, you're triggering loadingVideo when a frame is missing and there isn't a difference between cache loading a frame and immediately loading a frame for displaying. Before there was a difference between a frame seek load and a cache loading of a frame. In the cache loading This logic could be moved to the universal I also concede that there is probably a better way to do this that you may discover or already have in mind. |
|
@BryonLewis I've addressed your comments with a new checkCache function. I've fixed several annoying bugs with the old version and enabled the loading spinner for all loading conditions. Please let me know what you think. |
BryonLewis
left a comment
There was a problem hiding this comment.
I'm not completely done yet, but wanted to just put up a few initial comments. This is much cleaner and the behavior is a lot easier to understand than the previous mess of onloads of differening types.
Most of my comments aren't anything in this version but things I've now notice with more scrutiny. Feel free to suggest we push them to another PR.
I'll do some more indepth reviewing tomorrow morning.
BryonLewis
left a comment
There was a problem hiding this comment.
Looks really great. I think this should help greatly with those large image single detection projects. Now hitting right on the keyboard multiple times won't queue up the loading and should make it so the final image loads quicker.
One very minor thing that I can add as an issue or into another PR is the z-index of the spinner. Each geoJS map layer increments the z-index of the base container and right now the loading spinner is below the text layer.

* WIP * Finish up conversion * Modify docs and comments * More robust image playback * CheckCache * cache improvements * Address comments Co-authored-by: Bryon Lews <Bryon.Lewis@kitware.com> Co-authored-by: BryonLewis <61746913+BryonLewis@users.noreply.github.com>
* WIP * Finish up conversion * Modify docs and comments * More robust image playback * CheckCache * cache improvements * Address comments Co-authored-by: Bryon Lews <Bryon.Lewis@kitware.com> Co-authored-by: BryonLewis <61746913+BryonLewis@users.noreply.github.com>
The last major remaining typescript conversion.
Notes to my reviewer
As usual, typescript/composition-api conversion is an exercise in topological sort. This part was particularly tricky. There were some function dependency cycles, and a lot of back-and-fourth between component and mixin.
useMediaController.ts: function initialize()for how I had to solve a dependency issueImageDataItemInternalstructure inImageAnnotator. As mentioned before, we need to hold a reference to both the image and the onload promise. Conversion to promises did indeed make the code easier for me to understand. There's now only a single place in the code whereimg.onload =is used.fixes #474
fixes #480