Open mirisb opened 1 week ago
@Vladimir-Kokin , maybe a solution would be to add a query to the controller to make sure that it is fully rendered.
In debugger I was able to display the overlay and see that it is not visible:
If the controller has a query function to make sure it is rendered, we could test it before trying to change the scale...
While mounting the component we fetch data from server which takes some. while the data is being fetched we first pass an empty log in the props:
Once fetching from server is complete the props are replaced with the real props that contain real logs from several wells.
We sync scales between different controllers in SLV using onContentRescale callback from the component (usually this function is only called when use flattening and want to apply our own logic for track positioning):
The problem occurs when sometimes when calling controller.setContentScale we get the correct scale however the zoom itself is calculated according to the size of the overlay, in function getContentBaseScale () in WellLogView.ts (in Webviz codebase). When this function is called, the overlay has not yet become visible, its size not yet calculated and it contains a bogus height which causes it to give wrong results which leads to calculation of wrong zoom.
This is easily recreated in Viz storybook by mounting story "Two Wells Same Log" and after it is mounted correctly switch to story "Two Wells Different Log". Since this bug depends on timing and fetching data from server, to recreate the storybook must be reloaded from scratch to clear caches.