AdobeDocs / uxp-photoshop

Documentation for UXP Plugin API - Adobe Photoshop 2022 - apiVersion 2
https://developer.adobe.com/photoshop/uxp/2022/
Apache License 2.0
92 stars 93 forks source link

layer.translate works on the active layer, not the layer that calls it #316

Open DianaProbst opened 2 years ago

DianaProbst commented 2 years ago

Issue in /src/pages/ps_reference/classes/layer.md

https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/layer/#translate does not work as advertised. I select layers, attempt to translate them, and have the active layer translated instead of whichever layer I have chosen. You can demonstrate this in the console by copying the background twice, then:

layer1 = app.activeDocument.layers.getByName("Background copy") layer2 = app.activeDocument.layers.getByName("Background copy 2")

select one of the layers in Photoshop.

I created: async function test() { var layer2 = await app.activeDocument.layers.getByName("Background copy") layer2.translate(0, 50) }

and in the console ran: await window.require("photoshop").core.executeAsModal(test)

and the result was that the active layer I had clicked on was translated, no matter which one that was, despite layer2 being the one that was calling the translation.

DianaProbst commented 2 years ago
jardicc commented 2 years ago

Thanks for the report. I think this should be fixed to make it work as expected. It will likely apply to the other kinds of transformations too.

DianaProbst commented 2 years ago

I have no idea how to escalate this from the docs to any other issue tracker - is that something you can do?

jardicc commented 2 years ago

Yes. I could possibly fix it myself. But it can take a while before it goes into the public release of Photoshop.

DianaProbst commented 2 years ago

thumbsup

Thanks for the warning. I've got a current workaround, I think, where I can copy my layers into a new document, and work on those as I go, so I never let go of them until I no longer need them.