Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / drawing / ui / Tooltip.js @ 12

History | View | Annotate | Download (1.94 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.ui.Tooltip"]){
9
dojo._hasResource["dojox.drawing.ui.Tooltip"]=true;
10
dojo.provide("dojox.drawing.ui.Tooltip");
11
dojo.require("dojox.drawing.plugins._Plugin");
12
(function(){
13
var _1=null;
14
var _2=dojox.drawing.util.oo.declare(dojox.drawing.plugins._Plugin,function(_3){
15
this.createDom();
16
},{show:function(_4,_5){
17
this.domNode.innerHTML=_5;
18
var dx=30;
19
var px=_4.data.x+_4.data.width;
20
var py=_4.data.y+_4.data.height;
21
var x=px+this.mouse.origin.x+dx;
22
var y=py+this.mouse.origin.y+dx;
23
dojo.style(this.domNode,{display:"inline",left:x+"px",top:y+"px"});
24
var _6=dojo.marginBox(this.domNode);
25
this.createShape(x-this.mouse.origin.x,y-this.mouse.origin.y,_6.w,_6.h);
26
},createShape:function(x,y,w,h){
27
this.balloon&&this.balloon.destroy();
28
var r=5,x2=x+w,y2=y+h,_7=[];
29
var _8=function(){
30
for(var i=0;i<arguments.length;i++){
31
_7.push(arguments[i]);
32
}
33
};
34
_8({x:x,y:y+5},{t:"Q",x:x,y:y},{x:x+r,y:y});
35
_8({t:"L",x:x2-r,y:y});
36
_8({t:"Q",x:x2,y:y},{x:x2,y:y+r});
37
_8({t:"L",x:x2,y:y2-r});
38
_8({t:"Q",x:x2,y:y2},{x:x2-r,y:y2});
39
_8({t:"L",x:x+r,y:y2});
40
_8({t:"Q",x:x,y:y2},{x:x,y:y2-r});
41
_8({t:"L",x:x,y:y+r});
42
this.balloon=this.drawing.addUI("path",{points:_7});
43
},createDom:function(){
44
this.domNode=dojo.create("span",{"class":"drawingTooltip"},document.body);
45
dojo.style(this.domNode,{display:"none",position:"absolute"});
46
}});
47
dojox.drawing.ui.Tooltip=dojox.drawing.util.oo.declare(dojox.drawing.plugins._Plugin,function(_9){
48
if(!_1){
49
_1=new _2(_9);
50
}
51
if(_9.stencil){
52
}else{
53
if(this.button){
54
this.connect(this.button,"onOver",this,"onOver");
55
this.connect(this.button,"onOut",this,"onOut");
56
}
57
}
58
},{width:300,height:200,onOver:function(){
59
_1.show(this.button,this.data.text);
60
},onOut:function(){
61
}});
62
dojox.drawing.register({name:"dojox.drawing.ui.Tooltip"},"stencil");
63
})();
64
}