Fork me on GitHub
#hoplon
<
2020-06-18
>
George Ciobanu04:06:56

I'm looking to build a GUI editor using hoplon but haven't found a way to do real time stuff like resizing an item when the user drags a corner. Is it possible? Efficient? If yes could someone provide a tiny snippet of how to do it? Thank you so much! P.s. should I just not use cells and use an atom instead?

George Ciobanu13:06:31

And if I use an atom, how do I get a reference to the current element I'm calling a function from? Let's say (div :mousemove #(do something)) how do I get a handle on the div above to use it, and to update it's properties say when the user moves the cursor

jjttjj13:06:02

You can definitely do this in hoplon and using cells for the width would be idiomatic

George Ciobanu14:06:31

Thank you jjttjj

flyboarder15:06:33

@geo.ciobanu I would recommend reading through the wiki

flyboarder15:06:05

specifically attribute providers

George Ciobanu19:06:25

@flyboarder I made it work, thank you again! Any performance difference I need to be aware between atom and cell? Sometimes I only need an atom for tracking a value without needing to calculate based on it, so I'm trying to figure out which one it use. Apologies if this is a silly q!

dave19:06:23

it seems to me like the difference is that you can't hook atoms up to cells so if you want a cell to react to your X, your X needs be a cell, not an atom

dave19:06:48

in practice, i just use cells all the time when i'm working in a hoplon application

dave19:06:58

you can certainly use a cell like an atom, but not vice versa

jjttjj20:06:53

@geo.ciobanu cells have a built in graph mechanism allowing you to wire them together and do fancy things that way, mainly having one cell's value be automatically derived from another (and you can chain multiple together). See: https://github.com/hoplon/javelin Atoms don't come with this ability out of the box Importantly, hoplon is specifically designed to work with cells and not atoms so, of x is a cell, in hoplon you can do (div x) and the div's content will update when x changes. But the functionality doesn't work with atoms.

George Ciobanu20:06:24

Thank you so much @dave and @jjttjj

👍 3