private static void RebuildDisplayIfNeed(DictionaryGUIState state, Inspector.Options options) { if (state.display == null || Event.current.type == EventType.Layout && (state.searchInput.changed || IsKeyChanged(state, options) || state.display.bucketSize != options.listBucketSize || state.display.sort != options.sortFields)) { var display = new DictionaryDisplay(); display.keys = state.Keys(options); display.bucketSize = options.listBucketSize; display.sort = options.sortFields; if (!string.IsNullOrEmpty(state.searchInput.text)) { display.resultKeys = FilterKeys(display.keys, state.searchInput); } else { display.resultKeys = display.keys; } if (options.sortFields) { display.resultKeys = Sorted(display.resultKeys); } state.display = display; } }
private static bool IsKeyChanged(DictionaryGUIState state, Inspector.Options options) { return(state.display != null && !ArrayEqual(state.display.keys, state.Keys(options))); }