Copied layer does not return correct bounds

It seems GSLayer.copy() and .copyDecomposedLayer() both return (0,0),(0,0) when I ask for their bounds. Could this be fixed?

You need to set the parent. Otherwise components and corners can’t work.
For the decomposedLayer it could work but in general I think it is better to give no result than a potentially wrong one.

And why don’t you use the bounds from the original layer?

Ah ok, I’ll set the parent then (GSGlyph?).

I’m asking because I want to do stuff first and then take the bounds measurement. The stuff I do are free of components of any kind (I decompose first or know in advance that it only contains paths).

Set the copy.parent = layer.parent

2 Likes

You can use

layer.fastBounds()

That computes the bounds based on the node positions. That means you need proper extreme points to give correct results. But it doesn’t requires the parent.

1 Like