[drape] Allow controlling viewport restoration on DeactivateMapSelection

Signed-off-by: hemanggs <hemangmanhas@gmail.com>
This commit is contained in:
hemanggs
2025-06-08 19:13:12 +05:30
committed by Konstantin Pastbin
parent fc199252eb
commit 90492e95e6
12 changed files with 32 additions and 23 deletions

View File

@@ -562,10 +562,10 @@ void DrapeEngine::SelectObject(SelectionShape::ESelectedObject obj, m2::PointD c
MessagePriority::Normal);
}
void DrapeEngine::DeselectObject()
void DrapeEngine::DeselectObject(bool restoreViewport)
{
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<SelectObjectMessage>(SelectObjectMessage::DismissTag()),
make_unique_dp<SelectObjectMessage>(SelectObjectMessage::DismissTag(), restoreViewport),
MessagePriority::Normal);
}

View File

@@ -173,7 +173,7 @@ public:
void SelectObject(SelectionShape::ESelectedObject obj, m2::PointD const & pt,
FeatureID const & featureID, bool isAnim, bool isGeometrySelectionAllowed,
bool isSelectionShapeVisible);
void DeselectObject();
void DeselectObject(bool restoreViewport);
dp::DrapeID AddSubroute(SubrouteConstPtr subroute);
void RemoveSubroute(dp::DrapeID subrouteId, bool deactivateFollowing);

View File

@@ -1332,7 +1332,7 @@ void FrontendRenderer::ProcessSelection(ref_ptr<SelectObjectMessage> msg)
if (msg->IsDismiss())
{
m_selectionShape->Hide();
if (!m_myPositionController->IsModeChangeViewport() && m_selectionTrackInfo)
if (msg->ShouldRestoreViewport() && !m_myPositionController->IsModeChangeViewport() && m_selectionTrackInfo)
{
AddUserEvent(make_unique_dp<SetAnyRectEvent>(m_selectionTrackInfo->m_startRect,
true /* isAnim */, false /* fitInViewport */,

View File

@@ -534,13 +534,14 @@ class SelectObjectMessage : public Message
public:
struct DismissTag {};
explicit SelectObjectMessage(DismissTag)
explicit SelectObjectMessage(DismissTag, bool restoreViewport)
: m_selected(SelectionShape::OBJECT_EMPTY)
, m_glbPoint(m2::PointD::Zero())
, m_isAnim(false)
, m_isDismiss(true)
, m_isGeometrySelectionAllowed(false)
, m_isSelectionShapeVisible(false)
, m_restoreViewport(restoreViewport)
{}
SelectObjectMessage(SelectionShape::ESelectedObject selectedObject, m2::PointD const & glbPoint,
@@ -565,6 +566,7 @@ public:
bool IsDismiss() const { return m_isDismiss; }
bool IsGeometrySelectionAllowed() const { return m_isGeometrySelectionAllowed; }
bool IsSelectionShapeVisible() const { return m_isSelectionShapeVisible; }
bool ShouldRestoreViewport() const { return m_restoreViewport; }
private:
SelectionShape::ESelectedObject m_selected;
@@ -574,6 +576,7 @@ private:
bool m_isDismiss;
bool m_isGeometrySelectionAllowed;
bool m_isSelectionShapeVisible;
bool m_restoreViewport;
};
class CheckSelectionGeometryMessage : public Message