       return no
 
   drag:(event, delta)->
-
     {directionX, directionY, axis} = @dragState
-    {x, y} = delta
-
-    y    = -y if directionY is "bottom"
-    x    = -x if directionX is "right"
-    posY = @dragState[directionY] + y
-    posX = @dragState[directionX] + x
-
+    
+    {x, y}       = delta
+    dragPos      = @dragState.position
+    dragRelPos   = dragPos.relative
+    dragInitPos  = dragPos.initial
+    dragGlobPos  = dragPos.global
+    dragDir      = @dragState.direction
+    dragGlobDir  = dragDir.global
+    dragCurDir   = dragDir.current
+
+    if x > dragRelPos.x
+      dragCurDir.x  = 'right'
+    else if x < dragRelPos.x
+      dragCurDir.x  = 'left'
+
+    if y > dragRelPos.y
+      dragCurDir.y  = 'bottom'
+    else if y < dragRelPos.y
+      dragCurDir.y  = 'top'
+
+    dragGlobPos.x = dragInitPos.x + x
+    dragGlobPos.y = dragInitPos.y + y
+
+    dragGlobDir.x = if x > 0 then 'right'  else 'left'
+    dragGlobDir.y = if y > 0 then 'bottom' else 'top'
+
+    el = @$()
     if @dragIsAllowed
-      @$().css directionX, posX unless axis is 'y'
-      @$().css directionY, posY unless axis is 'x'
+      dragMeta   = @dragState.meta
+      targetPosX = if dragMeta.right  and not dragMeta.left then 'right'  else 'left'
+      targetPosY = if dragMeta.bottom and not dragMeta.top  then 'bottom' else 'top'
+
+      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'
+
+    dragRelPos.x = x
+    dragRelPos.y = y
 
     @emit "DragInAction", x, y
 

      if eventNames.test(eventName) and "function" is typeof cb
        @on eventName, cb

  setDraggable:(options = {})->

    options = {} if options is yes

    @dragState =
      containment : options.containment             # a parent KDView
      handle      : options.handle                  # a parent KDView or a child selector
      axis        : options.axis                    # a String 'x' or 'y' or 'diagonal'

    handle = if options.handle and options.handle instanceof KDView then handle else @

    handle.on "mousedown", (event)=>

    @setInstanceVariables options
    @defaultInit options,data

    @setClass 'kddraggable' if o.draggable

    if location.hostname is "localhost"
      @listenTo
        KDEventTypes        : "click"
