Closed kushalkolar closed 1 year ago
Interesting ... 😕
The latest changes did change some stuff related to the sizing, so with a bit of luck this is now fixed ... ?
This still happens but I think I figured out some more details, it's occurs when dragging the canvas resize handlers causes the browser to scroll the page very quickly, this then leads to the canvas being elongated to a very large size. If the browser scrolls very fast it can be difficult to stop this. Browsers can sometimes scroll much faster than shown in the example video below, I think the scroll rate is higher if the webpage page is longer.
Maybe a workaround is to set a max_size
for the canvas dims?
https://user-images.githubusercontent.com/9403332/223005069-667c1e91-eac7-49ac-a54f-60dfb7e4e4f1.mp4
Aha, that makes sense!
Maybe a workaround is to set a max_size for the canvas dims?
That could help. I think it's also worth looking into a solution to disable the browser's autoscrolling behavior. E.g. some ideas here. Will try to find some time this week to look into it.
I tried, but I have not yet been able to reproduce this. I tried to mimic your example by putting a simple canvas inside an hbox and vbox, but no luck yet.
Would it be possible to provide a minimal example for which the effect happens on your machine? E.g. does it also happen with the hello world example of jupyter_rfb? Does it only happen when embedded in ipywidgets? Or does it only happen with a fastplotlib Plot?
I just tried playing with this more:
import pygfx
import numpy
from wgpu.gui.auto import WgpuCanvas
canvas = WgpuCanvas()
renderer = pygfx.WgpuRenderer(canvas)
a = numpy.random.rand(512, 512).astype(numpy.float32)
tex = pygfx.Texture(a, dim=2).get_view()
geo = pygfx.Geometry(grid=tex)
mat = pygfx.ImageBasicMaterial(clim=(0, 1))
img = pygfx.Image(geo, mat)
cam = pygfx.OrthographicCamera(512, 512)
cam.position.set(256, 256, 1)
scene = pygfx.Scene()
scene.add(img)
canvas.request_draw(lambda: renderer.render(scene, cam))
canvas
Still can't replicate it, but this should do the trick: #70.
This is a bizarre issue that seems to happen if the widget is left unattended for a long period of time (~30+ minutes?) . If you then try to resize it after this long unattended period it elongates vertically downward extremely fast, as if I suddenly increased my mouse cursor speed by an order of magnitude. The kernel then crashes.
I'll try to reproduce and provide more info soon.