public Key GetItemOverMouse() { bool dontDisplayWhenNoTouchOnAndroid = false; #if UNITY_ANDROID || UNITY_IPHONE dontDisplayWhenNoTouchOnAndroid = Input.touchCount < 1; #endif if (!m_ScrollRect.Contains(Input.mousePosition) || dontDisplayWhenNoTouchOnAndroid) { // Debug.Log("Outside of scroller"); return(new Key()); } float currentScrollPos = -m_ScrollPivot.transform.localPosition.x; //prepocitej pozici na screenu na vzdalenost od stredu scrolleru float distToCenter = Input.mousePosition.x - Screen.width / 2; Vector2 layoutTapPos = m_BackgroundLayout.ScreenPosToLayoutSpace(new Vector2(distToCenter, 0)); //todo: vertical scrollbar // int index = (int)((currentScrollPos + layoutTapPos.x + ItemOffset / 2) / ItemOffset); // Debug.Log("TAP: scroller pos " + currentScrollPos + " tap pos: " + pos + " distToCenter " + distToCenter + " layout dist: " + layoutTapPos.x + " index " + index); if (index < 0 || index >= m_Items.Count) { return(new Key()); } return(m_Items[index].m_UID); }