Nez.UI.Element.screenToLocalCoordinates C# (CSharp) Method

screenToLocalCoordinates() public method

Transforms the specified point in screen coordinates to the element's local coordinate system
public screenToLocalCoordinates ( Vector2 screenCoords ) : Vector2
screenCoords Vector2 Screen coords.
return Vector2
		public Vector2 screenToLocalCoordinates( Vector2 screenCoords )
		{
			if( stage == null )
				return screenCoords;
			return stageToLocalCoordinates( stage.screenToStageCoordinates( screenCoords ) );
		}

Usage Example

        public override Element hit(Vector2 point)
        {
            // we do some rejiggering here by checking for hits on our target and using that
            var local = _targetElement.screenToLocalCoordinates(point);

            if (_targetElement.hit(local) != null)
            {
                if (!_isMouseOver)
                {
                    _isMouseOver = true;
                    _manager.enter(this);
                }
                setContainerPosition(local.X, local.Y);
            }
            else if (_isMouseOver)
            {
                _isMouseOver = false;
                _manager.hide(this);
            }
            return(null);
        }