// 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(); }
public void OnScroll(PointerEventData data) { if (IsScrollbarAtBottom()) { debugLogManager.SetSnapToBottom(true); } else { debugLogManager.SetSnapToBottom(false); } }
// Force expand the log item at specified index public void SelectAndFocusOnLogItemAtIndex(int itemIndex) { if (indexOfSelectedLogEntry != itemIndex) // Make sure that we aren't deselecting the target log item { OnLogItemClickedInternal(itemIndex); } float transformComponentCenterYAtTop = viewportHeight * 0.5f; float transformComponentCenterYAtBottom = transformComponent.sizeDelta.y - viewportHeight * 0.5f; float transformComponentTargetCenterY = itemIndex * logItemHeight + viewportHeight * 0.5f; if (transformComponentCenterYAtTop == transformComponentCenterYAtBottom) { scrollView.verticalNormalizedPosition = 0.5f; } else { scrollView.verticalNormalizedPosition = Mathf.Clamp01(Mathf.InverseLerp(transformComponentCenterYAtBottom, transformComponentCenterYAtTop, transformComponentTargetCenterY)); } manager.SetSnapToBottom(false); }
public void OnBeginDrag(PointerEventData data) { debugLogManager.SetSnapToBottom(false); }