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.
After 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]);
}
© 2022 - 2024 — McMap. All rights reserved.