Tooltip Manager

From Ka-Map Wiki

Jump to: navigation, search
tooltip function is still under development. Available in CVS only.

A simple tooltip class to allow easy managing, fast response and some features like map recentering when borders get out of the viewport. It supports HTML text inside the tooltip. Can manage an image usable as tip with custom offset position.

!!kaToolTip

To use kaToolTip:

1) add a script and css tags to your header page:

 <script type="text/javascript" src="tools/tooltip/kaToolTip.js"></script>
 <link rel="stylesheet" href="tools/tooltip/tooltip.css" type="text/css" />


2) create a new instance of kaToolTip

 var toolTip = new kaToolTip( myKaMap );

3) if you want you can set an image (as the tip pointer)

 var offsetX=-6;//offset to move the image left-right
 var offsetY=-19;//offset to move the image top-bottom
 toolTip.setTipImage('images/tip-red.png',offsetX,offsetY);

4) Set text

 toolTip.setText('Some text inside the tooltip');

6) add it to the map

 toolTip.move(x,y);  //pixel coords

or by geo coords:

toolTip.moveGeo(x,y); //geo coords

7) hide the tooltip

toolTip.move();
Personal tools