-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
[WGLMakie] Add automatic figure resizing #3042
Conversation
834644c
to
7bba78e
Compare
NOTE: I've run |
This implements basic resizing support for WGLMakie figures. This has primarily been tested in the VSCode plot pane and the JSServe auto-launched browser window (using Chrome and Safari). The implementation creates a new `resize` event that the javascript frontend can send back to the Julia backend, with a computed size (in pixels) that the backend should resize to. Additionally, the javascript `throttle()` function is altered to no longer drop the last few events when throttled, it instead delays the last event until the end of the throttling period, which is important when resizing quickly so that the final size is faithfully recorded.
4ec4576
to
fb0fe78
Compare
Cool! :) Will need to test this, to make sure it doesn't behave weirdly on pluto etc...
I think is bound to happen when checking in something automatically generated. Ideally, the bundles would be artifacts, I think @fonsp did something like that. |
I tried to make this work everywhere, but the layout changes too much between JSServe, Pluto, VSCode, etc.... so just special-case when we're inside of VSCode as I think that's the most egregious example
@SimonDanisch as an alternative to #3044, what do you think of this latest commit; it simplifies things somewhat by forcing all elements between the |
Hm, I think I'd rather have more complicated height/width calculation then having to mess with css/html that we don't own (and relying on finding the VSCode div). |
What axis type is this? |
LScene: https://github.com/SunnySuite/Sunny.jl/blob/main/src/Plotting.jl#L5 |
What happens if you do the same with GLMakie? I thought LScene shouldn't change the aspect ratio. |
If I try with GLMakie then the aspect ratio is preserved. (But the image inside VSCode is static, i.e. not interactive) |
Merged in #3044 |
Description
This implements basic resizing support for WGLMakie figures. This has primarily been tested in the VSCode plot pane and the JSServe auto-launched browser window (using Chrome and Safari).
The implementation creates a new
resize
event that the javascript frontend can send back to the Julia backend, with a computed size (in pixels) that the backend should resize to. Additionally, the javascriptthrottle()
function is altered to no longer drop the last few events when throttled, it instead delays the last event until the end of the throttling period, which is important when resizing quickly so that the final size is faithfully recorded.Fixes #1318
Type of change
Checklist