@@ -58,7 +58,7 @@ namespace FlaxEditor.Content
|
||||
|
||||
public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
|
||||
{
|
||||
return Item.OnMouseDoubleClick(Item.ScreenToClient(ClientToScreen(location)), button);
|
||||
return Item.OnMouseDoubleClick(Item.PointFromScreen(PointToScreen(location)), button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1203,7 +1203,7 @@ namespace FlaxEditor
|
||||
var win = Windows.GameWin.Root;
|
||||
if (win != null && win.RootWindow is WindowRootControl root && root.Window.IsFocused)
|
||||
{
|
||||
pos = Vector2.Round(Windows.GameWin.Viewport.PointFromWindow(root.ScreenToClient(pos)));
|
||||
pos = Vector2.Round(Windows.GameWin.Viewport.PointFromWindow(root.Window.ScreenToClient(pos)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
// Check if show menu inside the other menu - then link as a child to prevent closing the calling menu window on lost focus
|
||||
if (_parentCM == null && parentWin.ChildrenCount == 1 && parentWin.Children[0] is ContextMenuBase parentCM)
|
||||
{
|
||||
parentCM.ShowChild(this, parentCM.ScreenToClient(parent.ClientToScreen(location)), false);
|
||||
parentCM.ShowChild(this, parentCM.PointFromScreen(parent.PointToScreen(location)), false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
var dpiScale = Platform.DpiScale;
|
||||
Vector2 dpiSize = Size * dpiScale;
|
||||
Vector2 locationWS = parent.PointToWindow(location);
|
||||
Vector2 locationSS = parentWin.ClientToScreen(locationWS * dpiScale);
|
||||
Vector2 locationSS = parentWin.PointToScreen(locationWS);
|
||||
Location = Vector2.Zero;
|
||||
Rectangle monitorBounds = Platform.GetMonitorBounds(locationSS);
|
||||
Vector2 rightBottomLocationSS = locationSS + dpiSize;
|
||||
@@ -303,7 +303,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
if (_parentCM != null)
|
||||
{
|
||||
// Focus parent if user clicked over the parent popup
|
||||
var mouse = _parentCM.ScreenToClient(FlaxEngine.Input.MouseScreenPosition);
|
||||
var mouse = _parentCM.PointFromScreen(FlaxEngine.Input.MouseScreenPosition);
|
||||
if (_parentCM.ContainsPoint(ref mouse))
|
||||
{
|
||||
_parentCM._window.Focus();
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
var control = _tabsProxy != null ? (Control)_tabsProxy : this;
|
||||
var dpiScale = Platform.DpiScale;
|
||||
var clientPos = control.PointToWindow(Vector2.Zero);
|
||||
return new Rectangle(parentWin.ClientToScreen(clientPos * dpiScale), control.Size * dpiScale);
|
||||
return new Rectangle(parentWin.PointToScreen(clientPos), control.Size * dpiScale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
var parentWin = Root;
|
||||
if (parentWin == null)
|
||||
return null;
|
||||
Vector2 clientPos = parentWin.ScreenToClient(position);
|
||||
Vector2 clientPos = parentWin.PointFromScreen(position);
|
||||
Vector2 localPos = PointFromWindow(clientPos);
|
||||
|
||||
// Early out
|
||||
|
||||
@@ -359,13 +359,13 @@ namespace FlaxEditor.Modules
|
||||
// Place dialog nearby the target control
|
||||
if (targetControl != null)
|
||||
{
|
||||
var targetControlDesktopCenter = targetControl.ClientToScreen(targetControl.Size * 0.5f);
|
||||
var targetControlDesktopCenter = targetControl.PointToScreen(targetControl.Size * 0.5f);
|
||||
var desktopSize = Platform.GetMonitorBounds(targetControlDesktopCenter);
|
||||
var pos = targetControlDesktopCenter + new Vector2(10.0f, -dialog.Height * 0.5f);
|
||||
var dialogEnd = pos + dialog.Size;
|
||||
var desktopEnd = desktopSize.BottomRight - new Vector2(10.0f);
|
||||
if (dialogEnd.X >= desktopEnd.X || dialogEnd.Y >= desktopEnd.Y)
|
||||
pos = targetControl.ClientToScreen(Vector2.Zero) - new Vector2(10.0f + dialog.Width, dialog.Height);
|
||||
pos = targetControl.PointToScreen(Vector2.Zero) - new Vector2(10.0f + dialog.Width, dialog.Height);
|
||||
var desktopBounds = Platform.VirtualDesktopBounds;
|
||||
pos = Vector2.Clamp(pos, desktopBounds.UpperLeft, desktopBounds.BottomRight - dialog.Size);
|
||||
dialog.RootWindow.Window.Position = pos;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user