-
In the react component, the OnChange callback looks like it gives an initial location:
and then when scrolling, a series of offset in pixels:
Is there a way to get the actual new location after each change? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
we have an example here that does this with react and observer components (the "VisibleRegions" component "observes" the state of the view) https://jbrowse.org/storybook/lgv/v1.5.1/?path=/story/linear-view--visible-regions-example see https://github.com/GMOD/jbrowse-components/blob/607_stats_estimation_v2/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx#L366-L393 for how this demo is implemented you can also accomplish a similar thing with just onChange like this
this will console.log the currently visible region for every onChange callback |
Beta Was this translation helpful? Give feedback.
-
Both answers work for me. Thank you! |
Beta Was this translation helpful? Give feedback.
we have an example here that does this with react and observer components (the "VisibleRegions" component "observes" the state of the view)
https://jbrowse.org/storybook/lgv/v1.5.1/?path=/story/linear-view--visible-regions-example
see https://github.com/GMOD/jbrowse-components/blob/607_stats_estimation_v2/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx#L366-L393 for how this demo is implemented
you can also accomplish a similar thing with just onChange like this