Properties panel and artboardRect values do not match

I am developing a plugin to resize an artboard based on reference point.

It generally works well, but with edits that result in negative X or Y coordinates, the values in the properties panel do not match the values of bounds, artboardRect, etc. obtained with batchPlay.

What is the rule for calculating the same numbers as in the properties panel?

Remarks:

  • It can be resized or moved correctly using the artboardRect that the plugin gets
  • I got rulerOriginH via batchPlay and it was 0 both before and after resizing. No change

Hmm how does it get negative? Is it outside of canvas?

In the case of this video, left is calculated by subtracting width from right. Canvas was automatically stretched by Photoshop.

I read the following points from those brief word.

  • It is strange for Photoshop to have negative coordinates
  • Canvas needs to be extended first

By extending the canvas myself, there was no need to calculate.

1 Like

Hmm, could happen that since batchPlay is low-level… it needs special care and additional step to be done with it.

1 Like

This is more difficult than I thought it would be; it seems necessary to capture the characteristic of Photoshop’s artboard feature.

  • When there is an artboard, the canvas size is basically controlled by Photoshop and cannot be freely changed by the user. If automatic canvas size is turned off, it can be changed manually

  • Photoshop allows negative values for artboard coordinates. (This can be typed in the properties panel, and is also generated by dragging)

  • When negative coordinates occur, Photoshop automatically stretches the canvas. How much it stretches is not known

  • When Photoshop automatically stretches the canvas, the properties panel remembers the origin. However, bounds, artboardRect, etc. forget, and the values are displayed differently

  • If you stretch the canvas by yourself and change the values of artboardRect accordingly and set them, the values will match

  • The artboard can be resized and translated by setting artboardRect

  • However, in the case of translate, the contents do not follow, so it is better to use Layer.translate

  • Layer.resize does not exist, and Layer.bounds is read only

1 Like

I would expect that size increments of canvas would match tile size in Photoshop performance preferences.

1 Like