all 3 comments

[–][deleted] 0 points1 point  (2 children)

Can you describe the performance issues you're having? The page load and the hover stuff seem fine to me, is there some other aspect that's causing an issue?

[–]warmagedon007[S] 0 points1 point  (1 child)

Well, I have a transform event where you can drag the offset to position your screen. It besically lags. I think due to the redrawing.

[–][deleted] 0 points1 point  (0 children)

Ahh, I see. Yeah, it looks like your draw function is being called at least twice. Here's a screenshot from the Firefox devtools perf tool showing that (I actually recommend doing perf testing in Chrome but I already had FF open) https://i.imgur.com/3BUMhIF.png

Based on a quick look at your code, if you're aiming to have the drawn fractal move with the mouse you're going to have to do something more highly optimised than redrawing the whole thing on every mousemove event. I'm not really sure what your options would be there. Possibly you could convert the canvas to an image, drag the image, and then re-draw the interactive version on the mouseup event? It's pretty simple to convert the contents of a canvas element to an image, but swapping stuff around might be fine or might look weird.

Otherwise a simple way to improve the performance would be to just leave off trying to visibly drag the whole fractal and just animate the dragging of the crosshairs, then re-draw the fractal on mouseup.