public static void ApplyToStyle(VisualElement element, WindowBorderState state) { element.style.borderBottomColor = state.bottomColor; element.style.borderTopColor = state.topColor; element.style.borderLeftColor = state.leftColor; element.style.borderRightColor = state.rightColor; }
static void ApplySpikeOverlay(SpikeWindowInfo info, Color spikeColor) { var spikeOverlayParent = info.spikeOverlayParent; if (info.isInspectorElement) { if (info.spikeOverlay == null) { info.spikeOverlay = CreateSpikeOverlay(); info.spikeOverlay.name = info.trackerName; spikeOverlayParent.Add(info.spikeOverlay); } var color = spikeColor; color.a = 0.05f; info.spikeOverlay.style.backgroundColor = color; } else { if (spikeOverlayParent == null) { return; } if (info.spikeOverlay == null) { info.spikeOverlay = CreateSpikeOverlay(); spikeOverlayParent.Add(info.spikeOverlay); } else { // Check if it is still the last element: var childCount = spikeOverlayParent.childCount; if (childCount > 0 && spikeOverlayParent.ElementAt(childCount - 1) == info.spikeOverlay) { // All is good, perf Overlay is the last item. Nothing to do. } else { // Ensure it is last: if (spikeOverlayParent.Contains(info.spikeOverlay)) { spikeOverlayParent.Remove(info.spikeOverlay); } spikeOverlayParent.Add(info.spikeOverlay); } } WindowBorderState.ApplyToStyle(info.spikeOverlay, spikeColor); } info.paintTriggeredByStateChanged = true; if (PerformanceTrackerSettings.spikeHighlightStrategy == SpikeHighlightStrategy.AvgTime) { EditorPerformanceTracker.Reset(info.trackerName); } }