root / trunk / web / dojo / dojox / drawing / stencil / Rect.js
History | View | Annotate | Download (1.24 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.drawing.stencil.Rect"]){ |
9 |
dojo._hasResource["dojox.drawing.stencil.Rect"]=true; |
10 |
dojo.provide("dojox.drawing.stencil.Rect");
|
11 |
dojox.drawing.stencil.Rect=dojox.drawing.util.oo.declare(dojox.drawing.stencil._Base,function(_1){
|
12 |
if(this.points.length){ |
13 |
} |
14 |
},{type:"dojox.drawing.stencil.Rect",anchorType:"group",baseRender:true,dataToPoints:function(d){ |
15 |
d=d||this.data;
|
16 |
this.points=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}]; |
17 |
return this.points; |
18 |
},pointsToData:function(p){ |
19 |
p=p||this.points;
|
20 |
var s=p[0]; |
21 |
var e=p[2]; |
22 |
this.data={x:s.x,y:s.y,width:e.x-s.x,height:e.y-s.y,r:this.data.r||0}; |
23 |
return this.data; |
24 |
},_create:function(_2,d,_3){ |
25 |
this.remove(this[_2]); |
26 |
this[_2]=this.container.createRect(d).setStroke(_3).setFill(_3.fill); |
27 |
this._setNodeAtts(this[_2]); |
28 |
},render:function(){ |
29 |
this.onBeforeRender(this); |
30 |
this.renderHit&&this._create("hit",this.data,this.style.currentHit); |
31 |
this._create("shape",this.data,this.style.current); |
32 |
}}); |
33 |
dojox.drawing.register({name:"dojox.drawing.stencil.Rect"},"stencil"); |
34 |
} |