Ext.MessageBox点击多次会卡住的解决方案

原因很简单:如果动画没有调用结束时间,就调用清除代码。

Ext.Component.prototype.animateFn = // or Ext.override( Ext.Component, { animateFn:
            function (animation, component, newState, oldState, options, controller) {
                var me = this;
                if (animation && (!newState || (newState && this.isPainted()))) {

                    this.activeAnimation = new Ext.fx.Animation(animation);
                    this.activeAnimation.setElement(component.element);

                    if (!Ext.isEmpty(newState)) {
                        var onEndInvoked = false;
                        var onEnd = function () {
                            if (!onEndInvoked) {
                                onEndInvoked = true;
                                me.activeAnimation = null;
                                controller.resume();
                            }
                        };

                        this.activeAnimation.setOnEnd(onEnd);
                        window.setTimeout(onEnd, 50 + (this.activeAnimation.getDuration() || 500));

                        controller.pause();
                    }

                    Ext.Animator.run(me.activeAnimation);
                }
            };

猜你喜欢

转载自linyasa.iteye.com/blog/2266644