Javascript Raphael库:除非已填充,否则不能单击Rect元素?

Javascript Raphael库:除非已填充,否则不能单击Rect元素?,javascript,raphael,Javascript,Raphael,这让我有点疯狂。守则: var rect = this.paper.rect(0,0,this.width - 10,this.height - 10); rect.click(function(event) { alert("hi"); }); 从不触发单击事件,但: var rect = this.paper.rect(0,0,this.width - 10,this.height - 10).attr({fill: 'black', 'fill-opacity': 0}) r

这让我有点疯狂。守则:

var rect = this.paper.rect(0,0,this.width - 10,this.height - 10);

rect.click(function(event) {
    alert("hi");
});
从不触发单击事件,但:

var rect = this.paper.rect(0,0,this.width - 10,this.height - 10).attr({fill: 'black', 'fill-opacity': 0})

rect.click(function(event) {
    alert("hi");
});

将触发单击事件。似乎必须完全填充rect对象才能注册单击。我有一个大的ole矩形,我想点击。给出了什么?

用不可见的颜色填充,不透明度为0.1

var rect = this.paper.rect(0,0,this.width - 10,this.height - 10)
                     .attr({fill: 'black', 'fill-opacity': 0.1})

是 啊是我干的。不太明白为什么它需要任何填充,但这是有效的。