Skip to content

Commit

Permalink
fix(ArtLayer,-LayerSet): adjusted linkedLayers property, fixed remove()
Browse files Browse the repository at this point in the history
changed remove to use built in method delete() instead of javascript eval for better target accuracy
  • Loading branch information
Investigamer authored and loonghao committed May 20, 2022
1 parent 04fe671 commit 11591ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions photoshop/api/_artlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def linkedLayers(self) -> list:
Returns:
list: Layer objects"""
return list(self.app.linkedLayers)
return [ArtLayer(layer) for layer in self.app.linkedLayers]

@property
def name(self) -> str:
Expand Down Expand Up @@ -459,8 +459,8 @@ def applyPinch(self, amount):
self.app.applyPinch(amount)

def remove(self):
layer = f'app.activeDocument.artLayers.getByName("{self.app.name}")'
self.eval_javascript(f"{layer}.remove()")
"""Removes this layer from the document."""
self.app.delete()

def rasterize(self, target: RasterizeType):
self.app.rasterize(target)
Expand Down
4 changes: 2 additions & 2 deletions photoshop/api/_layerSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def move(self, relativeObject, insertionLocation):
self.app.move(relativeObject, insertionLocation)

def remove(self):
layer = f'app.activeDocument.layerSets.getByName("{self.app.name}")'
self.eval_javascript(f"{layer}.remove()")
"""Remove this layer set from the document."""
self.app.delete()

def resize(self, horizontal=None, vertical=None, anchor: AnchorPosition = None):
self.app.resize(horizontal, vertical, anchor)
Expand Down

0 comments on commit 11591ce

Please sign in to comment.