SpriteButton.prototype = Object.create(GeneralButton.prototype);
SpriteButton.prototype.constructor = SpriteButton;

/**
 * A button with a sprite on it.
 * @param {string} key - The sprite key.
 * @param {string} frame - The frame of the sprite (optional).
 * @param {Object} options - A list of options (in addition to GeneralButton):
 * @return {Object} Itself.
 */
function SpriteButton (key, frame, options) {
	GeneralButton.call(this, options); // Parent constructor.

	var half = this.size/2;
	var padded = this.size*0.9;

	this.sprite = this.create(half, half, key, frame);
	this.sprite.anchor.set(0.5);
	this.sprite.scale.set(padded/(this.sprite.width > this.sprite.height ?
		this.sprite.width : this.sprite.height));

	return this;
}
@@ -496,37 +496,8 @@
 e/2;
-%0A%09var padded = this.size*0.9;
 %0A%0A%09t
@@ -586,130 +586,534 @@
 his.
-sprite.scale.set(padded/(this.sprite.width %3E this.sprite.height ?%0A%09%09this.sprite.width : this.sprite.height));%0A%0A%09return this;%0A%7D
+_scaleSprite();%0A%0A%09return this;%0A%7D%0A%0A/**%0A * Scale the sprite according to the button size.%0A * @private%0A */%0ASpriteButton.prototype._scaleSprite = function () %7B%0A%09var padded = this.size*0.9;%0A%0A%09this.sprite.scale.set(padded/(this.sprite.width %3E this.sprite.height ?%0A%09%09this.sprite.width : this.sprite.height));%0A%7D;%0A%0A/**%0A * Set the size of this button.%0A * @param %7BNumber%7D The new size.%0A */%0ASpriteButton.prototype.setSize = function (size) %7B%0A%09GeneralButton.prototype.setSize.call(this, size);%0A%0A%09if (this.sprite) %7B%0A%09%09this._scaleSprite();%0A%09%7D%0A%7D;

Scale when changing size