4 ms·
Your website is fantastic! I love how minimal and fast loading it is. Could you please enlighten on how you manage to make an HTML page interactive (for e.g. on
by spectramax 7y ago
Your website is fantastic! I love how minimal and fast loading it is. Could you please enlighten on how you manage to make an HTML page interactive (for e.g. on vectorization page where I can move bezier curve handles)?
- okaleniuk 7y agoThanks! It's simple, all the interactive plots are HTML canvases with a set of event handler assigned to them. I trigger init ialization functions right after the elements declarations, and they assign all the events: https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535e2ea4d1dde84e16bf81bf15843e5a/pages/simple_image_vectorization.html#L555 https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535... Almost every event changes the state somewhere and triggers the redrawing function: https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535e2ea4d1dde84e16bf81bf15843e5a/pages/simple_image_vectorization.html#L582 https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535... And that's all. It's a bit messy since it involves keeping state outside the functions, and it also requires a little boilerplate but it's manageable. Maybe if I would have hundreds of plots per page, this would have been a problem but for a blog-post size pages this works fine.