Created
February 20, 2021 01:18
-
-
Save MarshySwamp/a4a660574dcf3db9aa6213a5c09c5d9f to your computer and use it in GitHub Desktop.
Centre Active Layer on Canvas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Centre active layer on canvas | |
var doc = app.activeDocument; | |
var docLay = app.activeDocument.activeLayer; | |
docLay.translate(doc.width / 2 - (docLay.bounds[0] + docLay.bounds[2]) / 2, | |
doc.height / 2 - (docLay.bounds[1] + docLay.bounds[3]) / 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment