Are layer.bounds rotated in rotated components …?

… when applying .copyDecomposedLayer()on the layer? It seems that the origin.x (for example) is at the top right when the layer has a rotated component. Is this on purpose? If so, what’s the best (easiest on CPU) method to re-rotate the bounding box? Checking for the component’s transform and negatively apply it? Low priority … just wondering :slight_smile:


I made a little Skedge sketch, but there it seems to be as normally expected, the origin x at bottom left. So I need to investigate what’s happening there in my plugin …

# Run in Skedge with a component glyph active:
from AppKit import NSRectFill, NSColor, NSRect

def badge(x, y, s):
	global NSRectFill, NSColor, NSRect
	rect = NSRect( (x-s/2, y-s/2), (s, s) )

bounds = layer.copyDecomposedLayer().bounds
badge(bounds.origin.x, bounds.origin.y, 50 )

Edit 2:
Solved. I had a .copy() in front of the .copyDecomposedLayer() (I wanted to be super sure) and that messed it up.

Phew, thanks for updating the text, I was panicking already.

1 Like

OMG, I’m so sorry! :open_mouth:

Are you decomposing to get to the bounding box?

Hmm, yes. Can I skip that step? :smiley: Now that you ask, I think I was stupid (again). Just wanted to make sure it includes any (nested) components, that’s the only reason I run that decomposing.

The bounds of the layer include all components already.

1 Like