MCPcopy Create free account
hub / github.com/comaps/comaps / Update

Method Update

libs/drape_frontend/gui/compass.cpp:62–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
99private:
100 Shape::TTapHandler m_tapHandler;

Callers

nothing calls this directly

Calls 9

DegToRadFunction · 0.85
AngleIn2PIFunction · 0.85
ShowAnimatedMethod · 0.80
HideAnimatedMethod · 0.80
UpdateFunction · 0.50
GetAngleMethod · 0.45
IsInUserActionMethod · 0.45
GetTMethod · 0.45
IsFinishedMethod · 0.45

Tested by

no test coverage detected