Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple viewers in different sizes trigger resize on all viewer #7

Closed
renkun-ken opened this issue May 29, 2020 · 3 comments
Closed

Comments

@renkun-ken
Copy link
Contributor

@renkun-ken renkun-ken commented May 29, 2020

If the web page is open on multiple places (e.g. one in web browser, the other in VSCode WebView), the resize of one viewer might cause all viewers to resize, or sometimes the viewer falls into resizing to different sizes endlessly.

I'm curious if there's a good way to handle multiple viewer while apparently the R session could only replay the plot (I'm not 100% sure if the resizing is implemented by replay?) for one certain size.

@nx10
Copy link
Owner

@nx10 nx10 commented May 29, 2020

Having multiple graphics views to compare plots sounds very exciting.
The server state is currently designed to be synchronized with both the state of the R graphics engine as well as the (JS) client. This means right now no two clients can display different resolutions or display different plots in the plot history. (Yes each resize requires a replay.)
I think the API can be made stateless so this can be solved on the client side. To be fully stateless this will however require the websockets implementation I am working on right now (to push server events). Then the plot history navigation just needs to be changed slightly.

@nx10
Copy link
Owner

@nx10 nx10 commented May 30, 2020

I have just pushed an changes that make the API stateless. Multiple clients can have different resolutions and show different plots of the history. The server now figures out by itself if it needs to redraw. This also made the API a lot simpler. (Websockets are not in yet, but will follow soon.)

Edit: Just fixed a race condition. Writing multithreaded code is hard.

@renkun-ken
Copy link
Contributor Author

@renkun-ken renkun-ken commented May 30, 2020

Thanks for the nice work! With the latest commit, the multi viewer works quite well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants