33
44namespace DCFApixels . Notes . Editors
55{
6+ using static NotesConsts ;
67 [ CustomEditor ( typeof ( Note ) ) ]
78 [ CanEditMultipleObjects ]
89 internal class NoteEditor : Editor
@@ -85,12 +86,11 @@ public override void OnInspectorGUI()
8586 Color defaultColor = GUI . color ;
8687 Color defaultBackgroundColor = GUI . backgroundColor ;
8788
88- AuthorInfo author = Settings . GetAuthorInfoOrDummy ( authorProp . intValue ) ;
89- NoteTypeInfo noteType = Settings . GetNoteTypeInfoOrDummy ( typeProp . intValue ) ;
89+ AuthorInfo author = Settings . GetAuthorInfoOrDummy ( authorProp . hasMultipleDifferentValues ? 0 : authorProp . intValue ) ;
90+ NoteTypeInfo noteType = Settings . GetNoteTypeInfoOrDummy ( typeProp . hasMultipleDifferentValues ? 0 : typeProp . intValue ) ;
9091 Color headerColor = author . color ;
9192 Color bodyColor = noteType . color ;
9293
93- EditorGUI . BeginChangeCheck ( ) ;
9494
9595 Color headerBackColor = NormalizeBackgroundColor ( headerColor ) ;
9696
@@ -145,8 +145,12 @@ public override void OnInspectorGUI()
145145 GUI . color = new Color ( 0.2f , 0.2f , 0.2f ) ;
146146
147147 GUIStyle gUIStylex = new GUIStyle ( EditorStyles . helpBox ) ;
148- heightProp . floatValue = EditorGUILayout . FloatField ( "↕" , heightProp . floatValue , gUIStylex , GUILayout . MaxWidth ( 58 ) ) ;
149- heightProp . floatValue = Mathf . Max ( 20f , heightProp . floatValue ) ;
148+ EditorGUI . BeginChangeCheck ( ) ;
149+ float newHeight = EditorGUILayout . FloatField ( "↕" , heightProp . hasMultipleDifferentValues ? DEFAULT_NOTE_HEIGHT : heightProp . floatValue , gUIStylex , GUILayout . MaxWidth ( 58 ) ) ;
150+ if ( EditorGUI . EndChangeCheck ( ) )
151+ {
152+ heightProp . floatValue = Mathf . Max ( newHeight , MIN_NOTE_HEIGHT ) ;
153+ }
150154 EditorGUIUtility . labelWidth = originalValue ;
151155
152156
@@ -160,11 +164,16 @@ public override void OnInspectorGUI()
160164
161165 GUILayout . Box ( _lineTex , GUILayout . Height ( 1 ) , GUILayout . ExpandWidth ( true ) ) ;
162166
163- textProp . stringValue = EditorGUILayout . TextArea ( textProp . stringValue , areastyle , GUILayout . Height ( heightProp . floatValue ) ) ;
167+ EditorGUI . BeginChangeCheck ( ) ;
168+ string newValue = EditorGUILayout . TextArea ( textProp . hasMultipleDifferentValues ? "-" : textProp . stringValue , areastyle , GUILayout . Height ( heightProp . floatValue ) ) ;
169+ if ( EditorGUI . EndChangeCheck ( ) )
170+ {
171+ textProp . stringValue = newValue ;
172+ }
173+
164174 GUI . backgroundColor = defaultBackgroundColor ;
165175
166176 serializedObject . ApplyModifiedProperties ( ) ;
167- EditorGUI . EndChangeCheck ( ) ;
168177 }
169178
170179 private void DrawNote ( Note target , SerializedObject serializedObject )
0 commit comments