protected override bool DisableHoverClick(TransformEventData data) { if (!enableFistHover) { return(false); } #if !CP_ORION LeapMotionEventData ldata = data as LeapMotionEventData; if (ldata == null) { return(false); } float radius = ldata.hand.GetLeapHand().SphereRadius; //Debug.Log("fist radius " + radius); bool hasFist = radius < 40f; if (hasFist && !ldata.hadFist) { print("reseting time for fist"); // Reset the time since entered. ldata.timeSinceEntered = Time.unscaledTime; } if (!hasFist && ldata.hadFist) { ldata.SetProgress(0f); ldata.timeSinceEntered = Time.unscaledTime; } ldata.hadFist = hasFist; return(!hasFist); #else return(false); #endif }
/* The open source code says this is protected but with Unity 4.6.1, * it's not callable from an inherited. Returns true if created, * false otherwise.*/ protected new bool GetPointerData(int id, out PointerEventData data, bool create) { if (!m_PointerData.TryGetValue(id, out data) && create) { data = new LeapMotionEventData(eventSystem) { pointerId = id, }; m_PointerData.Add(id, data); return(true); } return(false); }