private void AppendPart(MyRichLabelPart part) { m_currentLine = m_lineSeparators[GetIndexSafe(m_lineSeparatorsCount)]; m_currentLine.AddPart(part); m_currentLineRestFreeSpace = m_maxLineWidth - m_currentLine.Size.X; m_sizeDirty = true; }
/// <summary> /// Draws line /// </summary> /// <param name="position">Top-left position</param> /// <returns></returns> public bool Draw(Vector2 position) { Vector2 actualPosition = position; float centerY = position.Y + m_size.Y / 2f; for (int i = 0; i < m_parts.Count; i++) { MyRichLabelPart part = m_parts[i]; Vector2 partSize = part.Size; actualPosition.Y = centerY - partSize.Y / 2f; if ((actualPosition.Y + m_size.Y) < 0) { continue; } if ((actualPosition.Y > 1)) { continue; } if (!part.Draw(actualPosition)) { return(false); } actualPosition.X += partSize.X; } return(true); }
private void RecalculateSize() { Vector2 newSize = new Vector2(0f, m_minLineHeight); for (int i = 0; i < m_parts.Count; i++) { MyRichLabelPart part = m_parts[i]; Vector2 partSize = part.Size; newSize.Y = Math.Max(partSize.Y, newSize.Y); newSize.X += partSize.X; } m_size = newSize; }
private void AppendPart(MyRichLabelPart part) { m_currentLine = m_lines[m_linesCount]; m_currentLine.AddPart(part); m_currentLineRestFreeSpace = m_maxLineWidth - m_currentLine.GetSize().X; }
private void AppendPart(MyRichLabelPart part) { m_currentLine = m_lines[m_linesCount]; m_currentLine.AddPart(part); m_currentLineRestFreeSpace = m_maxLineWidth - m_currentLine.GetSize().X; }
public void AddPart(MyRichLabelPart part) { m_parts.Add(part); RecalculateSize(); }
private void AppendPart(MyRichLabelPart part) { m_currentLine = m_lineSeparators[GetIndexSafe(m_lineSeparatorsCount)]; m_currentLine.AddPart(part); m_currentLineRestFreeSpace = m_maxLineWidth - m_currentLine.Size.X; m_sizeDirty = true; }
public void AddPart(MyRichLabelPart part) { m_parts.Add(part); RecalculateSize(); }