Module: PSD::Node::Locking

Included in:
Base
Defined in:
lib/psd/nodes/locking.rb

Overview

Locking is inherited by descendants, but Photoshop doesn’t reflect this directly in the file, so we have to recursively traverse the ancestry tree to make sure an ancestor isn’t locked.

Instance Method Summary collapse

Instance Method Details

#all_locked?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/psd/nodes/locking.rb', line 7

def all_locked?
  return true if layer.all_locked?
  return false if parent.root?
  return parent.all_locked?
end

#any_locked?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/psd/nodes/locking.rb', line 13

def any_locked?
  position_locked? || composite_locked? || transparency_locked?
end

#composite_locked?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/psd/nodes/locking.rb', line 23

def composite_locked?
  return true if layer.composite_locked?
  return false if parent.root?
  return parent.composite_locked?
end

#position_locked?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/psd/nodes/locking.rb', line 17

def position_locked?
  return true if layer.position_locked?
  return false if parent.root?
  return parent.position_locked?
end

#transparency_locked?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'lib/psd/nodes/locking.rb', line 29

def transparency_locked?
  return true if layer.transparency_locked?
  return false if parent.root?
  return parent.transparency_locked?
end