Skip to content

Instantly share code, notes, and snippets.

@sonburn
Created April 3, 2018 15:04
Show Gist options
  • Save sonburn/d68688bdbbb96c2e648b6da6ed2afd50 to your computer and use it in GitHub Desktop.
Save sonburn/d68688bdbbb96c2e648b6da6ed2afd50 to your computer and use it in GitHub Desktop.
var layers = context.selection[0].children(),
layersLoop = layers.objectEnumerator(),
layer,
minX = 0,
maxX = 1000,
minY = 0,
maxY = 1000,
bounds = NSMakeRect(minX,minY,maxX,maxY);
// Deselect the container
context.selection[0].select_byExpandingSelection(false,false);
// Loop through the container children
while (layer = layersLoop.nextObject()) {
// If rectangles intersect…
if (CGRectIntersectsRect(bounds,layer.absoluteRect().rect())) {
// Select the layer
layer.select_byExpandingSelection(true,true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment