Skip to content

Commit

Permalink
[drape] Don't change location icon when the map is dragged
Browse files Browse the repository at this point in the history
Keep PendingLocation mode when the user touch or drag the map.

Fixes organicmaps#4376

Signed-off-by: Roman Tsisyk <[email protected]>
  • Loading branch information
rtsisyk authored and vng committed Nov 5, 2023
1 parent dea91e4 commit c19060e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
9 changes: 9 additions & 0 deletions docs/ANDROID_LOCATION_TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ This test-case should work with the same behavior regardless of
dialog should appear immediately, depending in Google Play Service
availability;
- Further taps on location button will lead to (4) or (5).

7. Pending location mode

- Disable Wi-Fi, disable cellular data, and enable location.
- Move your phone away from the open sky and any windows to make sure that GPS can't be acquired.
- If the location search hasn't already begun, press the location button to start it.
- The location icon MUST be "locating" while searching for a GPS signal.
- Press the location button multiple time - the icon MUST NOT change from the "locating" mode.
- Touch, drag or try to zoom in and zoom out the map - the icon MUST NOT change from "locating" mode.
26 changes: 2 additions & 24 deletions drape_frontend/my_position_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ bool MyPositionController::IsModeHasPosition() const
void MyPositionController::DragStarted()
{
m_needBlockAnimation = true;

if (m_mode == location::PendingPosition)
ChangeMode(location::NotFollowNoPosition);
}

void MyPositionController::DragEnded(m2::PointD const & distance)
Expand All @@ -248,9 +245,6 @@ void MyPositionController::ScaleStarted()
{
m_needBlockAnimation = true;
ResetBlockAutoZoomTimer();

if (m_mode == location::PendingPosition)
ChangeMode(location::NotFollowNoPosition);
}

void MyPositionController::ScaleEnded()
Expand All @@ -268,19 +262,14 @@ void MyPositionController::ScaleEnded()

void MyPositionController::Rotated()
{
if (m_mode == location::PendingPosition)
ChangeMode(location::NotFollowNoPosition);
else if (m_mode == location::FollowAndRotate)
if (m_mode == location::FollowAndRotate)
m_wasRotationInScaling = true;
}

void MyPositionController::Scrolled(m2::PointD const & distance)
{
if (m_mode == location::PendingPosition)
{
ChangeMode(location::NotFollowNoPosition);
return;
}

if (distance.Length() > 0)
StopLocationFollow();
Expand Down Expand Up @@ -459,16 +448,8 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool

if (!m_isPositionAssigned)
{
// If the position was never assigned, the new mode will be the desired one except next cases:
ASSERT(m_mode != location::NotFollowNoPosition, ());
location::EMyPositionMode newMode = m_desiredInitMode;
if (m_mode == location::NotFollowNoPosition)
{
// We touch the map during the PendingPosition mode and current mode was converted into NotFollowNoPosition.
// New mode will be NotFollow to prevent spontaneous map snapping.
ResetRoutingNotFollowTimer();
newMode = location::NotFollow;
}

ChangeMode(newMode);

if (!m_hints.m_isFirstLaunch || !AnimationSystem::Instance().AnimationExists(Animation::Object::MapPlane))
Expand Down Expand Up @@ -686,9 +667,6 @@ void MyPositionController::StopLocationFollow()
ChangeMode(location::NotFollow);
m_desiredInitMode = location::NotFollow;

if (m_mode == location::PendingPosition)
ChangeMode(location::NotFollowNoPosition);

ResetRoutingNotFollowTimer();
}

Expand Down

0 comments on commit c19060e

Please sign in to comment.