Skip to content

Instantly share code, notes, and snippets.

@sonburn
Last active September 21, 2017 17:46
Show Gist options
  • Select an option

  • Save sonburn/3040f0308c4cda0b2a7c66f63068cb0c to your computer and use it in GitHub Desktop.

Select an option

Save sonburn/3040f0308c4cda0b2a7c66f63068cb0c to your computer and use it in GitHub Desktop.
var selections = context.selection,
loop = selections.objectEnumerator(),
selection;
while (selection = loop.nextObject()) {
var rectangle = MSRectangleShape.new();
rectangle.frame().x = selection.frame().x();
rectangle.frame().y = selection.frame().y();
rectangle.frame().width = selection.frame().width();
rectangle.frame().height = selection.frame().height();
var rectangleGroup = MSShapeGroup.shapeWithPath(rectangle);
selection.parentForInsertingLayers().addLayers([rectangleGroup]);
selection.removeFromParent();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment