Why group still gets drawn after setting scale to 0?

co.Grouper.Scale = 0
g.DrawObject(co.Grouper, co.Grouper.X, co.Grouper.Y)

If the scale is 0 then why can I still see the group items?

Thanks

0 is ignored

So what could I use instead? Negative values?

Thanks

dont draw groups whose scale is 0 in your code

Then how do I get the group to disappear efficiently?

Thanks

As Norman mentioned - In your draw routine test for zero scale and do not draw any groups that test true for zero scale

And the question is how do I NOT draw any particular groups within a group? Ignore what has been said about scale because I used it to try and simulate the behavior of removing the group.

Thanks

I think they’re imagining a single level/array of Group2Ds, which is easy to loop over and skip the 0 scale ones. But I also think you’re using multi-level trees of Group2Ds so you’d have to walk the whole tree and only draw terminal Group2Ds and their siblings. Or if your trees have a known structure, I mean like they’re managed by a class, you can add draw routines that know what to test.

You have to remove the group. If you draw from the top the whole tree is drawn, so you’d have to draw all the nodes individually. There’s many ways to automate/optimize this, but I think actually removing the group will be easiest. Is that not working?

Should I write my own class to manage it then?

Thanks

Maybe, depends what you’re doing.

I’ve been experimenting with Object2D scales and found you can set them to 0.0, or even negative values. StringShape draws at a scale of ~0.135 (factored with the TextSize) when the real value is less than about 0.001, PixMapShapes aren’t drawn with negative scales, ArcShapes draw reflected with a negative scale, Rect, RoundRect and OvalShapes work too but negative scales make no drawn difference.

So the shapes behave differently with small or negative scales but you CAN set those scale values and get them back from the object. The exception is Group2D which filters out setting values <= 0.0.

dim r As new RectShape
MsgBox Format(r.Scale, "-0.0")  //1.0
r.Scale = 0.2
MsgBox Format(r.Scale, "-0.0")  //0.2
r.Scale = 0.0
MsgBox Format(r.Scale, "-0.0")  //0.0
r.Scale = -0.1
MsgBox Format(r.Scale, "-0.0")  //-0.1

dim g As new Group2D
MsgBox Format(g.Scale, "-0.0")  //1.0
g.Scale = 0.2
MsgBox Format(g.Scale, "-0.0")  //0.2
g.Scale = 0.0  //no change
MsgBox Format(g.Scale, "-0.0")  //0.2
g.Scale = -0.1 //no change
MsgBox Format(g.Scale, "-0.0")  //0.2

Instead of 0.0 you can set the Group2Ds scale very very small, like 0.000000001, then it’s probably smaller than a pixel and effectively not drawn. This won’t work if you have nested StringShapes because they’ll pop back to that ~0.135 scale.

Removing the group does directly what you want, seems that’d be less headache. Also, making your own vector classes, while more research and learning up front, may have a big payoff. I’ve toyed with this idea and other than String and PixMap shapes it looks to be just some affine transforms, draw lines and poly fills.

[quote=177993:@Will Shank]Maybe, depends what you’re doing.

I’ve been experimenting with Object2D scales and found you can set them to 0.0, or even negative values. StringShape draws at a scale of ~0.135 (factored with the TextSize) when the real value is less than about 0.001, PixMapShapes aren’t drawn with negative scales, ArcShapes draw reflected with a negative scale, Rect, RoundRect and OvalShapes work too but negative scales make no drawn difference.

So the shapes behave differently with small or negative scales but you CAN set those scale values and get them back from the object. The exception is Group2D which filters out setting values <= 0.0.

dim r As new RectShape
MsgBox Format(r.Scale, "-0.0")  //1.0
r.Scale = 0.2
MsgBox Format(r.Scale, "-0.0")  //0.2
r.Scale = 0.0
MsgBox Format(r.Scale, "-0.0")  //0.0
r.Scale = -0.1
MsgBox Format(r.Scale, "-0.0")  //-0.1

dim g As new Group2D
MsgBox Format(g.Scale, "-0.0")  //1.0
g.Scale = 0.2
MsgBox Format(g.Scale, "-0.0")  //0.2
g.Scale = 0.0  //no change
MsgBox Format(g.Scale, "-0.0")  //0.2
g.Scale = -0.1 //no change
MsgBox Format(g.Scale, "-0.0")  //0.2

Instead of 0.0 you can set the Group2Ds scale very very small, like 0.000000001, then it’s probably smaller than a pixel and effectively not drawn. This won’t work if you have nested StringShapes because they’ll pop back to that ~0.135 scale.

Removing the group does directly what you want, seems that’d be less headache. Also, making your own vector classes, while more research and learning up front, may have a big payoff. I’ve toyed with this idea and other than String and PixMap shapes it looks to be just some affine transforms, draw lines and poly fills.[/quote]
I will have to write my own. When I get round to it. I definitely don’t want to make a really small scale to simulate a scale of 0. Seems inefficient.

Thanks