ExtJS4:使用Ext.draw停止冒泡事件

ExtJS4:使用Ext.draw停止冒泡事件,extjs,raphael,extjs4,Extjs,Raphael,Extjs4,我在使用ExtJS4及其绘图组件进行事件冒泡时遇到了一些困难: drawComponent.on('click', function(){ var sprite = Ext.create('Ext.draw.Sprite', { type: 'circle', fill: '#79BB3F', stroke: '#000000', 'stroke-width': 1, radius: 100,

我在使用ExtJS4及其绘图组件进行事件冒泡时遇到了一些困难:

drawComponent.on('click', function(){
    var sprite = Ext.create('Ext.draw.Sprite', {
        type: 'circle',
        fill: '#79BB3F',
        stroke: '#000000',
        'stroke-width': 1,
        radius: 100,
        x: 100,
        y: 100,
        surface: this.surface,
        listeners: {
            'click': function(el,e){
                console.log('clicked');
                e.stopPropagation();
            }
        }
    });
    sprite.show(true);
});
单击
drawComponent
时,将绘制一个圆。单击圆时,这应仅触发圆的
clickHandler
,而不是
drawComponent

知道我的代码有什么问题吗
e.stopPropagation()
应停止事件气泡

谢谢,
Chielus

使用
addManagedListeners
方法而不是
listeners
属性来添加单击事件

组件上的
单击事件也应删除

参考资料


如果在
drawComponent
单击事件中粘贴
console.log
,那么哪个会首先触发?drawComponent会首先触发。。。所以事件冒泡不是问题。。。知道是什么吗?看起来问题出在ExtJS的架构上。您只想创建一次sprite吗?这可能是ExtJS4中的一个bug,因为这是一个新版本(4.0.0)。除非我做错了什么,否则在我看来没问题……精灵是不是只能被创造一次?