void CRotationSlider::OnSliderMoved( int position ) { C_BaseObject *pObj = m_hObject.Get(); if (pObj && pObj->IsPreviewingYaw()) { m_flYaw = anglemod(position); pObj->PreviewYaw( m_flInitialYaw - m_flYaw ); } }
//----------------------------------------------------------------------------- // When the slider is activated, deactivated, or moves //----------------------------------------------------------------------------- void CRotationSlider::OnMousePressed( vgui::MouseCode code ) { BaseClass::OnMousePressed( code ); if (code != vgui::MOUSE_LEFT) return; C_BaseObject *pObj = m_hObject.Get(); if (pObj) { m_flInitialYaw = pObj->GetAbsAngles().y; pObj->PreviewYaw( m_flInitialYaw ); pObj->ActivateYawPreview( true ); } }