/// <summary> /// Simply opens the drawer /// </summary> public void DoOpen(/*bool considerOpenPercent = true*/) { if (m_IsAnimating) { return; } StopCoroutine(nameof(LerpPanelCoroutine)); m_CurrentlyActiveDrawer = this; transform.SetAsLastSibling(); ChangeGripWidth(true); m_IsDragging = false; m_FinalX = 0; CalculateOpenPercentAndVeilAlpha(); var timeDelta = Mathf.Max(m_OpenPercent, .55f); var animationSpeed = (m_AnimationSpeed * timeDelta); LerpPanel(animationSpeed, CalculateOpenPercentAndVeilAlpha, () => { m_IsCloseSent = false; if (!m_IsOpenSent) { m_IsOpenSent = true; Open?.Invoke(this); } }); }
private void OnGripPointerDown(InteractiveObject target, PointerEventData eventData) { m_HorSlideBuffer = 0; // m_DragStartPosition = eventData.position; m_IsDragging = false; m_CurMoveSpeed = 0; if (target == m_Grip) { transform.SetAsLastSibling(); m_CurrentlyActiveDrawer = this; var posX = Mathf.Round(m_SidePanel.anchoredPosition.x); // peeping from behind a side on touch if (m_NavigationDrawerPosition == NavigationDrawerPosition.Left) { if (posX <= -m_DrawerWidth) { m_FinalX = -(m_DrawerWidth - m_GripWidth); LerpPanel(m_AnimationSpeed, CalculateOpenPercentAndVeilAlpha); //m_SidePanel.DOAnchorPosX(-(m_DrawerWidth - m_GripWidth), .15f).SetEase(m_Easing).OnUpdate(UpdateVeilAlpha); } } else { if (posX >= m_DrawerWidth) { m_FinalX = m_DrawerWidth - m_GripWidth; LerpPanel(m_AnimationSpeed, CalculateOpenPercentAndVeilAlpha); //m_SidePanel.DOAnchorPosX(m_DrawerWidth - m_GripWidth, .15f).SetEase(m_Easing).OnUpdate(UpdateVeilAlpha); } } } }