Draw.rect = function(x, y, w, h, tl, tr, br, bl) {
  var realX = x, 
      realY = y,
      realW = w, 
      realH = h;
  
  switch(Draw.currentRectMode) {
    case CORNERS: realW = w - x;
                  realH = h - y; break;
    case RADIUS: realX = x + w/2;
                 realY = y + h/2;
                 realW = w * 2;
                 realH = h * 2; break;
    case CENTER: realX = x - w/2; 
                 realY = y - h/2; break;
  }
  
  tl = tl || 0;
  tr = tr || tl;
  br = br || tl;
  bl = bl || tl;
  
  Canvas.context.beginPath();
  
  Canvas.context.moveTo(realX + tl, realY);
  Canvas.context.lineTo(realX + realW - tr, realY);
  Canvas.context.quadraticCurveTo(realX + realW, realY, realX + realW, realY + tr);
  Canvas.context.lineTo(realX + realW, realY + realH - br);
  Canvas.context.quadraticCurveTo(realX + realW, realY + realH, realX + realW - br, realY + realH);
  Canvas.context.lineTo(realX + bl, realY + realH);
  Canvas.context.quadraticCurveTo(x, realY + realH, realX, realY + realH - bl);
  Canvas.context.lineTo(realX, realY + tl);
  Canvas.context.quadraticCurveTo(realX, realY, realX + tl, realY);
  Canvas.context.closePath();
  
  Canvas.context.fill();
  Canvas.context.stroke();
};

@@ -1,12 +1,32 @@
+if (!Draw.rect) %7B%0A  
 Draw.rect = 
@@ -64,16 +64,18 @@
 , bl) %7B%0A
+  
   var re
@@ -82,17 +82,16 @@
 alX = x,
- 
 %0A      r
@@ -116,17 +116,16 @@
 alW = w,
- 
 %0A      r
@@ -138,19 +138,19 @@
  h;%0A
+%0A
   
-%0A
   switch
 (Dra
@@ -145,16 +145,17 @@
   switch
+ 
 (Draw.cu
@@ -171,24 +171,26 @@
 Mode) %7B%0A    
+ 
+ 
 case CORNERS
@@ -190,16 +190,24 @@
 CORNERS:
+%0A       
  realW =
@@ -218,34 +218,24 @@
  x;%0A        
-       
-   
 realH = h - 
@@ -236,16 +236,24 @@
 = h - y;
+%0A       
  break;%0A
@@ -252,24 +252,26 @@
  break;%0A    
+  
 case RADIUS:
@@ -270,16 +270,24 @@
  RADIUS:
+%0A       
  realX =
@@ -292,29 +292,22 @@
  = x + w
-/2;%0A         
+ / 2;%0A
         
@@ -323,21 +323,14 @@
  + h
-/2;%0A         
+ / 2;%0A
     
@@ -348,25 +348,16 @@
  w * 2;%0A
-         
         
@@ -370,16 +370,24 @@
 = h * 2;
+%0A       
  break;%0A
@@ -386,24 +386,26 @@
  break;%0A    
+ 
+ 
 case CENTER:
@@ -404,16 +404,24 @@
  CENTER:
+%0A       
  realX =
@@ -430,25 +430,22 @@
  - w
-/2; %0A    
+ / 2;%0A
         
     
@@ -440,21 +440,16 @@
         
-     
 realY = 
@@ -457,19 +457,29 @@
  - h
-/2;
+ / 2;%0A       
  break;%0A
   %7D%0A
@@ -478,15 +478,17 @@
 ak;%0A
+  
   %7D%0A
+%0A
   
-%0A
   tl
@@ -501,16 +501,18 @@
 %7C%7C 0;%0A  
+ 
+ 
 tr = tr 
@@ -520,16 +520,18 @@
 %7C tl;%0A  
+ 
+ 
 br = br 
@@ -537,16 +537,18 @@
  %7C%7C tl;%0A
+  
   bl = b
@@ -556,19 +556,19 @@
  %7C%7C tl;%0A
+%0A
   
-%0A
   Canvas
@@ -581,35 +581,35 @@
 xt.beginPath();%0A
+%0A
   
-%0A
   Canvas.context
@@ -628,32 +628,34 @@
 X + tl, realY);%0A
+  
   Canvas.context
@@ -682,32 +682,34 @@
 W - tr, realY);%0A
+  
   Canvas.context
@@ -772,24 +772,26 @@
 ealY + tr);%0A
+  
   Canvas.con
@@ -838,16 +838,18 @@
  - br);%0A
+  
   Canvas
@@ -932,32 +932,34 @@
 realY + realH);%0A
+  
   Canvas.context
@@ -994,16 +994,18 @@
 realH);%0A
+  
   Canvas
@@ -1072,24 +1072,26 @@
 ealH - bl);%0A
+  
   Canvas.con
@@ -1120,24 +1120,26 @@
 lY + tl);%0A  
+ 
+ 
 Canvas.conte
@@ -1192,16 +1192,18 @@
 realY);%0A
+  
   Canvas
@@ -1228,11 +1228,11 @@
 ();%0A
+%0A
   
-%0A
   Ca
@@ -1254,16 +1254,18 @@
 ll();%0A  
+ 
+ 
 Canvas.c
@@ -1285,7 +1285,11 @@
 ();%0A
+  
 %7D;%0A
+%7D%0A

Update rect.js