PDA

View Full Version : Bug / weird logic in Ext.Viewport.getSize() screws up dynamic resizing



Floatopian
13 Sep 2011, 5:02 PM
When resizing a window on the mobile device, the following code makes for very strange behavior. This seems to be a bit too much cleverness on Sencha's part, as I just spent a few hours chasing down the reason a Sencha UIWebView would not properly resize.



getSize: function() {
var size = {
width: window.innerWidth,
height: window.innerHeight
};
/// (my comment) the below code makes little sense.
if (!Ext.is.Desktop) {
size.height = (this.orientation == this.initialOrientation) ?
Math.max(this.initialHeight, size.height) :
size.height
}

return size;
},


The above code should be replaced with the following to work for me:



getSize: function() {
var size = {
width: window.innerWidth,
height: window.innerHeight
};
return size;
},



There is other Math.max bizarreness in Viewport.js, but not much explanation for why it is there.