public Pair </*repaint*/ bool, /*width*/ float> HandleWidth() { float result = 0; bool repaint = false; if (Event.current != null) { switch (Event.current.rawType) { case EventType.MouseDown: if (LastRect.Contains(Event.current.mousePosition)) { dragging = true; } break; case EventType.MouseDrag: if (dragging) { result = Event.current.delta.x; repaint = true; } break; case EventType.MouseUp: if (dragging) { dragging = false; } break; } } return(PairUtils.MakePair(repaint, result)); }
public static Pair <bool, ReorderableList> GetList(SerializedProperty property, ReorderableAttribute attrib, int id) { if (property == null) { return(new Pair <bool, ReorderableList>(false, null)); } ReorderableList list = null; SerializedProperty array = property.isArray ? property : property.FindPropertyRelative("array"); bool justCreated = false; if (array != null && array.isArray) { if (!lists.TryGetValue(id, out list)) { if (attrib != null) { Texture icon = !string.IsNullOrEmpty(attrib.elementIconPath) ? AssetDatabase.GetCachedIcon(attrib.elementIconPath) : null; ReorderableList.ElementDisplayType displayType = attrib.singleLine ? ReorderableList.ElementDisplayType.SingleLine : ReorderableList.ElementDisplayType.Auto; list = new ReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon); list.paginate = attrib.paginate; list.pageSize = attrib.pageSize; } else { list = new ReorderableList(array, true, true, true); } justCreated = true; lists.Add(id, list); } else { list.List = array; } } return(PairUtils.MakePair(justCreated, list)); }