Home Reference Source

vgui/15-resize-event.js

/**
 * Event that is dispatched when the panel is resized by a parent
 */
export class ResizeEvent extends Event {
	/**
	 * Creates a new ResizeEvent
	 * @param {int} width - The new width of the panel
	 * @param {int} height - The new height of the panel
	 */
	constructor(width, height) {
		if (!width)
			throw new Error("Parameter width not set!");
		if (!height)
			throw new Error("Parameter height not set!");
		super();
		this._width = width;
		this._height = height;
	}

	/**
	 * The new width of the panel
	 */
	get width() {
		return this._width;
	}

	/**
	 * The new height of the panel
	 */
	get height() {
		return this._height;
	}

	/**
	 * @override
	 */
	get type() {
		return "ResizeEvent";
	}
}