//--------------------------------------
//               PowerUI
//
//        For documentation or 
//    if you have any issues, visit
//        powerUI.kulestar.com
//
//    Copyright  2013 Kulestar Ltd
//          www.kulestar.com
//--------------------------------------

using System;


namespace Css.Units{
	
	/// <summary>
	/// Represents an instance of a viewport relative value, e.g. vh.
	/// </summary>
	
	public class ViewPortHeightUnit:ViewPortUnit{
		
		public override float DisplayNumber{
			get{
				return (RawValue * 100f);
			}
		}
		
		public override string ToString(){
			return DisplayNumber+"vh";
		}
		
		public override void OnValueReady(CssLexer lexer){
			// Map to 0-1 range:
			RawValue /= 100f;
		}
		
		public override float GetDecimal(RenderableData context,CssProperty property){
			
			return RawValue * context.Document.Viewport.Height;
			
		}
		
		protected override Value Clone(){
			ViewPortHeightUnit result=new ViewPortHeightUnit();
			result.RawValue=RawValue;
			return result;
		}
		
		public override string[] PostText{
			get{
				return new string[]{"vh"};
			}
		}
		
	}
	
}



