IHitTestResult Interface
Provides the base requirements for the hit test results of a call to the SyntaxEditor.HitTest(Point) method.
public interface IHitTestResult
Properties
IntraTextSpacerTag
The intra-text spacer tag range that is directly under the Location, if any.
TagSnapshotRange<IIntraTextSpacerTag>? IntraTextSpacerTag { get; }
Property Value
Location
The Point for which the hit test result was created, relative to the SyntaxEditor.
Offset
int Offset { get; }
Property Value
Remarks
If the Location is directly over a character, the Type property returns ViewTextAreaOverCharacter and this property indicates the offset of the character. Otherwise, the offset of the nearest character is used. For instance, locations over the line number margin will return the offset of the first character in the view line that the mouse is over.
The value will be -1 if the Location is not over an editor view.
Position
The zero-based TextPosition within the Snapshot that is directly under the Location, or closest to it.
TextPosition? Position { get; }
Property Value
Remarks
If the Location is directly over a character, the Type property returns ViewTextAreaOverCharacter and this property indicates the TextPosition of the character. Otherwise, the position of the nearest character is used. For instance, locations over the line number margin will return the position of the first character in the view line that the mouse is over.
The value will be null if the Location is not over an editor view.
Snapshot
The ITextSnapshot that was current within the View when the hit test was performed.
SyntaxEditor
The SyntaxEditor() that was hit tested.
TextAreaLocation
Point TextAreaLocation { get; }
Property Value
Remarks
This location is useful for calls to methods like LocationToPosition(Point, LocationToPositionAlgorithm).
Type
A HitTestResultType that provides a general categorization about what the hit test result represents.
View
The IEditorView, if any, that the Location is over.
ViewLine
The ITextViewLine that contains the Position.
ITextViewLine? ViewLine { get; }
Property Value
Remarks
See the remarks on the Position property for details on how it is populated.
ViewMargin
The IEditorViewMargin, if any, that the Location is over.
VisualElement
The IUIElement, if any, that is related to the hit test result.
Methods
GetReader()
Returns an ITextSnapshotReader that is initialized to the Offset and allows for reading of nearby text and tokens.