Sha256: a7887825e6f5d314bd8ec6f6ef48e0231506f910d314c685c45d31ea8ac7098a

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

# @requires MotionKit::NSViewLayout
module MotionKit
  class NSViewLayout

    def constraints(view=nil, &block)
      view ||= target
      if view.is_a?(Symbol)
        view = self.get(view)
      end
      view.setTranslatesAutoresizingMaskIntoConstraints(false)

      constraints_target = ConstraintsTarget.new(view)
      deferred(constraints_target) do
        context(constraints_target, &block)
        constraints_target.apply_all_constraints(self, view)
      end
    end

  end

  class Layout

    def constraints(view=nil, &block)
      if @context
        apply(:constraints, view, &block)
      else
        context(self.view) do
          constraints(view, &block)
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-kit-0.10.8 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb