Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Does DrawItem.drawGroup work properly?

    I'm struggling to draw a bunch of items as a whole simply setting their DrawItem.drawGroup property, then drawing the group. I know that passing them directly to DrawGroup.drawItems instead works.
    The docs say
    DrawItems are added to a DrawGroup by creating the DrawItems with DrawItem.drawGroup set to a drawGroup, or by creating a DrawGroup with DrawGroup.drawItems.
    Hence I'd expect the following snippet should suffice to draw a line, but unfortunately this is not the case
    Code:
    var mainPane = isc.DrawPane.create({
        autoDraw: false,
        showEdges: true,
        width: 200,
        height: 200
    });
    var group = isc.DrawGroup.create({
        autoDraw: false,
        drawPane: mainPane
    });
    isc.DrawLine.create({
        autoDraw: false,
        drawGroup: group,
        startPoint: [0, 200],
        endPoint: [200, 0]
    });
    isc.HStack.create({
        width: "100%",
        members: [mainPane]
    });
    group.draw();
    Instead if I adapt it to use the drawItems attribute it works like a charm
    Code:
    var mainPane = isc.DrawPane.create({
        autoDraw: false,
        showEdges: true,
        width: 200,
        height: 200
    });
    var item = isc.DrawLine.create({
        autoDraw: false,
        drawGroup: group,
        startPoint: [0, 200],
        endPoint: [200, 0]
    });
    var group = isc.DrawGroup.create({
        autoDraw: false,
        drawPane: mainPane,
        drawItems: [item]
    });
    isc.HStack.create({
        width: "100%",
        members: [mainPane]
    });
    group.draw();
    I guess I've missed some directive, but I cannot figure out which one... any idea?

    Reproduced on latest showcase (SC Version: 10.0p Built: 2014-
    12-09)

    #2
    Thanks for pointing this out - both approaches should in fact work identically, and will do so after tomorrow's builds of 9.1 and up.

    Comment

    Working...
    X