Example #1
0
    public void AddBlock()
    {
        RichEditBlock block = new RichEditBlock(contentPanel, rectTransform.rect.width, LineSpacing);
        blockList.Add(block);
        block.LayoutGroup.spacing = LineSpacing;

        UpdateHeightForNewBlock(block);

        currentBlock = block;
    }
Example #2
0
 private void UpdateHeightForNewBlock(RichEditBlock block)
 {
     if (currentBlock != null)
     {
         previousHeight += currentBlock.LayoutElement.preferredHeight + BlockSpacing;
     }        
     contentPanel.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, previousHeight + block.LayoutElement.preferredHeight);
 }
Example #3
0
    public void Clear()
    {
        transform.DetachChildren();

        foreach(var block in blockList)
        {
            Destroy(block.GameObject);
        }
        blockList.Clear();

        previousHeight = 0;
        currentBlock = null;
    }