 c_shapes =
   rectangle:
     create: -> new Kinetic.Rect()
-    extra:  -> { x:0, y:0 }
+    b_attrs: ( attrs, B ) ->
+      attrs.width  = B[0]
+      attrs.height = B[1]
   circle:
     create: -> new Kinetic.Circle()
-    extra:  ( thingy ) ->
-      x: 0
-      y: 0
-      r: thingy.gets( 'width' ) / 2
+    extra: ( attrs ) ->
+      attrs.r = attrs.width / 2
+    b_attrs: ( attrs, B ) ->
+      r = Math.max( B[0], B[1] )
+
+      attrs.width  = 2*r
+      attrs.height = 2*r
+      attrs.r      = r
 
 Oghma.Thingy.Tableverse.register( ( thingyverse, O ) ->
 

      [ fill, stroke, width, height, opacity ] =
        @thingy().geta( 'fill', 'stroke', 'width', 'height', 'opacity' )
      attrs =
        fill:    fill
        stroke:  stroke
        opacity: opacity
        width:   width
        height:  height
      for k, v of c_shapes[shape].extra( @thingy() )
        attrs[k] = v
      @__k.setAttrs( attrs )

    remove: ( thingy ) ->

      )
  )

  for k, v of c_shapes
    do ( k, v ) ->
      calculate_attrs = ( attrs, B ) ->
        attrs =
          x:       0
          y:       0
          fill:    attrs.fill
          stroke:  attrs.stroke
          opacity: attrs.opacity
        v.b_attrs?( attrs, B )
        console.debug( attrs.width, attrs.height, B[0], B[1] )
        attrs

      create = ( name, group, attrs, A, B ) ->
        obj = v.create()
        group.add( obj )
        obj

      resize = ( obj, attrs, A, B ) ->
        obj.setAttrs( calculate_attrs( attrs, B ) )

      finish = ( name, attrs, A, B ) ->
        attrs = calculate_attrs( attrs, B )
        attrs.shape = k
        attrs.x = A[0]
        attrs.y = A[1]
        O.tableverse.create( 'shape', attrs )

      O.twopoint.define( k, create, resize, finish )
)
