Axiom.Overlays.OverlayElement.Update C# (CSharp) Method

Update() public method

Internal method to update the element based on transforms applied.
public Update ( ) : void
return void
		public virtual void Update()
		{
			// Check size if pixel-based
			switch ( this.metricsMode )
			{
				case MetricsMode.Pixels:
					if ( OverlayManager.Instance.HasViewportChanged || isGeomPositionsOutOfDate )
					{
						OverlayManager oMgr = OverlayManager.Instance;
						float vpWidth = oMgr.ViewportWidth;
						float vpHeight = oMgr.ViewportHeight;

						// cope with temporarily zero dimensions, avoid divide by zero
						vpWidth = vpWidth == 0.0f ? 1.0f : vpWidth;
						vpHeight = vpHeight == 0.0f ? 1.0f : vpHeight;

						pixelScaleX = 1.0f / vpWidth;
						pixelScaleY = 1.0f / vpHeight;

						left = pixelLeft * pixelScaleX;
						top = pixelTop * pixelScaleY;
						width = pixelWidth * pixelScaleX;
						height = pixelHeight * pixelScaleY;
					}
					break;

				case MetricsMode.Relative_Aspect_Adjusted:
					if ( OverlayManager.Instance.HasViewportChanged || isGeomPositionsOutOfDate )
					{
						OverlayManager oMgr = OverlayManager.Instance;
						float vpWidth = oMgr.ViewportWidth;
						float vpHeight = oMgr.ViewportHeight;

						// cope with temporarily zero dimensions, avoid divide by zero
						vpWidth = vpWidth == 0.0f ? 1.0f : vpWidth;
						vpHeight = vpHeight == 0.0f ? 1.0f : vpHeight;

						pixelScaleX = 1.0f / ( 10000.0f * ( vpWidth / vpHeight ) );
						pixelScaleY = 1.0f / 10000.0f;

						left = pixelLeft * pixelScaleX;
						top = pixelTop * pixelScaleY;
						width = pixelWidth * pixelScaleX;
						height = pixelHeight * pixelScaleY;
					}
					break;
				default:
					break;
			}

			// container subclasses will update children too
			UpdateFromParent();

			// update our own position geometry
			if ( isGeomPositionsOutOfDate && this.isInitialized )
			{
				UpdatePositionGeometry();
				isGeomPositionsOutOfDate = false;
			}
			// Tell self to update own texture geometry
			if ( isGeomUVsOutOfDate && this.isInitialized )
			{
				UpdateTextureGeometry();
				isGeomUVsOutOfDate = false;
			}
		}