Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Does DrawItem.drawGroup work properly?

$
0
0
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
Quote:

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)

Viewing all articles
Browse latest Browse all 4756

Trending Articles