package speiger.src.coreengine.rendering.guiOld.helper.constrains;

public class PixelConstrain extends Constrain
{
	float pixels;
	boolean inverted = false;
	
	public PixelConstrain()
	{
	}
	
	public PixelConstrain(float pixels)
	{
		this.pixels = pixels;
	}
	
	public PixelConstrain setInverted()
	{
		inverted = true;
		return this;
	}
	
	@Override
	public void apply()
	{
		if(inverted)
		{
			set(get(target.toWidth()) - pixels);
			return;
		}
		set(pixels);
	}
}
