Second level changes are not applied to objects [solved]

when writing to

  • selection.items[0].cornerRadii.topLeft | topRight | etc
  • selection.items[0].shadow.x | y | blur
  • selection.items[0].areaBox.width | height

the changes are not visible / do not have any effect.


it seems like the radii changes are reverted instantly, because

          selection.items[0].cornerRadii.topLeft *= 2;
          selection.items[0].setAllCornerRadii(selection.items[0].cornerRadii.topLeft * 2);

will multiply the radius by 4. therefore the change is done but will not persist, unless setAllCornerRadii is called


is this a bug or should the values be set in another way?

i found a working way:

var shadow = selection.items[0].shadow;
shadow.x = 2;
selection.items[0].shadow = shadow;

will apply the changes.
seems like there are no listeners for the second level in place. if this is intended behaviour, it should be mentioned in the api doc that second level changes have to be applied this way.

oh well, it actually exists:
https://adobexdplatform.com/plugin-docs/reference/core/properties-with-object-values.html

As you’ve discovered, this is intended behavior, and typical for JavaScript (where setting property values does not propagate a change notification to the parent).