public void Init(SDEComponentType componentType, SDEComponent parent, Rect rect, GUIStyle style, GUIStyle defaultStyle, GUIStyle selectedStyle, SDEContainer container = null) { this.componentType = componentType; this.parent = parent; this.container = container; this.rect = rect; // default click rect to be the same as the rect, but only specific component types // will continuously update the clickRect position. this.clickRect = rect; this.style = style; this.defaultStyle = defaultStyle; this.selectedStyle = selectedStyle; }
/* * IsDoubleClick() takes the given time of a click, and determines * if it was a double click or not. * * Timing defined by doubleClickFrame. Both clicks must be on the background * for it to register. */ public static bool IsDoubleClick(float clickTime, Vector2 position, SDEComponentType componentType) { bool ret = false; if (clickTime - lastClickTime < doubleClickFrame) { if (lastClickType == componentType && SelectionManager.SelectedComponentType() == componentType && (position - lastClickPosition).magnitude < clickPositionFrame) { ret = true; } } // update click vars for next cycle lastClickTime = clickTime; lastClickType = SelectionManager.SelectedComponentType(); lastClickPosition = position; return(ret); }