Skip to content
Permalink
Browse files

Add convenince methods for centering a view in its superview

  • Loading branch information...
Koen Bok
Koen Bok committed Apr 27, 2013
1 parent 0acf5ea commit 18773c598cc2217dc8f78a728caf6bdd9d413cb5
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/views/view.coffee
@@ -98,6 +98,10 @@ class View extends Frame
frame.height = utils.max(_.pluck(@subViews, "maxY")) - frame.y

frame

centerX: -> @midX = @superView.width / 2.0 if @superView
centerY: -> @midY = @superView.height / 2.0 if @superView
center: -> @centerX(); @centerY()

#############################################################################
## Geometry

0 comments on commit 18773c5

Please sign in to comment.
You can’t perform that action at this time.