// A log item is clicked, highlight it
        public void OnLogItemClicked(DebugLogItem item)
        {
            if (indexOfSelectedLogEntry != item.Index)
            {
                DeselectSelectedLogItem();

                indexOfSelectedLogEntry       = item.Index;
                positionOfSelectedLogEntry    = item.Index * logItemHeight;
                heightOfSelectedLogEntry      = item.CalculateExpandedHeight(item.ToString());
                deltaHeightOfSelectedLogEntry = heightOfSelectedLogEntry - logItemHeight;

                manager.SetSnapToBottom(false);
            }
            else
            {
                DeselectSelectedLogItem();
            }

            if (indexOfSelectedLogEntry >= currentTopIndex && indexOfSelectedLogEntry <= currentBottomIndex)
            {
                ColorLogItem(logItemsAtIndices[indexOfSelectedLogEntry], indexOfSelectedLogEntry);
            }

            CalculateContentHeight();

            HardResetItems();
            UpdateItemsInTheList(true);

            manager.ValidateScrollPosition();
        }
Beispiel #2
0
        private void OnLogItemClickedInternal(int itemIndex, DebugLogItem referenceItem = null)
        {
            if (indexOfSelectedLogEntry != itemIndex)
            {
                DeselectSelectedLogItem();

                if (!referenceItem)
                {
                    if (currentTopIndex == -1)
                    {
                        UpdateItemsInTheList(false);                           // Try to generate some DebugLogItems, we need one DebugLogItem to calculate the text height
                    }
                    referenceItem = logItemsAtIndices[currentTopIndex];
                }

                indexOfSelectedLogEntry       = itemIndex;
                positionOfSelectedLogEntry    = itemIndex * logItemHeight;
                heightOfSelectedLogEntry      = referenceItem.CalculateExpandedHeight(collapsedLogEntries[indicesOfEntriesToShow[itemIndex]].ToString());
                deltaHeightOfSelectedLogEntry = heightOfSelectedLogEntry - logItemHeight;

                manager.SetSnapToBottom(false);
            }
            else
            {
                DeselectSelectedLogItem();
            }

            if (indexOfSelectedLogEntry >= currentTopIndex && indexOfSelectedLogEntry <= currentBottomIndex)
            {
                ColorLogItem(logItemsAtIndices[indexOfSelectedLogEntry], indexOfSelectedLogEntry);
            }

            CalculateContentHeight();

            HardResetItems();
            UpdateItemsInTheList(true);

            manager.ValidateScrollPosition();
        }