private InputData GetInputData(EnumTogglesAttribute attribute, Rect position, Rect prefixPosition) { var toggleWidth = attribute.ToggleWidth; var toggleHeight = attribute.ToggleHeight; var toggleSpacing = attribute.ToggleSpacing; var spacing = EditorGUIUtility.standardVerticalSpacing; var firstRowPosition = new Rect(prefixPosition); firstRowPosition.height = toggleHeight; var otherRowPosition = new Rect(position); otherRowPosition.yMin = firstRowPosition.yMax + spacing; otherRowPosition.yMax = otherRowPosition.yMin + toggleHeight; return(new InputData() { toggleWidth = toggleWidth, toggleHeight = toggleHeight, toggleSpacing = toggleSpacing, spacing = spacing, firstRowPosition = firstRowPosition, otherRowPosition = otherRowPosition }); }
/// <summary> /// Creates potential <see cref="InputData"/> based only on static Window properties and given attribute. /// </summary> private InputData GetInputData(EnumTogglesAttribute attribute) { var inspectorStyle = EditorStyles.inspectorDefaultMargins; var leftPadding = inspectorStyle.padding.left; var otherRowWidth = EditorGUIUtility.currentViewWidth - 2 * leftPadding; var firstRowWidth = EditorGUIUtility.currentViewWidth - 2 * leftPadding - EditorGUIUtility.labelWidth; return(new InputData() { toggleWidth = attribute.ToggleWidth, toggleHeight = attribute.ToggleHeight, toggleSpacing = attribute.ToggleSpacing, spacing = EditorGUIUtility.standardVerticalSpacing, firstRowPosition = new Rect(0, 0, firstRowWidth, 0), otherRowPosition = new Rect(0, 0, otherRowWidth, 0) }); }