Some Text
This very simple demo demonstrates layouting constraints where the text content is resized to fill the container, but not below a certain font size. Use the halos to resize the white rectangle around "Some Text".
// changed at Tue Oct 13 2015 16:53:24 GMT+0200 (Central Europe Daylight Time) by timfelgen
treff
this.addScript(function addC() {
    
    solver = new ClSimplexSolver()
    wind = $morph("mahWindow")
    txt = $morph("txt")
    bbb.unconstrainAll(wind)
    bbb.unconstrainAll(txt)
    txt.disableEvents()
    txt.setPosition(pt(0,0))
    txt.setExtent(pt(800, 100))
    always: {
        solver: solver
        txt.contentArea().leqPt(wind.getExtent())
    }
    always: {
        solver: solver
        txt.getFontSize() >= 20
    }
    always: {
        priority: "medium"
        solver: solver
        txt.getFontSize() == wind.getExtent().y / 3
    }
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mahWindow
Tag:
run
save
Tests

-- ALL --
addC
Scripts
-
+
-
Connections
+
-- ALL --
all
ObjectEditor -- mahWindow>>addC
X

Menu