Last active
May 23, 2017 18:31
-
-
Save cacaodev/b2a27349c84601e9fd0d559fdaa2d589 to your computer and use it in GitHub Desktop.
kiwi Strength bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var priority = function(p) | |
{ | |
return kiwi.Strength.create(0, 1, 0, p); | |
}; | |
var kiwi = require("kiwi.js") | |
var solver = new kiwi.Solver(); | |
var width = new kiwi.Variable("width"); | |
var widthExp = new kiwi.Expression(width); | |
var antiCompression = new kiwi.Constraint(widthExp, kiwi.Operator.Ge, 100, priority(510)); | |
var holding = new kiwi.Constraint(widthExp, kiwi.Operator.Eq, 50, priority(10)); | |
solver.addConstraint(antiCompression); | |
solver.addConstraint(holding); | |
solver.addEditVariable(width, priority(501)); | |
solver.suggestValue(width, 90); | |
solver.updateVariables(); | |
width.value(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment