Sha256: 9cb8b37dd76218b53085f9864c91817037566d99e18f556457dbaa8a781fa462

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 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 target
        apply(:constraints, view, &block)
      else
        context(self.view) do
          constraints(view, &block)
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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