| 60 | } |
| 61 | |
| 62 | bool Update(ScreenBase const & screen) override |
| 63 | { |
| 64 | static double constexpr kVisibleTolerance = 0.1; |
| 65 | static double constexpr kVisibleStartAngle = math::DegToRad(0.0 + kVisibleTolerance); |
| 66 | static double constexpr kVisibleEndAngle = math::DegToRad(360.0 - kVisibleTolerance); |
| 67 | |
| 68 | auto const angle = static_cast<float>(ang::AngleIn2PI(screen.GetAngle())); |
| 69 | |
| 70 | bool isVisiblePrev = IsVisible(); |
| 71 | bool isVisibleAngle = angle > kVisibleStartAngle && angle < kVisibleEndAngle; |
| 72 | |
| 73 | bool isVisible = isVisibleAngle || (isVisiblePrev && DrapeGui::Instance().IsInUserAction()); |
| 74 | |
| 75 | if (isVisible) |
| 76 | { |
| 77 | m_animation.ShowAnimated(); |
| 78 | SetIsVisible(true); |
| 79 | } |
| 80 | else |
| 81 | m_animation.HideAnimated(); |
| 82 | |
| 83 | if (IsVisible()) |
| 84 | { |
| 85 | TBase::Update(screen); |
| 86 | |
| 87 | glsl::mat4 r = glsl::rotate(glsl::mat4(), angle, glsl::vec3(0.0, 0.0, 1.0)); |
| 88 | glsl::mat4 m = glsl::translate(glsl::mat4(), glsl::vec3(m_pivot, 0.0)); |
| 89 | m_params.m_modelView = glsl::transpose(m * r); |
| 90 | m_params.m_opacity = static_cast<float>(m_animation.GetT()); |
| 91 | } |
| 92 | |
| 93 | if (m_animation.IsFinished()) |
| 94 | SetIsVisible(isVisible); |
| 95 | |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | private: |
| 100 | Shape::TTapHandler m_tapHandler; |
nothing calls this directly
no test coverage detected