root / trunk / web / dojo / dojox / drawing / tools / Arrow.js
History | View | Annotate | Download (1.29 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.tools.Arrow"]){ |
||
9 | dojo._hasResource["dojox.drawing.tools.Arrow"]=true; |
||
10 | dojo.provide("dojox.drawing.tools.Arrow");
|
||
11 | dojox.drawing.tools.Arrow=dojox.drawing.util.oo.declare(dojox.drawing.tools.Line,function(_1){
|
||
12 | if(this.arrowStart){ |
||
13 | this.begArrow=new dojox.drawing.annotations.Arrow({stencil:this,idx1:0,idx2:1}); |
||
14 | } |
||
15 | if(this.arrowEnd){ |
||
16 | this.endArrow=new dojox.drawing.annotations.Arrow({stencil:this,idx1:1,idx2:0}); |
||
17 | } |
||
18 | if(this.points.length){ |
||
19 | this.render();
|
||
20 | } |
||
21 | },{draws:true,type:"dojox.drawing.tools.Arrow",baseRender:false,arrowStart:false,arrowEnd:true,onUp:function(_2){ |
||
22 | if(this.created||!this.shape){ |
||
23 | return;
|
||
24 | } |
||
25 | var p=this.points; |
||
26 | var _3=this.util.distance(p[0].x,p[0].y,p[1].x,p[1].y); |
||
27 | if(_3<this.minimumSize){ |
||
28 | this.remove(this.shape,this.hit); |
||
29 | return;
|
||
30 | } |
||
31 | var pt=this.util.snapAngle(_2,this.angleSnap/180); |
||
32 | this.setPoints([{x:p[0].x,y:p[0].y},{x:pt.x,y:pt.y}]); |
||
33 | this.renderedOnce=true; |
||
34 | this.onRender(this); |
||
35 | }}); |
||
36 | dojox.drawing.tools.Arrow.setup={name:"dojox.drawing.tools.Arrow",tooltip:"Arrow Tool",iconClass:"iconArrow"}; |
||
37 | dojox.drawing.register(dojox.drawing.tools.Arrow.setup,"tool");
|
||
38 | } |