mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 17:28:01 +01:00
Made MouseEvent.ScreenX/Y a Point
This commit is contained in:
@@ -1411,8 +1411,7 @@ public static partial class Application
|
||||
X = frameLoc.X,
|
||||
Y = frameLoc.Y,
|
||||
Flags = a.MouseEvent.Flags,
|
||||
ScreenX = a.MouseEvent.X,
|
||||
ScreenY = a.MouseEvent.Y,
|
||||
ScreenPosition = new (a.MouseEvent.X, a.MouseEvent.Y),
|
||||
View = view
|
||||
};
|
||||
|
||||
@@ -1468,8 +1467,7 @@ public static partial class Application
|
||||
X = frameLoc.X,
|
||||
Y = frameLoc.Y,
|
||||
Flags = a.MouseEvent.Flags,
|
||||
ScreenX = a.MouseEvent.X,
|
||||
ScreenY = a.MouseEvent.Y,
|
||||
ScreenPosition = new (a.MouseEvent.X, a.MouseEvent.Y),
|
||||
View = view
|
||||
};
|
||||
}
|
||||
@@ -1482,8 +1480,7 @@ public static partial class Application
|
||||
X = boundsPoint.X,
|
||||
Y = boundsPoint.Y,
|
||||
Flags = a.MouseEvent.Flags,
|
||||
ScreenX = a.MouseEvent.X,
|
||||
ScreenY = a.MouseEvent.X,
|
||||
ScreenPosition = new (a.MouseEvent.X, a.MouseEvent.Y),
|
||||
View = view
|
||||
};
|
||||
}
|
||||
|
||||
@@ -111,10 +111,10 @@ public class MouseEvent
|
||||
/// <summary>The View at the location for the mouse event.</summary>
|
||||
public View View { get; set; }
|
||||
|
||||
/// <summary>The X (column) location of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
|
||||
/// <summary>The X position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
|
||||
public int X { get; set; }
|
||||
|
||||
/// <summary>The Y (column) location of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
|
||||
/// <summary>The Y position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
|
||||
public int Y { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -124,36 +124,19 @@ public class MouseEvent
|
||||
public bool Handled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The screen-relative mouse coordinate.
|
||||
/// The screen-relative mouse position.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Calculated and processed in <see cref="Application.OnMouseEvent(MouseEventEventArgs)"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The View that has called <see cref="Application.GrabMouse"/> will receive all mouse events
|
||||
/// with <see cref="View.Bounds"/>-relative coordinates. <see cref="ScreenX"/> and <see cref="ScreenY"/> provide
|
||||
/// the screen-relative offset of these coordinates, enabling the grabbed view to know how much the
|
||||
/// The <see cref="X"/> and <see cref="Y"/> properties are always <see cref="View.Bounds"/>-relative. When the mouse is grabbed by a view,
|
||||
/// <see cref="ScreenPosition"/> provides the mouse position screen-relative coordinates, enabling the grabbed view to know how much the
|
||||
/// mouse has moved.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public int ScreenX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The screen-relative mouse coordinate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Calculated and processed in <see cref="Application.OnMouseEvent(MouseEventEventArgs)"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The View that has called <see cref="Application.GrabMouse"/> will receive all mouse events
|
||||
/// with <see cref="View.Bounds"/>-relative coordinates. <see cref="ScreenX"/> and <see cref="ScreenY"/> provide
|
||||
/// the screen-relative offset of these coordinates, enabling the grabbed view to know how much the
|
||||
/// mouse has moved.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public int ScreenY { get; set; }
|
||||
public Point ScreenPosition { get; set; }
|
||||
|
||||
/// <summary>Returns a <see cref="T:System.String"/> that represents the current <see cref="MouseEvent"/>.</summary>
|
||||
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="MouseEvent"/>.</returns>
|
||||
|
||||
@@ -221,9 +221,7 @@ public class Adornment : View
|
||||
if (Thickness.Contains (Frame, mouseEvent.X, mouseEvent.Y) && mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed))
|
||||
{
|
||||
_startGrabPoint = new (mouseEvent.X, mouseEvent.Y);
|
||||
nx = mouseEvent.ScreenX;
|
||||
ny = mouseEvent.ScreenY;
|
||||
_dragPosition = new Point (nx, ny);
|
||||
_dragPosition = new (mouseEvent.X, mouseEvent.Y);
|
||||
Application.GrabMouse (this);
|
||||
}
|
||||
|
||||
@@ -246,7 +244,7 @@ public class Adornment : View
|
||||
|
||||
_dragPosition = new Point (mouseEvent.X, mouseEvent.Y);
|
||||
|
||||
var parentLoc = Parent.SuperView?.ScreenToBounds (mouseEvent.ScreenX, mouseEvent.ScreenY) ?? new (mouseEvent.ScreenX, mouseEvent.ScreenY);
|
||||
var parentLoc = Parent.SuperView?.ScreenToBounds (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y) ?? mouseEvent.ScreenPosition;
|
||||
GetLocationThatFits (
|
||||
Parent,
|
||||
parentLoc.X - _startGrabPoint.X,
|
||||
|
||||
Reference in New Issue
Block a user