Re:From SVG to Canvas – A new way of building interactions
by unemployable on Wednesday June 07, 2023 @02:36AM
(#36223602)
I am working on the same problems as these people. I have had to implement polygon merging and simplification, spatial indexes, adding and removing elements on demand, and so on. I chose SVG "because it is cool", which is how I make all of my engineering decisions. I have used canvas before and it isn't really that much faster for a lot of things.
Reading through the first part of the series of posts, I see a few issues. Firstly, React seems like a terrible idea. I imagine the staff were just familiar with it. I use straight JavaScript and DOM manipulation. Secondly, it mentions stuttering at certain times. There should be no stuttering because you can just offload to web workers. There will just be delays in painting things.
I think SVG is fast enough to get the job done. I mean, you can even just use it without all of the DOM elements and make everything a big path and then manually handle the events if you really want.
Anyway, converting between GPS, mercator, viewbox, etc really sucks!
Reading through the first part of the series of posts, I see a few issues. Firstly, React seems like a terrible idea. I imagine the staff were just familiar with it. I use straight JavaScript and DOM manipulation. Secondly, it mentions stuttering at certain times. There should be no stuttering because you can just offload to web workers. There will just be delays in painting things.
I think SVG is fast enough to get the job done. I mean, you can even just use it without all of the DOM elements and make everything a big path and then manually handle the events if you really want.
Anyway, converting between GPS, mercator, viewbox, etc really sucks!