/// <inheritdoc />
        public override bool DrawBody(Rect position)
        {
                        #if SAFE_MODE
            if (label == null)
            {
                Debug.LogError("DrawBody with null label called for " + ToString() + " with parent " + (parent == null ? "null" : parent.ToString()));
                return(false);
            }
                        #endif

            HandleDrawHintIcon(position);

            DrawDragBarIfReorderable();

                        #if DEV_MODE && DEBUG_NULL_FIELD_INFO
            if (fieldInfo == null)
            {
                Debug.LogWarning(GetType().Name + ".DrawBody() - fieldInfo was null!");
            }
                        #endif

            var valueWas = Value;

            DrawDragBarIfReorderable();

            DrawerUtility.BeginFocusableField(this, controlId, ref focusField, MixedContent);
            var setValue = DrawControlVisuals(position, valueWas);
            DrawerUtility.EndFocusableField();

            if (setValue == null)
            {
                if (valueWas == null)
                {
                    return(false);
                }
                Value = default(TValue);
                return(true);
            }

            if (!setValue.Equals(valueWas))
            {
                Value = setValue;
                return(true);
            }

            return(false);
        }
Exemple #2
0
        /// <inheritdoc/>
        public sealed override bool DrawBody(Rect position)
        {
            HandleDrawHintIcon(position);
            DrawDragBarIfReorderable();

            var valueWas = Value;
            var setValue = valueWas;

            if (HasNumberField)
            {
                DrawerUtility.BeginInputField(this, controlId, ref editField, ref focusField, MixedContent);
                setValue = DrawNumberFieldVisuals(NumberFieldPosition, setValue);
                DrawerUtility.EndInputField();
            }

            sliderID = GUIUtility.GetControlID(FocusType.Keyboard);
            DrawerUtility.BeginFocusableField(this, sliderID, ref focusSlider, MixedContent);
            {
                if (DrawGUI.EditingTextField)
                {
                    DrawControlVisuals(SliderPosition, setValue);
                }
                else
                {
                    setValue = DrawControlVisuals(SliderPosition, setValue);
                }
            }
            DrawerUtility.EndFocusableField();

            if (!setValue.Equals(valueWas))
            {
                Value = setValue;
                return(true);
            }

            return(false);
        }