Rich-Harris / pancake

Experimental charting library for Svelte
MIT License
1.29k stars 61 forks source link

Quadtree: find does not work because of width / height = 0 #26

Open olivierchatry opened 3 years ago

olivierchatry commented 3 years ago

Hello,

It seems like there is a bit of an issue whit Quadtree class trying to read width and height that it get from the Chart context. These values seems to be bound to clientWidth and clientHeight of the chart component, but for some reason are evaluating to 0.

Seems like this sample also have the same issue : https://svelte.dev/repl/3eaa39931e8045cf87da8b482e502c29?version=3.26.0

So when the mouse move, the cursor do not update.

It works on the main page, but not on the REPL

olivierchatry commented 3 years ago

So been debugging a bit, and it seems like the resize event only get trigger at the beggining, and the clientWidth at this moment is 0. I'm guessing it is because my points are empty when I start.

olivierchatry commented 3 years ago

Yep banco, if I add a if so that the component is only created when I actually have data, then the clientWidth and clientHeight is set correctly and quadtree is able to find data. Not sure if it can be considered as a bug.