Hovering over a set of elements in Raphaeljs

后端 未结 4 1401
囚心锁ツ
囚心锁ツ 2021-01-03 06:26

I have a set that only contains a rectangle.

var hoverTrigger = this.paper.set();
var outline = this.paper.rect();
outline.attr({
...
hoverTrigger.push(outli         


        
4条回答
  •  孤城傲影
    2021-01-03 07:09

    I found that this works with the following

    myCircleElement.hover (
        function(e) { myTextElement.animate({opacity:1}, 800); },
        function(e) {
            var x = e.layerX || e.x,
            y = e.layerY || e.y;
            // Return `false` if we're still inside the element's bounds                                        
            if (this.isPointInside(x, y)) return false;
            // otherwise do something here.. eg below
            myTextElement.animate({opacity:0}, 800); //
        }
    );
    

提交回复
热议问题