Skip to content

Instantly share code, notes, and snippets.

@TimBlock
Created January 19, 2016 11:37
Show Gist options
  • Save TimBlock/a0b9c8e560c7e2c7aaef to your computer and use it in GitHub Desktop.
Save TimBlock/a0b9c8e560c7e2c7aaef to your computer and use it in GitHub Desktop.
// Your code here.
function StretchCell(inner, width, height){
this.inner = inner;
this.width = width;
this.height = height;
};
StretchCell.prototype.minWidth = function(){
return Math.max(this.width, this.inner.minWidth());
}
StretchCell.prototype.minHeight = function() {
return Math.max(this.height, this.inner.minHeight());
}
StretchCell.prototype.draw = function(width,height) {
return this.inner.draw(width,height);
}
var sc = new StretchCell(new TextCell("abc"), 1, 2);
console.log(sc.minWidth());
// → 3
console.log(sc.minHeight());
// → 2
console.log(sc.draw(3, 2));
// → ["abc", " "]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment