Rotating a clipping mask by javascript went wrong
- August 15, 2021
- 1 reply
- 797 views
I have noticed that rotating a clipping mask by javascript gives a different (wrong) result than rotating it by hand.
I have an artboard 100 x 100 px and three rectangles.
(A) Rectangle 3, top left, is partially outside the artboard.
(B) The clipping mask is the same size as the artboard 100 x 100 px.
(C) I choose the centre as the pivot point.
(D) I rotate the clipping mask by +90°.
The result is correct. The clipped square is then at the bottom left.
(E) I undo the last step and call my Javascript, which takes the first object (Clipping Mask) to rotate it +90° around the centre.
The result is wrong. The clipping mask is no longer in the centre of the artboard.
If I haven't done anything wrong, then I have found a bug that is only visible through Javascript:
var vDocRef = activeDocument;
vDocRef.pageItems[0].rotate(90, true, false, false, false, Transformation.CENTER);
