       @dragIsAllowed = yes
       @setEmptyDragState()
 
-      dragState             = @dragState
+      dragState = @dragState
+
+      if options.containment
+        dragState.containment = {}
+        {view} = options.containment
+        if 'string' is typeof view
+          dragState.containment.viewBounds = @[view].getBounds()
+        dragState.containment.viewBounds or= @parent.getBounds()
+        dragState.containment.padding = \
+          options.containment.padding or x: 0, y: 0
 
       # TODO: should move these lines
-      dragState.containment = options.containment
       dragState.handle      = options.handle
       dragState.axis        = options.axis
 


      newX = if targetPosX is 'left' then dragMeta.left + dragRelPos.x else dragMeta.right  - dragRelPos.x
      newY = if targetPosY is 'top'  then dragMeta.top  + dragRelPos.y else dragMeta.bottom - dragRelPos.y

      el.css targetPosX, newX unless axis is 'y'
      el.css targetPosY, newY unless axis is 'x'


  drag:(event, delta)->

    {directionX, directionY, axis, containment} = @dragState

    {x, y}       = delta
    dragPos      = @dragState.position
