Copy link to clipboard
Copied
Just a quick one. I know how to resize a PageItem using the resize method when it takes an array of width and height...
pageItem.resize(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [10, 10]);
But how do I resize in one direction. I looked at the documentation but it is very confusing.
values: Data Type: Array of varies
The width and height values. Legal dimensions specifications: {x, y [, coordinate space]}, {x, resize constraint [, coordinate space]}, or {resize constraint, y [, coordinate space]}; where x and y are real numbers and coordinate space is used to determine _only_ the unit of length for x and y; coordinate space is ignored for the 'current dimensions times' resize method). Can accept: Array of Reals, ResizeConstraints enumerators or CoordinateSpaces enumerators.
Hi McShaman,
This should do the job:
pageItem.resize(
CoordinateSpaces.pasteboardCoordinates,
AnchorPoint.centerAnchor,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[ResizeConstraints.KEEP_CURRENT_VALUE, 10]
);
Note, however, that your code unusually involves the pasteboard space, meaning that you are resizing the pasteboard-driven bounding box. Make sure you really want this. (If your pageItem has a rotation applied relative to the pasteboard, for example, a rectangular shape wi
...Copy link to clipboard
Copied
Hi McShaman,
This should do the job:
pageItem.resize(
CoordinateSpaces.pasteboardCoordinates,
AnchorPoint.centerAnchor,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[ResizeConstraints.KEEP_CURRENT_VALUE, 10]
);
Note, however, that your code unusually involves the pasteboard space, meaning that you are resizing the pasteboard-driven bounding box. Make sure you really want this. (If your pageItem has a rotation applied relative to the pasteboard, for example, a rectangular shape will evolve to a parallelogram, etc.)
Usually, what you want is to resize the box in its own (inner) space, that is, CoordinateSpaces.innerCoordinates.
@
+Marc
Copy link to clipboard
Copied
Great advice! Thanks Marc!
Copy link to clipboard
Copied
Hello McShaman,
also see this older thread here:
[AS/CC]Resizing a box and its contained image
Regards,
Uwe