rcpch / digital-growth-charts-react-component-library

A typescript React library for displaying RCPCH Digital Growth Charts from API data
https://growth.rcpch.ac.uk
MIT License
7 stars 11 forks source link

Full screen toggle hides when gestation weeks is 40 #41

Closed snield1150 closed 1 year ago

snield1150 commented 1 year ago

This is likely related to my other issue #40 but it is a different problem.

When I enter a measurement with gestation weeks exactly 40 (regardless of days), and when I click the full screen toggle on the bottom left, the full screen button disappears. I can't then toggle back to 'zoom in'.

I have tested this on your Online Chart Demo but am unable to replicate it there.

By default we have set the 'enableExport' chart property to false, but as a test we set it to true, and interestingly the full screen button shows and works as expected. So this might explain why your demo works OK.

Looking at the code, this implies that the check on line 704 in CentileChart.tsx finds showToggle, allowZooming and enableExport all = false when the full screen button is clicked. The fullScreenPressed function is clearing out the storedChildMeasurements array which in turn could have an effect on the re-evaluation of allowZooming on line 119 in CentileChart.tsx.

eatyourpeas commented 1 year ago

Thanks again @snield1150 for picking this up. You are right that the conditional statement checking if plottable data exists to show the lifecourse view button was inappropriately nested within the enableExport clause. This meant that if the enableExport prop were set to false, the life course view button would not render. I have amended this and pushed a fix. Many thanks for your eagle eyes.

snield1150 commented 1 year ago

Thanks again @eatyourpeas All working well now. Our clinicians will be happy. 👍