   # pattern corresponding to each cardinal
   # pattern: [left,top,width,height]
   coefs:
-    n:  [0, 1,  0, -1]
-    s:  [0, 0,  0,  1]
-    e:  [0, 0,  1,  0]
-    w:  [1, 0, -1,  0]
-    nw: [1, 1, -1, -1]
-    ne: [0, 1,  1, -1]
-    se: [0, 0,  1,  1]
-    sw: [1, 0, -1,  1]
+    n : [ 0,  1,  0, -1]
+    s : [ 0,  0,  0,  1]
+    e : [ 0,  0,  1,  0]
+    w : [ 1,  0, -1,  0]
+    nw : [ 1,  1, -1, -1]
+    ne : [ 0,  1,  1, -1]
+    se : [ 0,  0,  1,  1]
+    sw : [ 1,  0, -1,  1]
 
   resize: (event)=>
-    bounds = @_state.bounds
     coef = @_state.coef
+
     vector =
       x: event.pageX - @_state.origin.x
       y: event.pageY - @_state.origin.y
 
-    #console.log("pointer vector norm")
-    #console.log(V.norm(vector))
-
     localVector =
       x: vector.x * Math.cos(@beta) + vector.y * Math.sin(@beta)
       y: -vector.x * Math.sin(@beta) + vector.y * Math.cos(@beta)
 
-    #console.log("local vector norm")
-    #console.log(V.norm(localVector))
-
-    #console.log(V.norm(vector) - V.norm(localVector) < 0.00001)
-    #console.log("i",V.signedDir(localVector, 'x'))
-    #console.log("j",V.signedDir(localVector, 'y'))
-
-    console.log(localVector)
-
-    style =
-      left :  coef[0] * localVector.x + @_state.elPosition.left
-      top :   coef[1] * localVector.y + @_state.elPosition.top
-      width:  coef[2] * localVector.x + @_state.elDimension.width
-      height: coef[3] * localVector.y + @_state.elDimension.height
+    # new dimensions of the el
+    dim =
+      w: coef[2] * localVector.x + @_state.elDimension.width
+      h: coef[3] * localVector.y + @_state.elDimension.height
+
+    bounds = @_state.sizeBounds
+    # constrain is a couple of boolean that decide if we need to
+    # change the top and left style
+    constrain =
+      x: 1
+      y: 1
+    if dim.w < bounds.wMin
+      dim.w = bounds.wMin
+      constrain.x = 0
+    else if dim.w > bounds.wMax
+      dim.w = bounds.wMax
+      constrain.x = 0
+    if dim.h < bounds.hMin
+      dim.h = bounds.hMin
+      constrain.y = 0
+    else if dim.h > bounds.hMax
+      dim.h = bounds.hMax
+      constrain.y = 0
+
+    # vector on which we need to project
+    #  x: coef[0]
+    #  y: coef[1]
+    #  so our local vector projected on proj is
+    mB1 =
+      x: localVector.x * coef[0]
+      y: localVector.y * coef[1]
+
+    #translated in the base of the screen, it gives us
+    mB0 =
+      x: Math.cos(@beta) * mB1.x - Math.sin(@beta) * mB1.y
+      y: Math.sin(@beta) * mB1.x + Math.cos(@beta) * mB1.y
+
+    mB0.x *= constrain.x
+    mB0.y *= constrain.y
+
+    style = {}
+    if constrain.x
+      style.left  =  (mB0.x + @_state.elPosition.left)
+      style.width =  dim.w
+    if constrain.y
+      style.top =    (mB0.y + @_state.elPosition.top)
+      style.height = dim.h
 
     @$el.css(style)
     @trigger 'change:resize', style

      # the initial position of @el
    @_state.elPosition = @$el.position()
    @_state.elOffset = @$el.offset()
    @_state.bounds =
        ox: (box.width - w) / 2
        oy: (box.height - h) / 2
        x: @options.workspace.width() - (box.width / 2 + w / 2)
        y: @options.workspace.height() - (box.height / 2 + h / 2)
    @_state.elDimension =
      width: w
      height: h

      top: vector.y + @_state.elPosition.top

    ###
    bounds = @_state.positionBounds
    if pos.left < bounds.ox
      pos.left = bounds.ox
    else if pos.left > bounds.x
