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.

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. This won't happen if the artboard is not displaced less than 1024 pixel in a dimension.

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](https://github.com/adobe-photoshop/generator-core/files/387972/sample.zip)

commented

duplicate #360