diff --git a/Examples b/Examples
index 7da8fd1..a5914a9 160000
--- a/Examples
+++ b/Examples
@@ -1 +1 @@
-Subproject commit 7da8fd1b9cd0a6cfc420ca42c61e714583c49f18
+Subproject commit a5914a92198efb1422bd66f84e8cde6cb0842b87
diff --git a/README.md b/README.md
index 826c6c7..ceb3cb2 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ There are almost 70+ extension controls / effect and other utilities in the proj
Accordion|ColorPicker|SelectionBox|UIFlippable|ComboBox
AutoCompleteComboBox|DropDownList|BoundToolTip|UIWindowBase|UI_Knob
TextPic|InputFocus|Box Slider|CooldownButton|Segmented Control
-Stepper|Range Slider||
+Stepper|Range Slider|||
||||
[Primitives](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-primitives)|||||
diff --git a/Scripts/Primitives/UILineRenderer.cs b/Scripts/Primitives/UILineRenderer.cs
index 62d2b3e..b6546a1 100644
--- a/Scripts/Primitives/UILineRenderer.cs
+++ b/Scripts/Primitives/UILineRenderer.cs
@@ -378,5 +378,86 @@ namespace UnityEngine.UI.Extensions
lineThickness = activeSprite.rect.height / pixelsPerUnit;
}
}
+
+ private int GetSegmentPointCount()
+ {
+ if (Segments?.Count > 0)
+ {
+ int pointCount = 0;
+ foreach (var segment in Segments)
+ {
+ pointCount += segment.Length;
+ }
+ return pointCount;
+ }
+ return Points.Length;
+ }
+
+ ///
+ /// Get the Vector2 position of a line index
+ ///
+ ///
+ /// Positive numbers should be used to specify Index and Segment
+ ///
+ /// Requied Index of the point, starting from point 1
+ /// (optional) Required Segment the point is held in, Starting from Segment 1
+ /// Vector2 position of the point within UI Space
+ public Vector2 GetPosition(int index, int segmentIndex = 0)
+ {
+ if (segmentIndex > 0)
+ {
+ return Segments[segmentIndex - 1][index - 1];
+ }
+ else if (Segments.Count > 0)
+ {
+ var segmentIndexCount = 0;
+ var indexCount = index;
+ foreach (var segment in Segments)
+ {
+ if (indexCount - segment.Length > 0)
+ {
+ indexCount -= segment.Length;
+ segmentIndexCount += 1;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return Segments[segmentIndexCount][indexCount - 1];
+ }
+ else
+ {
+ return Points[index - 1];
+ }
+ }
+
+ ///
+ /// Get the Vector2 position of a line within a specific segment
+ ///
+ /// Requied Index of the point, starting from point 1
+ /// Required Segment the point is held in, Starting from Segment 1
+ /// Vector2 position of the point within UI Space
+ public Vector2 GetPositionBySegment(int index, int segment)
+ {
+ return Segments[segment][index - 1];
+ }
+
+ ///
+ /// Get the closest point between two given Vector2s from a given Vector2 point
+ ///
+ /// Starting postion
+ /// End position
+ /// Desired / Selected point
+ /// Closest Vector2 position of the target within UI Space
+ public Vector2 GetClosestPoint(Vector2 p1, Vector2 p2, Vector2 p3)
+ {
+ Vector2 from_p1_to_p3 = p3 - p1;
+ Vector2 from_p1_to_p2 = p2 - p1;
+ float dot = Vector2.Dot(from_p1_to_p3, from_p1_to_p2.normalized);
+ dot /= from_p1_to_p2.magnitude;
+ float t = Mathf.Clamp01(dot);
+ return p1 + from_p1_to_p2 * t;
+ }
}
}
\ No newline at end of file