Axiom.Overlays.OverlayElement.UpdateFromParent C# (CSharp) Метод

UpdateFromParent() публичный Метод

Updates this elements transform based on it's parent.
public UpdateFromParent ( ) : void
Результат void
		public virtual void UpdateFromParent()
		{
			float parentLeft, parentTop, parentBottom, parentRight;

			parentLeft = parentTop = parentBottom = parentRight = 0;

			if ( parent != null )
			{
				parentLeft = parent.DerivedLeft;
				parentTop = parent.DerivedTop;

				// derive right position
				if ( horzAlign == HorizontalAlignment.Center || horzAlign == HorizontalAlignment.Right )
				{
					parentRight = parentLeft + parent.width;
				}
				// derive bottom position
				if ( vertAlign == VerticalAlignment.Center || vertAlign == VerticalAlignment.Bottom )
				{
					parentBottom = parentTop + parent.height;
				}
			}
			else
			{
				// with no real parent, the "parent" is actually the full viewport size
				//                parentLeft = parentTop = 0.0f;
				//                parentRight = parentBottom = 1.0f;

				RenderSystem rSys = Root.Instance.RenderSystem;
				OverlayManager oMgr = OverlayManager.Instance;

				// Calculate offsets required for mapping texel origins to pixel origins in the
				// current rendersystem
				float hOffset = rSys.HorizontalTexelOffset / oMgr.ViewportWidth;
				float vOffset = rSys.VerticalTexelOffset / oMgr.ViewportHeight;

				parentLeft = 0.0f + hOffset;
				parentTop = 0.0f + vOffset;
				parentRight = 1.0f + hOffset;
				parentBottom = 1.0f + vOffset;
			}

			// sort out position based on alignment
			// all we do is derived the origin, we don't automatically sort out the position
			// This is more flexible than forcing absolute right & middle

			switch ( horzAlign )
			{
				case HorizontalAlignment.Center:
					derivedLeft = ( ( parentLeft + parentRight ) * 0.5f ) + left;
					break;

				case HorizontalAlignment.Left:
					derivedLeft = parentLeft + left;
					break;

				case HorizontalAlignment.Right:
					derivedLeft = parentRight + left;
					break;
			}

			switch ( vertAlign )
			{
				case VerticalAlignment.Center:
					derivedTop = ( ( parentTop + parentBottom ) * 0.5f ) + top;
					break;

				case VerticalAlignment.Top:
					derivedTop = parentTop + top;
					break;

				case VerticalAlignment.Bottom:
					derivedTop = parentBottom + top;
					break;
			}

			isDerivedOutOfDate = false;
			if ( parent != null )
			{
				Rectangle parentRect;

				parentRect = parent.ClippingRegion;

				Rectangle childRect = new Rectangle( (long)derivedLeft, (long)derivedTop, (long)( derivedLeft + width ), (long)( derivedTop + height ) );

				this.clippingRegion = Rectangle.Intersect( parentRect, childRect );
			}
			else
			{
				clippingRegion = new Rectangle( (long)derivedLeft, (long)derivedTop, (long)( derivedLeft + width ), (long)( derivedTop + height ) );
			}
		}