In This Article

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

TagSnapshotRange<IIntraTextSpacerTag>

Location

The Point for which the hit test result was created, relative to the SyntaxEditor.

Point Location { get; }

Property Value

Point

Offset

The zero-based offset within the Snapshot that is directly under the Location, or closest to it.

int Offset { get; }

Property Value

int

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

TextPosition?

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.

ITextSnapshot? Snapshot { get; }

Property Value

ITextSnapshot

SyntaxEditor

The SyntaxEditor() that was hit tested.

SyntaxEditor SyntaxEditor { get; }

Property Value

SyntaxEditor

TextAreaLocation

The Location value but in Point relative to the View's text area.

Point TextAreaLocation { get; }

Property Value

Point

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.

HitTestResultType Type { get; }

Property Value

HitTestResultType

View

The IEditorView, if any, that the Location is over.

IEditorView? View { get; }

Property Value

IEditorView

ViewLine

The ITextViewLine that contains the Position.

ITextViewLine? ViewLine { get; }

Property Value

ITextViewLine

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.

IEditorViewMargin? ViewMargin { get; }

Property Value

IEditorViewMargin

VisualElement

The IUIElement, if any, that is related to the hit test result.

IUIElement? VisualElement { get; }

Property Value

IUIElement

Methods

GetReader()

Returns an ITextSnapshotReader that is initialized to the Offset and allows for reading of nearby text and tokens.

ITextSnapshotReader? GetReader()

Returns

ITextSnapshotReader

Extension Methods