/// <summary> /// Draw the connecting line between for single slider. /// </summary> /// <param name="canvas">the Canvas to draw to</param> /// <param name="leftMargin">the right thumb</param> /// <param name="rightThumb">the left margin</param> public void Draw(Canvas canvas, float leftMargin, PinView rightThumb) { try { canvas.DrawLine(leftMargin, this._y, rightThumb.GetX(), this._y, this._paint); } catch (NullReferenceException nullReferenceException) { Log.Error(nameof(ConnectingLine), $"{nameof(Draw)}: {nullReferenceException.Message}"); } }
/// <summary> /// Gets the zero-based index of the nearest tick to the given thumb. /// </summary> /// <param name="thumb">the Thumb to find the nearest tick for</param> /// <returns>the zero-based index of the nearest tick</returns> public int GetNearestTickIndex(PinView thumb) { return((int)((thumb.GetX() - this._leftX + this._tickDistance / 2f) / this._tickDistance)); }