root / trunk / web / dojo / dojox / drawing / stencil / Line.js @ 13
History | View | Annotate | Download (1.23 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.Line"]){ |
9 |
dojo._hasResource["dojox.drawing.stencil.Line"]=true; |
10 |
dojo.provide("dojox.drawing.stencil.Line");
|
11 |
dojox.drawing.stencil.Line=dojox.drawing.util.oo.declare(dojox.drawing.stencil._Base,function(_1){
|
12 |
},{type:"dojox.drawing.stencil.Line",anchorType:"single",baseRender:true,dataToPoints:function(o){ |
13 |
o=o||this.data;
|
14 |
if(o.radius||o.angle){
|
15 |
var pt=this.util.pointOnCircle(o.x,o.y,o.radius,o.angle); |
16 |
this.data=o={x1:o.x,y1:o.y,x2:pt.x,y2:pt.y}; |
17 |
} |
18 |
this.points=[{x:o.x1,y:o.y1},{x:o.x2,y:o.y2}]; |
19 |
return this.points; |
20 |
},pointsToData:function(p){ |
21 |
p=p||this.points;
|
22 |
this.data={x1:p[0].x,y1:p[0].y,x2:p[1].x,y2:p[1].y}; |
23 |
return this.data; |
24 |
},_create:function(_2,d,_3){ |
25 |
this.remove(this[_2]); |
26 |
this[_2]=this.container.createLine(d).setStroke(_3); |
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.Line"},"stencil"); |
34 |
} |