コード例 #1
0
        private float OnMouseDrag()
        {
            float result;

            if (GUIUtility.hotControl != this.id)
            {
                result = this.currentValue;
            }
            else
            {
                SliderState sliderState = this.SliderState();
                if (!sliderState.isDragging)
                {
                    result = this.currentValue;
                }
                else
                {
                    GUI.changed = true;
                    this.CurrentEvent().Use();
                    float num   = this.MousePosition() - sliderState.dragStartPos;
                    float value = sliderState.dragStartValue + num / this.ValuesPerPixel();
                    result = this.Clamp(value);
                }
            }
            return(result);
        }
コード例 #2
0
        private void StartDraggingWithValue(float dragStartValue)
        {
            SliderState sliderState = this.SliderState();

            sliderState.dragStartPos   = this.MousePosition();
            sliderState.dragStartValue = dragStartValue;
            sliderState.isDragging     = true;
        }