• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Resize PageItem height only

Contributor ,
Jun 07, 2016 Jun 07, 2016

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.

TOPICS
Scripting

Views

513

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jun 09, 2016 Jun 09, 2016

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

...

Votes

Translate

Translate
Guide ,
Jun 09, 2016 Jun 09, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 09, 2016 Jun 09, 2016

Copy link to clipboard

Copied

Great advice! Thanks Marc!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2016 Jun 11, 2016

Copy link to clipboard

Copied

LATEST

Hello McShaman,

also see this older thread here:

[AS/CC]Resizing a box and its contained image

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines