2010-12-14 12 views
2

ウィンドウのサイズを変更する次のコードがありますが、ウィンドウ/パネルのスケーリングは幅のみで動作するようですか?ExtJSのウィンドウまたはパネルの高さをスケーリング(サイズ変更)するとアニメーションが発生しません

Ext.onReady(function() { 
    var myWindow = new Ext.Window(); 
    myWindow.width = 80; 
    myWindow.height = 80; 
    var myButton = new Ext.Button({ 
     text: 'Resize', 
     handler: function(button, event){ 
      myWindow.el.scale(400, 400); 
      //myWindow.setHeight(400); 
     } 
    }); 
    myWindow.add(myButton); 
    myWindow.show(); 
}); 

サイズ変更は、私が「setHeightメソッド」行のコメントを外し、その後リサイズアニメーションがなくなっている場合は動作します。何か案が?

答えて

0

明らかに、ウィンドウはそのように拡大縮小することはできません。

http://www.sencha.com/forum/showthread.php?118694-Scaling-(resizing)-the-height-of-a-window-(or-panel)-does-not-work&p=551012#post551012

Windowクラスにはスケールの方法がありません。 ウィンドウの知識なしにウィンドウの要素をプログラム的に拡大しています。

このボックスコンポーネントのスケールメソッドをオーバーライドされるための溶液:http://www.sencha.com/forum/showthread.php?65176-Window-scale()-override-problem&p=314906#post314906

で見出さ

Ext.override(Ext.BoxComponent, { 
    scale: function(w, h, duration, easing) { 
     var a = Ext.lib.Anim.motion(this.el, { 
      height: {to: h}, 
      width: {to: w} 
     }, duration || 0.35, easing || 'easeOut', function(){ 
      a.onTween.clearListeners(); 
     }); 
     a.onTween.addListener(function(){ 
      if (this.fixedCenter) { 
       this.center(); 
      } 
      this.syncSize(); 
      this.syncShadow(); 
     }, this); 
     a.animate(); 
    } 
}); 

Ext.onReady(function(){ 

    var scale = function() { 
     win.scale(500, 400); 
    } 
    var win = new Ext.Window({ 
     fixedCenter: true, 
     html: "test", 
     width: 200, 
     height: 200, 
     buttons: [{ 
      text: "scale", 
      handler: scale 
     }] 
    }).show(); 
}); 

ソリューション

関連する問題