Open DianaProbst opened 2 years ago
await layer2.translate(0, 50)
- the awaits were also in correctly in the main code in which I found this.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.
I have no idea how to escalate this from the docs to any other issue tracker - is that something you can do?
Yes. I could possibly fix it myself. But it can take a while before it goes into the public release of Photoshop.
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.
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.