admin管理员组文章数量:1321261
I have an active ArtLayer
referenced by the variable NewLayer
that I want to move to the absolute position x,y in the canvas.
I have been googling for a couple of hours now without any results. Can some one please give an example?
// Thanks.
I have an active ArtLayer
referenced by the variable NewLayer
that I want to move to the absolute position x,y in the canvas.
I have been googling for a couple of hours now without any results. Can some one please give an example?
// Thanks.
Share Improve this question asked Aug 21, 2012 at 22:32 Max KiellandMax Kielland 5,8419 gold badges62 silver badges100 bronze badges1 Answer
Reset to default 29After some more API reading and searching I came to the conclusion that it is only possible to move a layer with delta move.
I wrote this little function to position a layer at an absolute position. Hope this is helpful to the next reader with the same question...
//******************************************
// MOVE LAYER TO
// Author: Max Kielland
//
// Moves layer fLayer to the absolute
// position fX,fY. The unit of fX and fY are
// the same as the ruler setting.
function MoveLayerTo(fLayer,fX,fY) {
var Position = fLayer.bounds;
Position[0] = fX - Position[0];
Position[1] = fY - Position[1];
fLayer.translate(-Position[0],-Position[1]);
}
本文标签: javascriptPhotoshop scripting Move an image to position xyStack Overflow
版权声明:本文标题:javascript - Photoshop scripting: Move an image to position x,y - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738369561a2082235.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论