IjzerenHein / kiwi.js

Fast TypeScript implementation of the Cassowary constraint solving algorithm 🖖
Other
249 stars 24 forks source link

a few features of cassowary that cannot be found (at a glance) #17

Open fudgepop01 opened 5 years ago

fudgepop01 commented 5 years ago

As seen in this issue thread at the WebAssemblyStudio repo, one of the contributors was unable to find an equivalent to the following functions of cassorwary:

I was wondering if there exists replacements in the Kiwijs API that I'm not seeing. I'm personally looking for an equivalent to Cassowary.Equation(...).

Thanks!

mreinstein commented 5 years ago

@dar2355 Cassowary.Equation and Cassowary.Inequality provide equivalent functionality to Kiwi.Constraint.

As for stays, to be honest I'm not really sure what these are. Anyone else know?

cacaodev commented 5 years ago

In Cassowary, stay constraints force the variable they hold to "stick" to their value with a given weight. But 1/ I found them to be buggy and 2/ they can be easily replaced with the concept of "intrinsic content size" introduced by Cocoa Autolayout. For example, instead of having a stay constraint x = 2 {weight}, you can define two constraints x >= 2 {weight}and x<=2 {weight}.