-
The api docs are not clear. I've looked at the code that uses these members and just got more confused. Now that View.OnMouseEvent provides 'MouseEvent.X/Y' as Bounds relative I can't even. 😉 |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
There are to provide the mouse position offset from the grabbed view. It's calculated and processed on the |
Beta Was this translation helpful? Give feedback.
-
@BDisp, there are two Views (not including In #3289, I'm asking why Can you help me understand what this code in private int PositionCursor (MouseEvent ev)
{
// We could also set the cursor position.
int x;
int pX = TextModel.GetColFromX (_text, ScrollOffset, ev.X);
if (_text.Count == 0)
{
x = pX - ev.OfX;
}
else
{
x = pX;
}
return PositionCursor (x, false);
} |
Beta Was this translation helpful? Give feedback.
-
Sorry, that's not answering my question. What is the purpose of the |
Beta Was this translation helpful? Give feedback.
-
In I have revamped this API.
/// <summary>
/// The screen-relative mouse position.
/// </summary>
/// <remarks>
/// <para>
/// 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>
/// <para>
/// Calculated and processed in <see cref="Application.OnMouseEvent(MouseEventEventArgs)"/>.
/// </para>
/// </remarks>
public Point ScreenPosition { get; set; } The only |
Beta Was this translation helpful? Give feedback.
-
Late to this party, but my understanding of it was always that it was for relative positioning, sorta like how jQueryUI does various position-related operations. If you treat it fluently, and only use it in the appropriate situation (which isn't an appropriate concept in a statically typed language like C#), you get a sentence like "this event happened It makes no sense for it to be there when it isn't in use, which just makes it a bad concept anyway, since it creates rules that the language cannot enforce. I am a fan of your solution of just no-nonsense position reporting. 👍 |
Beta Was this translation helpful? Give feedback.
There are to provide the mouse position offset from the grabbed view. It's calculated and processed on the
Application
mouse event. If the current mouse position is on another view than the grabbed view, the grabbed view receive the mouse event with view relative coordinate and theOfX/OfY
gives the offset relative on the real mouse position. Thus the grabbed view know how muchX/Y
location it need to scroll. This give to the grabbed view more control about how it need to handled with the new position, to check if it's valid or not and take the right actions.