Open alanyoungCN opened 2 years ago
Please cc, @rchiodo @IanMatthewHuff @ericsnowcurrently đź‘€
I found that there is an issue in 2020 talking about that, which says using AutoSizer has been outdated. https://github.com/chrvadala/react-svg-pan-zoom/issues/188
Then the author update the doc(https://github.com/chrvadala/react-svg-pan-zoom/blob/main/docs/autosizer-viewer.md) to tell how to use autosizer-viewer in a new way.
I have tried editing the svgViewer.tsx
, but failed due to my poor TypeScript.
Thanks for filing this issue, I've been unable to repro this issue at my end, however I can see the issue from the recording. thanks. Is it possible to save the image you have and upload that here, so we can use that to replicate this issue. thanks
@DonJayamanne I generate a normal distribution data for show. You can use the code to repro it.
import numpy as np
import matplotlib.pyplot as plt
data = np.random.normal(0, 1, (900, 1))
fig, ax = plt.subplots(1, 1)
fig.dpi = 500
fig.set_size_inches(20, 1)
ax.plot(data)
This code will plot the following figure:
which you can see in the vs code like this
Then you can expand the image and it looks like:
Then you zoom it with wheel to the righter part, e.g. 800 around:
At this time, when you start dragging, the bug happens:
I encountered the same issue, which can be reproduced with the code provided by the original poster. Is it possible to fix it in the future? Thanks! @DonJayamanne
Environment data:
Environment data
Expected behaviour
The expand image can zoom and drag smoothly.
Actual behaviour / Steps to reproduce:
After I draw a very wide but short image to show a time series and click the Expand Image button, the preview will get stuck when I enlarge it and drag from right to left. This is the full image and I can drag it well.
But when I enlarge the image, I can't see the right part anyway.
The screenshot above is the rightest I can drag.
However, the left blank becomes more.
I record a gif to show this issue.
the possible solution
I find that there is a \<autosizer> outside the \<ReactSVGPanZoom> in
svgViewer.tsx
(https://github.com/microsoft/vscode-jupyter/blob/main/src/datascience-ui/react-common/svgViewer.tsx), I think it's useless or at least the key, maybe we can remove it?