package client.gui.element;

import client.renderer.Drawing;
import client.renderer.Drawing.Vec2i;

public class Fill extends Element {
	private final boolean left;
	private final boolean top;
	
	public Fill(int x, int y, int w, int h, String text, boolean top, boolean left) {
		super(x, y, w, h, null);
		this.top = top;
		this.left = left;
		this.setText(text);
	}

	public Fill(int x, int y, int w, int h, String text, boolean left) {
		this(x, y, w, h, text, false, left);
	}
	
	public Fill(int x, int y, int w, int h, String text) {
		this(x, y, w, h, text, false, false);
	}
	
	protected Fill(int x, int y, int w, int h, boolean top, boolean left) {
		super(x, y, w, h, null);
		this.top = top;
		this.left = left;
	}

	
	public boolean canHover() {
		return false;
	}
	
//	protected boolean isTextCenteredX() {
//		return !this.left;
//	}
//	
//	protected boolean isTextCenteredY() {
//		return !this.top;
//	}
	
	public void updateText() {
		Vec2i size = Drawing.getSize(this.text);
		if(!this.left)
			this.text_x = ((this.size_x - (this.margin_x1 + this.margin_x2)) - size.xpos) / 2;
		if(!this.top)
			this.text_y = ((this.size_y - (this.margin_y1 + this.margin_y2)) - size.ypos + 1) / 2;
	}
}
