Change ClientFrom/ToScreen to PointFrom/ToScreen

Fix #67
This commit is contained in:
stefnotch
2020-12-29 18:10:26 +01:00
parent da389eea03
commit 65ab9cac50
8 changed files with 20 additions and 20 deletions

View File

@@ -323,7 +323,7 @@ namespace FlaxEngine.GUI
if (parentWin == null)
throw new InvalidOperationException("Missing parent window.");
var clientPos = PointToWindow(Vector2.Zero);
return parentWin.ClientToScreen(clientPos);
return parentWin.PointToScreen(clientPos);
}
}
@@ -1113,12 +1113,12 @@ namespace FlaxEngine.GUI
/// </summary>
/// <param name="location">Input location of the point to convert</param>
/// <returns>Converted point location in screen coordinates</returns>
public virtual Vector2 ClientToScreen(Vector2 location)
public virtual Vector2 PointToScreen(Vector2 location)
{
location = PointToParent(ref location);
if (_parent != null)
{
location = _parent.ClientToScreen(location);
location = _parent.PointToScreen(location);
}
return location;
}
@@ -1128,11 +1128,11 @@ namespace FlaxEngine.GUI
/// </summary>
/// <param name="location">Input location of the point to convert</param>
/// <returns>Converted point location in local control's space</returns>
public virtual Vector2 ScreenToClient(Vector2 location)
public virtual Vector2 PointFromScreen(Vector2 location)
{
if (_parent != null)
{
location = _parent.ScreenToClient(location);
location = _parent.PointFromScreen(location);
}
return PointFromParent(ref location);
}

View File

@@ -71,7 +71,7 @@ namespace FlaxEngine.GUI
float dpiScale = Platform.DpiScale;
Vector2 dpiSize = Size * dpiScale;
Vector2 locationWS = target.PointToWindow(location);
Vector2 locationSS = parentWin.ClientToScreen(locationWS * dpiScale);
Vector2 locationSS = parentWin.PointToScreen(locationWS);
Vector2 screenSize = Platform.VirtualDesktopSize;
Vector2 rightBottomLocationSS = locationSS + dpiSize;
if (screenSize.Y < rightBottomLocationSS.Y)
@@ -194,7 +194,7 @@ namespace FlaxEngine.GUI
{
// Auto hide if mouse leaves control area
Vector2 mousePos = Input.MouseScreenPosition;
Vector2 location = _showTarget.ScreenToClient(mousePos);
Vector2 location = _showTarget.PointFromScreen(mousePos);
if (!_showTarget.OnTestTooltipOverControl(ref location))
{
// Mouse left or sth

View File

@@ -232,15 +232,15 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override Vector2 ScreenToClient(Vector2 location)
public override Vector2 PointFromScreen(Vector2 location)
{
return _window.ScreenToClient(location) / Platform.DpiScale;
return _window.ScreenToClient(location) / _window._dpiScale;
}
/// <inheritdoc />
public override Vector2 ClientToScreen(Vector2 location)
public override Vector2 PointToScreen(Vector2 location)
{
return _window.ClientToScreen(location);
return _window.ClientToScreen(location * _window._dpiScale);
}
/// <inheritdoc />