Skip to content

Commit

Permalink
Element.getSize() instead of Element.getComputedSize() in Mask.resize…
Browse files Browse the repository at this point in the history
…(), fixes mootools#1273
  • Loading branch information
lorenzos committed Jul 7, 2014
1 parent f35dde6 commit 1b3fccc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Source/Interface/Mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,23 @@ var Mask = new Class({
},

resize: function(x, y){
var opt = {
styles: ['padding', 'border']
};
if (this.options.maskMargins) opt.styles.push('margin');

var dim = this.target.getComputedSize(opt);
var dim = this.target.getSize();
if (this.options.maskMargins) {
dim.x += this.target.getStyle('margin-left').toInt() + this.target.getStyle('margin-right').toInt();
dim.y += this.target.getStyle('margin-top').toInt() + this.target.getStyle('margin-bottom').toInt();
}

if (this.target == document.body){
this.element.setStyles({width: 0, height: 0});
var win = window.getScrollSize();
if (dim.totalHeight < win.y) dim.totalHeight = win.y;
if (dim.totalWidth < win.x) dim.totalWidth = win.x;
if (dim.y < win.y) dim.y = win.y;
if (dim.x < win.x) dim.x = win.x;
}

this.element.setStyles({
width: Array.pick([x, dim.totalWidth, dim.x]),
height: Array.pick([y, dim.totalHeight, dim.y])
width: Array.pick([x, dim.x]),
height: Array.pick([y, dim.y])
});

return this;
Expand Down

0 comments on commit 1b3fccc

Please sign in to comment.