adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bounds bug when moving artboards using extend script

canoztokmak opened this issue · comments

commented

Hey there,

Looks like there is very strange bug when moving artboard layers using extend script. Tried this on Photoshop CC 2015 and CC 2015.5.

Reproducing steps are listed below:
1- Retrieve document info, and output bounds value.
2- Displace it with a delta greater than 1024 pixels. (e.g. dx: 1024, dy: 0, or dx: 1024, dy: 1024)
3- Retrieve document info again, and output bounds value. It will be invalid.
4- Displace it back to its original position negating the delta used in previous step.
5- Retrieve document info again, and bounds value will show invalid values. (plus or minus 1024)

This behavior can be seen in the attached sample project.

Below are sample outputs I created using the sample project:

fetching documentInfo..
Initial bounds artboard {"top":0,"left":0,"bottom":1136,"right":640}
moving layer with delta {"dx":1024,"dy":1024}
fetching documentInfo again..
Intermediate bounds artboard {"top":0,"left":0,"bottom":1136,"right":640}
moving layer with delta {"dx":-1024,"dy":-1024}
fetching documentInfo again..
Final bounds artboard {"top":1024,"left":1024,"bottom":2160,"right":1664}

fetching documentInfo..
Initial bounds artboard {"top":0,"left":1,"bottom":1136,"right":641}
moving layer with delta {"dx":1024,"dy":1024}
fetching documentInfo again..
Intermediate bounds artboard {"top":0,"left":1,"bottom":1136,"right":641}
moving layer with delta {"dx":-1024,"dy":-1024}
fetching documentInfo again..
Final bounds artboard {"top":1024,"left":1,"bottom":2160,"right":641}

Initial bounds artboard {"top":1,"left":0,"bottom":1137,"right":640}
moving layer with delta {"dx":1024,"dy":1024}
fetching documentInfo again..
Intermediate bounds artboard {"top":1,"left":0,"bottom":1137,"right":640}
moving layer with delta {"dx":-1024,"dy":-1024}
fetching documentInfo again..
Final bounds artboard {"top":1,"left":1024,"bottom":1137,"right":1664}

Below is valid because the displaced artboard won't be beyond 1024 pixels. Initially, it was at (0,0).

fetching documentInfo..
Initial bounds artboard {"top":0,"left":0,"bottom":1136,"right":640}
moving layer with delta {"dx":1023,"dy":1023}
fetching documentInfo again..
Intermediate bounds artboard {"top":1023,"left":1023,"bottom":2159,"right":1663}
moving layer with delta {"dx":-1023,"dy":-1023}
fetching documentInfo again..
Final bounds artboard {"top":0,"left":0,"bottom":1136,"right":640}

But, if the it was initially at (1,1), displacing it (1023, 1023) will yield invalid output again. See intermediate bounds.

fetching documentInfo..
Initial bounds artboard {"top":1,"left":1,"bottom":1137,"right":641}
moving layer with delta {"dx":1023,"dy":1023}
fetching documentInfo again..
Intermediate bounds artboard {"top":0,"left":0,"bottom":1136,"right":640}
moving layer with delta {"dx":-1023,"dy":-1023}
fetching documentInfo again..
Final bounds artboard {"top":1,"left":1,"bottom":1137,"right":641}

sample.zip

commented

any plans or roadmap for this bug ?

I believe you're seeing the results of "auto-expand" with artboards. When artboards are moved past a tile boundary (probably 1024 in your case) the document bounds are changed to make all the tiles that contain any layers/artboards visible. In addition, if the art board is moved past 0,0 (where the position would otherwise became negative), all the layers are moved down and to the right, to keep the document coordinates positive and everything in the doc. The top left of the visible canvas in Photoshop is 0,0 and needs to remain so for compatibility with existing plugins/scripts that assume the document bounds are positive. In general, the doc bounds are allowed to change as art boards are moved around.

Closing as answered. @canoztokmak let me know if tim's comment was insufficient, or if you think there is something else going on.