I have a set that only contains a rectangle.
var hoverTrigger = this.paper.set();
var outline = this.paper.rect();
outline.attr({
...
hoverTrigger.push(outli
I hit on this problem before. I found 2 solutions.
Create a rectangle over other elements with opacity set to 0
var paper = new Raphael( 0, 0, 100, 100 );
var rect = paper.rect( 0, 0, 100, 100 ).attr({ opacity: 0 });
rect.hover( func_in, func_out );
This only works for elements that have 1 overall action like click.
The other option is to cancel the hover function when hovering over a set of elements
var funcOutTimer;
set.hover( function( ) {
if( funcOutTimer ) { // Hovered into this element in less than 100 milliseconds => cancel
window.clearTimeout( funcOutTimer);
} else {
// do stuff
}
},
function( ) {
funcOutTimer = setTimeout( function( ) {
// do stuff
}, 100 ); // wait for 100 milliseconds before executing hover out function
});
Basically the hover in function is only executed when first entering a set of elements for the first time and the hover out function will only execute once when finally the element you have hovered into is not part of that set.