internal static void DoMinMaxSlider(Rect position, int id, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz) { Event current = Event.current; bool flag = size == 0f; float num = Mathf.Min(visualStart, visualEnd); float num2 = Mathf.Max(visualStart, visualEnd); float num3 = Mathf.Min(startLimit, endLimit); float num4 = Mathf.Max(startLimit, endLimit); EditorGUIExt.MinMaxSliderState minMaxSliderState = EditorGUIExt.s_MinMaxSliderState; if (GUIUtility.hotControl == id && minMaxSliderState != null) { num = minMaxSliderState.dragStartLimit; num3 = minMaxSliderState.dragStartLimit; num2 = minMaxSliderState.dragEndLimit; num4 = minMaxSliderState.dragEndLimit; } float num5 = 0f; float num6 = Mathf.Clamp(value, num, num2); float num7 = Mathf.Clamp(value + size, num, num2) - num6; float num8 = (float)((visualStart <= visualEnd) ? 1 : -1); if (slider != null && thumb != null) { float num10; Rect position2; Rect rect; Rect rect2; float num11; if (horiz) { float num9 = (thumb.fixedWidth == 0f) ? ((float)thumb.padding.horizontal) : thumb.fixedWidth; num10 = (position.width - (float)slider.padding.horizontal - num9) / (num2 - num); position2 = new Rect((num6 - num) * num10 + position.x + (float)slider.padding.left, position.y + (float)slider.padding.top, num7 * num10 + num9, position.height - (float)slider.padding.vertical); rect = new Rect(position2.x, position2.y, (float)thumb.padding.left, position2.height); rect2 = new Rect(position2.xMax - (float)thumb.padding.right, position2.y, (float)thumb.padding.right, position2.height); num11 = current.mousePosition.x - position.x; } else { float num12 = (thumb.fixedHeight == 0f) ? ((float)thumb.padding.vertical) : thumb.fixedHeight; num10 = (position.height - (float)slider.padding.vertical - num12) / (num2 - num); position2 = new Rect(position.x + (float)slider.padding.left, (num6 - num) * num10 + position.y + (float)slider.padding.top, position.width - (float)slider.padding.horizontal, num7 * num10 + num12); rect = new Rect(position2.x, position2.y, position2.width, (float)thumb.padding.top); rect2 = new Rect(position2.x, position2.yMax - (float)thumb.padding.bottom, position2.width, (float)thumb.padding.bottom); num11 = current.mousePosition.y - position.y; } switch (current.GetTypeForControl(id)) { case EventType.MouseDown: if (position.Contains(current.mousePosition) && num - num2 != 0f) { if (minMaxSliderState == null) { minMaxSliderState = (EditorGUIExt.s_MinMaxSliderState = new EditorGUIExt.MinMaxSliderState()); } minMaxSliderState.dragStartLimit = startLimit; minMaxSliderState.dragEndLimit = endLimit; if (position2.Contains(current.mousePosition)) { minMaxSliderState.dragStartPos = num11; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num10; if (rect.Contains(current.mousePosition)) { minMaxSliderState.whereWeDrag = 1; } else if (rect2.Contains(current.mousePosition)) { minMaxSliderState.whereWeDrag = 2; } else { minMaxSliderState.whereWeDrag = 0; } GUIUtility.hotControl = id; current.Use(); } else if (slider != GUIStyle.none) { if (size != 0f && flag) { if (horiz) { if (num11 > position2.xMax - position.x) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } else if (num11 > position2.yMax - position.y) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } minMaxSliderState.whereWeDrag = 0; GUI.changed = true; EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kFirstScrollWait); float num13 = (!horiz) ? current.mousePosition.y : current.mousePosition.x; float num14 = (!horiz) ? position2.y : position2.x; minMaxSliderState.whereWeDrag = ((num13 <= num14) ? 3 : 4); } else { if (horiz) { value = (num11 - position2.width * 0.5f) / num10 + num - size * 0.5f; } else { value = (num11 - position2.height * 0.5f) / num10 + num - size * 0.5f; } minMaxSliderState.dragStartPos = num11; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num10; minMaxSliderState.whereWeDrag = 0; GUI.changed = true; } GUIUtility.hotControl = id; value = Mathf.Clamp(value, num3, num4 - size); current.Use(); } } break; case EventType.MouseUp: if (GUIUtility.hotControl == id) { current.Use(); GUIUtility.hotControl = 0; } break; case EventType.MouseDrag: if (GUIUtility.hotControl == id) { float num15 = (num11 - minMaxSliderState.dragStartPos) / minMaxSliderState.dragStartValuesPerPixel; int whereWeDrag = minMaxSliderState.whereWeDrag; if (whereWeDrag != 0) { if (whereWeDrag != 1) { if (whereWeDrag == 2) { size = minMaxSliderState.dragStartSize + num15; if (value + size > num4) { size = num4 - value; } if (size < num5) { size = num5; } } } else { value = minMaxSliderState.dragStartValue + num15; size = minMaxSliderState.dragStartSize - num15; if (value < num3) { size -= num3 - value; value = num3; } if (size < num5) { value -= num5 - size; size = num5; } } } else { value = Mathf.Clamp(minMaxSliderState.dragStartValue + num15, num3, num4 - size); } GUI.changed = true; current.Use(); } break; case EventType.Repaint: slider.Draw(position, GUIContent.none, id); thumb.Draw(position2, GUIContent.none, id); if (GUIUtility.hotControl == id && position.Contains(current.mousePosition) && num - num2 != 0f) { if (position2.Contains(current.mousePosition)) { if (minMaxSliderState != null && (minMaxSliderState.whereWeDrag == 3 || minMaxSliderState.whereWeDrag == 4)) { GUIUtility.hotControl = 0; } } else if (!(DateTime.Now < EditorGUIExt.s_NextScrollStepTime)) { float num13 = (!horiz) ? current.mousePosition.y : current.mousePosition.x; float num14 = (!horiz) ? position2.y : position2.x; int num16 = (num13 <= num14) ? 3 : 4; if (num16 == minMaxSliderState.whereWeDrag) { if (size != 0f && flag) { if (horiz) { if (num11 > position2.xMax - position.x) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } else if (num11 > position2.yMax - position.y) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } minMaxSliderState.whereWeDrag = -1; GUI.changed = true; } value = Mathf.Clamp(value, num3, num4 - size); EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kScrollWait); } } } break; } } }
internal static void DoMinMaxSlider(Rect position, int id, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz) { Event current = Event.current; bool flag = size == 0f; float num = Mathf.Min(visualStart, visualEnd); float num2 = Mathf.Max(visualStart, visualEnd); float num3 = Mathf.Min(startLimit, endLimit); float num4 = Mathf.Max(startLimit, endLimit); EditorGUIExt.MinMaxSliderState minMaxSliderState = EditorGUIExt.s_MinMaxSliderState; if (GUIUtility.hotControl == id && minMaxSliderState != null) { num = minMaxSliderState.dragStartLimit; num3 = minMaxSliderState.dragStartLimit; num2 = minMaxSliderState.dragEndLimit; num4 = minMaxSliderState.dragEndLimit; } float num5 = 0f; float num6 = Mathf.Clamp(value, num, num2); float num7 = Mathf.Clamp(value + size, num, num2) - num6; float num8 = (float)((visualStart <= visualEnd) ? 1 : -1); if (slider == null || thumb == null) { return; } float num10; Rect position2; Rect rect; Rect rect2; float num11; if (horiz) { float num9 = (thumb.fixedWidth == 0f) ? ((float)thumb.padding.horizontal) : thumb.fixedWidth; num10 = (position.width - (float)slider.padding.horizontal - num9) / (num2 - num); position2 = new Rect((num6 - num) * num10 + position.x + (float)slider.padding.left, position.y + (float)slider.padding.top, num7 * num10 + num9, position.height - (float)slider.padding.vertical); rect = new Rect(position2.x, position2.y, (float)thumb.padding.left, position2.height); rect2 = new Rect(position2.xMax - (float)thumb.padding.right, position2.y, (float)thumb.padding.right, position2.height); num11 = current.mousePosition.x - position.x; } else { float num12 = (thumb.fixedHeight == 0f) ? ((float)thumb.padding.vertical) : thumb.fixedHeight; num10 = (position.height - (float)slider.padding.vertical - num12) / (num2 - num); position2 = new Rect(position.x + (float)slider.padding.left, (num6 - num) * num10 + position.y + (float)slider.padding.top, position.width - (float)slider.padding.horizontal, num7 * num10 + num12); rect = new Rect(position2.x, position2.y, position2.width, (float)thumb.padding.top); rect2 = new Rect(position2.x, position2.yMax - (float)thumb.padding.bottom, position2.width, (float)thumb.padding.bottom); num11 = current.mousePosition.y - position.y; } switch (current.GetTypeForControl(id)) { case EventType.MouseDown: if (!position.Contains(current.mousePosition) || num - num2 == 0f) { return; } if (minMaxSliderState == null) { minMaxSliderState = (EditorGUIExt.s_MinMaxSliderState = new EditorGUIExt.MinMaxSliderState()); } minMaxSliderState.dragStartLimit = startLimit; minMaxSliderState.dragEndLimit = endLimit; if (position2.Contains(current.mousePosition)) { minMaxSliderState.dragStartPos = num11; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num10; if (rect.Contains(current.mousePosition)) { minMaxSliderState.whereWeDrag = 1; } else { if (rect2.Contains(current.mousePosition)) { minMaxSliderState.whereWeDrag = 2; } else { minMaxSliderState.whereWeDrag = 0; } } GUIUtility.hotControl = id; current.Use(); return; } if (slider == GUIStyle.none) { return; } if (size != 0f && flag) { if (horiz) { if (num11 > position2.xMax - position.x) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } else { if (num11 > position2.yMax - position.y) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } minMaxSliderState.whereWeDrag = 0; GUI.changed = true; EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kFirstScrollWait); float num13 = (!horiz) ? current.mousePosition.y : current.mousePosition.x; float num14 = (!horiz) ? position2.y : position2.x; minMaxSliderState.whereWeDrag = ((num13 <= num14) ? 3 : 4); } else { if (horiz) { value = (num11 - position2.width * 0.5f) / num10 + num - size * 0.5f; } else { value = (num11 - position2.height * 0.5f) / num10 + num - size * 0.5f; } minMaxSliderState.dragStartPos = num11; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num10; minMaxSliderState.whereWeDrag = 0; GUI.changed = true; } GUIUtility.hotControl = id; value = Mathf.Clamp(value, num3, num4 - size); current.Use(); return; case EventType.MouseUp: if (GUIUtility.hotControl == id) { current.Use(); GUIUtility.hotControl = 0; } break; case EventType.MouseDrag: { if (GUIUtility.hotControl != id) { return; } float num15 = (num11 - minMaxSliderState.dragStartPos) / minMaxSliderState.dragStartValuesPerPixel; switch (minMaxSliderState.whereWeDrag) { case 0: value = Mathf.Clamp(minMaxSliderState.dragStartValue + num15, num3, num4 - size); break; case 1: value = minMaxSliderState.dragStartValue + num15; size = minMaxSliderState.dragStartSize - num15; if (value < num3) { size -= num3 - value; value = num3; } if (size < num5) { value -= num5 - size; size = num5; } break; case 2: size = minMaxSliderState.dragStartSize + num15; if (value + size > num4) { size = num4 - value; } if (size < num5) { size = num5; } break; } GUI.changed = true; current.Use(); break; } case EventType.Repaint: { slider.Draw(position, GUIContent.none, id); thumb.Draw(position2, GUIContent.none, id); if (GUIUtility.hotControl != id || !position.Contains(current.mousePosition) || num - num2 == 0f) { return; } if (position2.Contains(current.mousePosition)) { if (minMaxSliderState != null && (minMaxSliderState.whereWeDrag == 3 || minMaxSliderState.whereWeDrag == 4)) { GUIUtility.hotControl = 0; } return; } if (DateTime.Now < EditorGUIExt.s_NextScrollStepTime) { return; } float num13 = (!horiz) ? current.mousePosition.y : current.mousePosition.x; float num14 = (!horiz) ? position2.y : position2.x; int num16 = (num13 <= num14) ? 3 : 4; if (num16 != minMaxSliderState.whereWeDrag) { return; } if (size != 0f && flag) { if (horiz) { if (num11 > position2.xMax - position.x) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } else { if (num11 > position2.yMax - position.y) { value += size * num8 * 0.9f; } else { value -= size * num8 * 0.9f; } } minMaxSliderState.whereWeDrag = -1; GUI.changed = true; } value = Mathf.Clamp(value, num3, num4 - size); EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kScrollWait); break; } } }
internal static void DoMinMaxSlider(Rect position, int id, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz) { Event current = Event.current; bool flag = (double)size == 0.0; float min1 = Mathf.Min(visualStart, visualEnd); float max = Mathf.Max(visualStart, visualEnd); float min2 = Mathf.Min(startLimit, endLimit); float num1 = Mathf.Max(startLimit, endLimit); EditorGUIExt.MinMaxSliderState minMaxSliderState = EditorGUIExt.s_MinMaxSliderState; if (GUIUtility.hotControl == id && minMaxSliderState != null) { min1 = minMaxSliderState.dragStartLimit; min2 = minMaxSliderState.dragStartLimit; max = minMaxSliderState.dragEndLimit; num1 = minMaxSliderState.dragEndLimit; } float num2 = 0.0f; float num3 = Mathf.Clamp(value, min1, max); float num4 = Mathf.Clamp(value + size, min1, max) - num3; float num5 = (double)visualStart <= (double)visualEnd ? 1f : -1f; if (slider == null || thumb == null) { return; } float num6; Rect position1; Rect rect1; Rect rect2; float num7; if (horiz) { float num8 = (double)thumb.fixedWidth == 0.0 ? (float)thumb.padding.horizontal : thumb.fixedWidth; num6 = (float)(((double)position.width - (double)slider.padding.horizontal - (double)num8) / ((double)max - (double)min1)); position1 = new Rect((num3 - min1) * num6 + position.x + (float)slider.padding.left, position.y + (float)slider.padding.top, num4 * num6 + num8, position.height - (float)slider.padding.vertical); rect1 = new Rect(position1.x, position1.y, (float)thumb.padding.left, position1.height); rect2 = new Rect(position1.xMax - (float)thumb.padding.right, position1.y, (float)thumb.padding.right, position1.height); num7 = current.mousePosition.x - position.x; } else { float num8 = (double)thumb.fixedHeight == 0.0 ? (float)thumb.padding.vertical : thumb.fixedHeight; num6 = (float)(((double)position.height - (double)slider.padding.vertical - (double)num8) / ((double)max - (double)min1)); position1 = new Rect(position.x + (float)slider.padding.left, (num3 - min1) * num6 + position.y + (float)slider.padding.top, position.width - (float)slider.padding.horizontal, num4 * num6 + num8); rect1 = new Rect(position1.x, position1.y, position1.width, (float)thumb.padding.top); rect2 = new Rect(position1.x, position1.yMax - (float)thumb.padding.bottom, position1.width, (float)thumb.padding.bottom); num7 = current.mousePosition.y - position.y; } switch (current.GetTypeForControl(id)) { case EventType.MouseDown: if (!position.Contains(current.mousePosition) || (double)min1 - (double)max == 0.0) { break; } if (minMaxSliderState == null) { minMaxSliderState = EditorGUIExt.s_MinMaxSliderState = new EditorGUIExt.MinMaxSliderState(); } minMaxSliderState.dragStartLimit = startLimit; minMaxSliderState.dragEndLimit = endLimit; if (position1.Contains(current.mousePosition)) { minMaxSliderState.dragStartPos = num7; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num6; minMaxSliderState.whereWeDrag = !rect1.Contains(current.mousePosition) ? (!rect2.Contains(current.mousePosition) ? 0 : 2) : 1; GUIUtility.hotControl = id; current.Use(); break; } if (slider == GUIStyle.none) { break; } if ((double)size != 0.0 && flag) { value = !horiz ? ((double)num7 <= (double)position1.yMax - (double)position.y ? value - (float)((double)size * (double)num5 * 0.899999976158142) : value + (float)((double)size * (double)num5 * 0.899999976158142)) : ((double)num7 <= (double)position1.xMax - (double)position.x ? value - (float)((double)size * (double)num5 * 0.899999976158142) : value + (float)((double)size * (double)num5 * 0.899999976158142)); minMaxSliderState.whereWeDrag = 0; GUI.changed = true; EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kFirstScrollWait); float num8 = !horiz ? current.mousePosition.y : current.mousePosition.x; float num9 = !horiz ? position1.y : position1.x; minMaxSliderState.whereWeDrag = (double)num8 <= (double)num9 ? 3 : 4; } else { value = !horiz ? (float)(((double)num7 - (double)position1.height * 0.5) / (double)num6 + (double)min1 - (double)size * 0.5) : (float)(((double)num7 - (double)position1.width * 0.5) / (double)num6 + (double)min1 - (double)size * 0.5); minMaxSliderState.dragStartPos = num7; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num6; minMaxSliderState.whereWeDrag = 0; GUI.changed = true; } GUIUtility.hotControl = id; value = Mathf.Clamp(value, min2, num1 - size); current.Use(); break; case EventType.MouseUp: if (GUIUtility.hotControl != id) { break; } current.Use(); GUIUtility.hotControl = 0; break; case EventType.MouseDrag: if (GUIUtility.hotControl != id) { break; } float num10 = (num7 - minMaxSliderState.dragStartPos) / minMaxSliderState.dragStartValuesPerPixel; switch (minMaxSliderState.whereWeDrag) { case 0: value = Mathf.Clamp(minMaxSliderState.dragStartValue + num10, min2, num1 - size); break; case 1: value = minMaxSliderState.dragStartValue + num10; size = minMaxSliderState.dragStartSize - num10; if ((double)value < (double)min2) { size = size - (min2 - value); value = min2; } if ((double)size < (double)num2) { value = value - (num2 - size); size = num2; break; } break; case 2: size = minMaxSliderState.dragStartSize + num10; if ((double)value + (double)size > (double)num1) { size = num1 - value; } if ((double)size < (double)num2) { size = num2; break; } break; } GUI.changed = true; current.Use(); break; case EventType.Repaint: slider.Draw(position, GUIContent.none, id); thumb.Draw(position1, GUIContent.none, id); if (GUIUtility.hotControl != id || !position.Contains(current.mousePosition) || (double)min1 - (double)max == 0.0) { break; } if (position1.Contains(current.mousePosition)) { if (minMaxSliderState == null || minMaxSliderState.whereWeDrag != 3 && minMaxSliderState.whereWeDrag != 4) { break; } GUIUtility.hotControl = 0; break; } if (DateTime.Now < EditorGUIExt.s_NextScrollStepTime || ((!horiz ? (double)current.mousePosition.y : (double)current.mousePosition.x) <= (!horiz ? (double)position1.y : (double)position1.x) ? 3 : 4) != minMaxSliderState.whereWeDrag) { break; } if ((double)size != 0.0 && flag) { value = !horiz ? ((double)num7 <= (double)position1.yMax - (double)position.y ? value - (float)((double)size * (double)num5 * 0.899999976158142) : value + (float)((double)size * (double)num5 * 0.899999976158142)) : ((double)num7 <= (double)position1.xMax - (double)position.x ? value - (float)((double)size * (double)num5 * 0.899999976158142) : value + (float)((double)size * (double)num5 * 0.899999976158142)); minMaxSliderState.whereWeDrag = -1; GUI.changed = true; } value = Mathf.Clamp(value, min2, num1 - size); EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double)EditorGUIExt.kScrollWait); break; } }
internal static void DoMinMaxSlider(Rect position, int id, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz) { Event current = Event.current; bool flag = (double) size == 0.0; float min1 = Mathf.Min(visualStart, visualEnd); float max = Mathf.Max(visualStart, visualEnd); float min2 = Mathf.Min(startLimit, endLimit); float num1 = Mathf.Max(startLimit, endLimit); EditorGUIExt.MinMaxSliderState minMaxSliderState = EditorGUIExt.s_MinMaxSliderState; if (GUIUtility.hotControl == id && minMaxSliderState != null) { min1 = minMaxSliderState.dragStartLimit; min2 = minMaxSliderState.dragStartLimit; max = minMaxSliderState.dragEndLimit; num1 = minMaxSliderState.dragEndLimit; } float num2 = 0.0f; float num3 = Mathf.Clamp(value, min1, max); float num4 = Mathf.Clamp(value + size, min1, max) - num3; float num5 = (double) visualStart <= (double) visualEnd ? 1f : -1f; if (slider == null || thumb == null) return; float num6; Rect position1; Rect rect1; Rect rect2; float num7; if (horiz) { float num8 = (double) thumb.fixedWidth == 0.0 ? (float) thumb.padding.horizontal : thumb.fixedWidth; num6 = (float) (((double) position.width - (double) slider.padding.horizontal - (double) num8) / ((double) max - (double) min1)); position1 = new Rect((num3 - min1) * num6 + position.x + (float) slider.padding.left, position.y + (float) slider.padding.top, num4 * num6 + num8, position.height - (float) slider.padding.vertical); rect1 = new Rect(position1.x, position1.y, (float) thumb.padding.left, position1.height); rect2 = new Rect(position1.xMax - (float) thumb.padding.right, position1.y, (float) thumb.padding.right, position1.height); num7 = current.mousePosition.x - position.x; } else { float num8 = (double) thumb.fixedHeight == 0.0 ? (float) thumb.padding.vertical : thumb.fixedHeight; num6 = (float) (((double) position.height - (double) slider.padding.vertical - (double) num8) / ((double) max - (double) min1)); position1 = new Rect(position.x + (float) slider.padding.left, (num3 - min1) * num6 + position.y + (float) slider.padding.top, position.width - (float) slider.padding.horizontal, num4 * num6 + num8); rect1 = new Rect(position1.x, position1.y, position1.width, (float) thumb.padding.top); rect2 = new Rect(position1.x, position1.yMax - (float) thumb.padding.bottom, position1.width, (float) thumb.padding.bottom); num7 = current.mousePosition.y - position.y; } switch (current.GetTypeForControl(id)) { case EventType.MouseDown: if (!position.Contains(current.mousePosition) || (double) min1 - (double) max == 0.0) break; if (minMaxSliderState == null) minMaxSliderState = EditorGUIExt.s_MinMaxSliderState = new EditorGUIExt.MinMaxSliderState(); minMaxSliderState.dragStartLimit = startLimit; minMaxSliderState.dragEndLimit = endLimit; if (position1.Contains(current.mousePosition)) { minMaxSliderState.dragStartPos = num7; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num6; minMaxSliderState.whereWeDrag = !rect1.Contains(current.mousePosition) ? (!rect2.Contains(current.mousePosition) ? 0 : 2) : 1; GUIUtility.hotControl = id; current.Use(); break; } if (slider == GUIStyle.none) break; if ((double) size != 0.0 && flag) { value = !horiz ? ((double) num7 <= (double) position1.yMax - (double) position.y ? value - (float) ((double) size * (double) num5 * 0.899999976158142) : value + (float) ((double) size * (double) num5 * 0.899999976158142)) : ((double) num7 <= (double) position1.xMax - (double) position.x ? value - (float) ((double) size * (double) num5 * 0.899999976158142) : value + (float) ((double) size * (double) num5 * 0.899999976158142)); minMaxSliderState.whereWeDrag = 0; GUI.changed = true; EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double) EditorGUIExt.kFirstScrollWait); float num8 = !horiz ? current.mousePosition.y : current.mousePosition.x; float num9 = !horiz ? position1.y : position1.x; minMaxSliderState.whereWeDrag = (double) num8 <= (double) num9 ? 3 : 4; } else { value = !horiz ? (float) (((double) num7 - (double) position1.height * 0.5) / (double) num6 + (double) min1 - (double) size * 0.5) : (float) (((double) num7 - (double) position1.width * 0.5) / (double) num6 + (double) min1 - (double) size * 0.5); minMaxSliderState.dragStartPos = num7; minMaxSliderState.dragStartValue = value; minMaxSliderState.dragStartSize = size; minMaxSliderState.dragStartValuesPerPixel = num6; minMaxSliderState.whereWeDrag = 0; GUI.changed = true; } GUIUtility.hotControl = id; value = Mathf.Clamp(value, min2, num1 - size); current.Use(); break; case EventType.MouseUp: if (GUIUtility.hotControl != id) break; current.Use(); GUIUtility.hotControl = 0; break; case EventType.MouseDrag: if (GUIUtility.hotControl != id) break; float num10 = (num7 - minMaxSliderState.dragStartPos) / minMaxSliderState.dragStartValuesPerPixel; switch (minMaxSliderState.whereWeDrag) { case 0: value = Mathf.Clamp(minMaxSliderState.dragStartValue + num10, min2, num1 - size); break; case 1: value = minMaxSliderState.dragStartValue + num10; size = minMaxSliderState.dragStartSize - num10; if ((double) value < (double) min2) { size = size - (min2 - value); value = min2; } if ((double) size < (double) num2) { value = value - (num2 - size); size = num2; break; } break; case 2: size = minMaxSliderState.dragStartSize + num10; if ((double) value + (double) size > (double) num1) size = num1 - value; if ((double) size < (double) num2) { size = num2; break; } break; } GUI.changed = true; current.Use(); break; case EventType.Repaint: slider.Draw(position, GUIContent.none, id); thumb.Draw(position1, GUIContent.none, id); if (GUIUtility.hotControl != id || !position.Contains(current.mousePosition) || (double) min1 - (double) max == 0.0) break; if (position1.Contains(current.mousePosition)) { if (minMaxSliderState == null || minMaxSliderState.whereWeDrag != 3 && minMaxSliderState.whereWeDrag != 4) break; GUIUtility.hotControl = 0; break; } if (DateTime.Now < EditorGUIExt.s_NextScrollStepTime || ((!horiz ? (double) current.mousePosition.y : (double) current.mousePosition.x) <= (!horiz ? (double) position1.y : (double) position1.x) ? 3 : 4) != minMaxSliderState.whereWeDrag) break; if ((double) size != 0.0 && flag) { value = !horiz ? ((double) num7 <= (double) position1.yMax - (double) position.y ? value - (float) ((double) size * (double) num5 * 0.899999976158142) : value + (float) ((double) size * (double) num5 * 0.899999976158142)) : ((double) num7 <= (double) position1.xMax - (double) position.x ? value - (float) ((double) size * (double) num5 * 0.899999976158142) : value + (float) ((double) size * (double) num5 * 0.899999976158142)); minMaxSliderState.whereWeDrag = -1; GUI.changed = true; } value = Mathf.Clamp(value, min2, num1 - size); EditorGUIExt.s_NextScrollStepTime = DateTime.Now.AddMilliseconds((double) EditorGUIExt.kScrollWait); break; } }