Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / drawing / stencil / Ellipse.js @ 10

History | View | Annotate | Download (1.25 KB)

1 9 andrej.cim
/*
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.Ellipse"]){
9
dojo._hasResource["dojox.drawing.stencil.Ellipse"]=true;
10
dojo.provide("dojox.drawing.stencil.Ellipse");
11
dojox.drawing.stencil.Ellipse=dojox.drawing.util.oo.declare(dojox.drawing.stencil._Base,function(_1){
12
},{type:"dojox.drawing.stencil.Ellipse",anchorType:"group",baseRender:true,dataToPoints:function(o){
13
o=o||this.data;
14
var x=o.cx-o.rx,y=o.cy-o.ry,w=o.rx*2,h=o.ry*2;
15
this.points=[{x:x,y:y},{x:x+w,y:y},{x:x+w,y:y+h},{x:x,y:y+h}];
16
return this.points;
17
},pointsToData:function(p){
18
p=p||this.points;
19
var s=p[0];
20
var e=p[2];
21
this.data={cx:s.x+(e.x-s.x)/2,cy:s.y+(e.y-s.y)/2,rx:(e.x-s.x)*0.5,ry:(e.y-s.y)*0.5};
22
return this.data;
23
},_create:function(_2,d,_3){
24
this.remove(this[_2]);
25
this[_2]=this.container.createEllipse(d).setStroke(_3).setFill(_3.fill);
26
this._setNodeAtts(this[_2]);
27
},render:function(){
28
this.onBeforeRender(this);
29
this.renderHit&&this._create("hit",this.data,this.style.currentHit);
30
this._create("shape",this.data,this.style.current);
31
}});
32
dojox.drawing.register({name:"dojox.drawing.stencil.Ellipse"},"stencil");
33
}