Question about effects of 'addConstraint' and 'endEdit'

65 views
Skip to first unread message

Matthew Trost

unread,
Jun 30, 2014, 3:30:54 PM6/30/14
to overcon...@googlegroups.com
Hello everyone! I'm new here, new to Cassowary.js, and new to programming with constraints in general. I'm wondering if someone here can help clarify a couple things for me.

Long story short, I'm having trouble understanding why the SimplexSolver seems to change variables at certain points in my code:
  - Why do my variables change when constraints are added to the solver? (As opposed to waiting for 'resolve()' to be called.)
  - Why do my edit variables revert to the value they had before being solved when I call 'endEdit'?

I'm not sure whether I'm misunderstanding something conceptually about Cassowary, or if I'm just confused about the correct usage of the library. Either way, I would appreciate some guidance.

I've put the simplest example of this behavior that I can muster into the following Gist:

Let me know if I can give any more details. Thanks for your help!

Matthew

Greg Badros

unread,
Jul 19, 2014, 12:11:48 AM7/19/14
to overcon...@googlegroups.com
Hi Matthew,

I don't think I saw a response, but the simple answer to the first question is that I think the Javascript implementation has Autosolve turned on by default, which is why addConstraint automatically re-solves rather than waiting for an explicit resolve() call.   Read the code, when in doubt.

Greg



--
You received this message because you are subscribed to the Google Groups "overconstrained" group.
To unsubscribe from this group and stop receiving emails from it, send an email to overconstrain...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Trost

unread,
Aug 25, 2014, 11:58:18 AM8/25/14
to overcon...@googlegroups.com, bad...@gmail.com
Hi Greg,

Thanks for your reply (and thanks for Cassowary!). Yes, it does appear that autosolve is on by default in the JavaScript implementation.

Matthew

Greg Badros

unread,
Aug 25, 2014, 3:02:34 PM8/25/14
to Matthew Trost, overcon...@googlegroups.com
Good luck!
Reply all
Reply to author
Forward
0 new messages