Fork me on GitHub
#membrane
<
2021-03-05
>
jjttjj14:03:41

Is there a reason rotate is private in membrane.ui? Is it just because it's not implemented yet on the backends?

phronmophobic18:03:57

Same issue with not being sure if negative origins work. There’s also a weird issue that if you rotate a box, it’s bounding box will warp. If you don’t keep track of the original bounding box, then rotating an object 45 degrees 8 times can cause the bounding box to grow large even though it should just return the object to it’s original orientation.

jjttjj18:03:36

Oh that makes sense

phronmophobic18:03:45

Membrane’s ui model is based on boxes (bounds and origin). One of the things that seems obvious in retrospect is that it would be better to base a model on 2D geometry.

phronmophobic18:03:49

I think it’s neat that just by using regular clojure, it would be possible to build a better model that supports the current one without breaking anything

phronmophobic19:03:44

One of the unfortunate parts of membrane is that it has a pretty huge surface area. Many of the pieces that compose membrane could be their own library. The consequence of all UIs being more or less built on top of GTK, UIKit, Swing, JavaFx, HTML is that it's really hard to find simple functional libraries that solve just one part of the problem.

jjttjj21:03:14

by "base a model on 2D geometry" do you mean that all the ui objects would have something like x/y/h/w instead of bounds/origin?

phronmophobic21:03:59

I haven't thought through all of the implications, but at the bottom, it would look a lot like just a math geometry library. Points, Paths, polygons, circles, etc. Width and height would be implemented, but you would also have access to bounding shape (rather than just bounding box), intersection, convexity, and a whole suite of geometric functions

phronmophobic21:03:04

Just like clojure.core provides a huge standard library that works with a bunch of abstract data types, you would have a model that provides a huge standard library that works with 2d geometries

jjttjj21:03:47

Gotcha. Have you used https://github.com/thi-ng/geom / https://github.com/Clojure2D/clojure2d / Quil ? They seem to have a similar approach but are much less (or not at all) platform agnostic

phronmophobic21:03:03

I've seen those libraries, but haven't used them except for a small amount of Quil.

phronmophobic21:03:55

I think something like thi-ng/geom looks the most promising

phronmophobic21:03:13

The way I think about it is that making a better UI model is an improvement, but not a game changer. Currently, my next goals are: • improve state management compatibility with data models like datascript, crux, datomic, etc. • write an Graphical UI editor that let's you build real UI components (not just prototypes) a la https://vimeo.com/66085662 Would love to hear what you think.

jjttjj21:03:24

Cool, I'll watch it over the weekend!

phronmophobic21:03:19

I would definitely recommend all of the Bret Victor talks: http://worrydream.com/ (see demos section).

jjttjj21:03:43

Yeah I've used all those graphics libraries to varying degrees. Mainly I just want an abstraction layer to switch backends easily. It takes too much to draw a thing that's just a few lines and circles on one platform then switch to a hugely different one, even though conceptually the visualizations are identical. I took a stab at a generic "data specification" for shapes/paints etc but wasn't really satisfied with it