Sha256: 54aac99ea5ce70ef5311b931be0854b735b3a718878b95d7f49c63cc7a0b1e68

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

class PSD
  module Node
    # 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.
    module Locking
      def all_locked?
        return true if layer.all_locked?
        return false if parent.root?
        return parent.all_locked?
      end

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
psd-3.9.0 lib/psd/nodes/locking.rb
psd-3.8.0 lib/psd/nodes/locking.rb
psd-3.7.0 lib/psd/nodes/locking.rb
psd-3.6.0 lib/psd/nodes/locking.rb
psd-3.5.0 lib/psd/nodes/locking.rb