i'm trying to draw a graph in a canvas, every vertex has its own coordinates (in center of the circle - 6px radius - that represent it).
I want to show a tooltip when i am over a vertex with mouse...and hide this tooltip when i am not on a vertex.
Now the tooltip is showing (only after the second pass on canvas with mouse) with right data, but when i am no more on vertex, tooltip is still here.
Here is the code of canvas.addEventListener (only here is tooltip)
canvas.addEventListener('mousemove', function(evt) {
var mX = evt.clientX;
var mY = evt.clientY;
mX -= canvas.offsetLeft;
mY -= canvas.offsetTop;
$("canvas").tooltip();
for (i=0; i<points.length; i++) {
if (mX<points[i].x+6 && mX>points[i].x-6) {
if (mY<points[i].y+6 && mY>points[i].y-6) {
var str = getNodeRelations(evt);
x1 = points[i].x-6;
x2 = points[i].x+6;
y1 = points[i].y-6;
y2 = points[i].y+6;
/*if ($("canvas").tooltip("instance") != undefined && $("canvas").tooltip("option", "disabled") == true) {
$("canvas").tooltip("option", "disabled", false);
}*/
$("canvas").tooltip({
content: str,
effect: "fade",
track: true
});
}
}
}
/*if ($("canvas").tooltip("instance") != undefined && ((mX<x1 || mX>x2) && (mY<y1 || mY>y2))) {
$("canvas").tooltip("option", "disabled", true);
}*/
}, false);
}
In comment block are not working codelines
Thank you for help in advance!