// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Numerics;
namespace SixLabors.Fonts {
///
/// Represents a caret line in laid-out text.
///
public readonly struct CaretPosition
{
///
/// Initializes a new instance of the struct.
///
/// The zero-based line index.
/// The grapheme insertion index in the original text.
/// The UTF-16 index in the original text.
/// The caret start point in pixel units.
/// The caret end point in pixel units.
/// Whether the caret has a second visual position.
/// The secondary caret start point in pixel units.
/// The secondary caret end point in pixel units.
/// The position to preserve when moving between visual lines.
internal CaretPosition(
int lineIndex,
int graphemeIndex,
int stringIndex,
Vector2 start,
Vector2 end,
bool hasSecondary,
Vector2 secondaryStart,
Vector2 secondaryEnd,
float lineNavigationPosition)
{
this.LineIndex = lineIndex;
this.GraphemeIndex = graphemeIndex;
this.StringIndex = stringIndex;
this.Start = start;
this.End = end;
this.HasSecondary = hasSecondary;
this.SecondaryStart = secondaryStart;
this.SecondaryEnd = secondaryEnd;
this.LineNavigationPosition = lineNavigationPosition;
}
///
/// Gets the zero-based line index.
///
public int LineIndex { get; }
///
/// Gets the zero-based grapheme index in the original text.
///
public int GraphemeIndex { get; }
///
/// Gets the zero-based UTF-16 code unit index in the original text.
///
public int StringIndex { get; }
///
/// Gets the caret start point in pixel units.
///
public Vector2 Start { get; }
///
/// Gets the caret end point in pixel units.
///
public Vector2 End { get; }
///
/// Gets a value indicating whether a second visual caret position is available.
///
public bool HasSecondary { get; }
///
/// Gets the secondary caret start point in pixel units.
///
public Vector2 SecondaryStart { get; }
///
/// Gets the secondary caret end point in pixel units.
///
public Vector2 SecondaryEnd { get; }
///
/// Gets the position to preserve when moving between visual lines.
///
internal float LineNavigationPosition { get; }
}
}