membrane

https://github.com/phronmophobic/membrane
2021-03-05T14:27:41.084400Z

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

phronmophobic 2021-03-05T18:21:57.089800Z

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.

2021-03-05T18:50:36.092700Z

Oh that makes sense

phronmophobic 2021-03-05T18:50:45.092900Z

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.

phronmophobic 2021-03-05T18:51:49.094400Z

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

phronmophobic 2021-03-05T19:00:44.094600Z

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.

2021-03-05T21:06:14.094800Z

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?

phronmophobic 2021-03-05T21:09:59.095Z

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

phronmophobic 2021-03-05T21:11:04.095200Z

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

2021-03-05T21:14:47.095500Z

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

phronmophobic 2021-03-05T21:19:03.095900Z

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

phronmophobic 2021-03-05T21:19:55.096100Z

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

phronmophobic 2021-03-05T21:30:13.096300Z

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.

2021-03-05T21:34:24.096600Z

Cool, I'll watch it over the weekend!

phronmophobic 2021-03-05T21:35:19.096800Z

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

2021-03-05T21:39:43.097100Z

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