forked from organicmaps/organicmaps
Fixed line selection
This commit is contained in:
parent
cd925ba45a
commit
643a0af466
5 changed files with 25 additions and 10 deletions
|
@ -540,10 +540,11 @@ void DrapeEngine::SetUserPositionPendingTimeoutListener(UserPositionPendingTimeo
|
|||
}
|
||||
|
||||
void DrapeEngine::SelectObject(SelectionShape::ESelectedObject obj, m2::PointD const & pt,
|
||||
FeatureID const & featureId, bool isAnim)
|
||||
FeatureID const & featureId, bool isAnim, bool isGeometrySelectionAllowed)
|
||||
{
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<SelectObjectMessage>(obj, pt, featureId, isAnim),
|
||||
make_unique_dp<SelectObjectMessage>(obj, pt, featureId,
|
||||
isAnim, isGeometrySelectionAllowed),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
void SetUserPositionPendingTimeoutListener(UserPositionPendingTimeoutHandler && fn);
|
||||
|
||||
void SelectObject(SelectionShape::ESelectedObject obj, m2::PointD const & pt,
|
||||
FeatureID const & featureID, bool isAnim);
|
||||
FeatureID const & featureID, bool isAnim, bool isGeometrySelectionAllowed);
|
||||
void DeselectObject();
|
||||
|
||||
dp::DrapeID AddSubroute(SubrouteConstPtr subroute);
|
||||
|
|
|
@ -506,7 +506,8 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
|
|||
if (m_selectionShape == nullptr)
|
||||
{
|
||||
m_selectObjectMessage = make_unique_dp<SelectObjectMessage>(msg->GetSelectedObject(), msg->GetPosition(),
|
||||
msg->GetFeatureID(), msg->IsAnim());
|
||||
msg->GetFeatureID(), msg->IsAnim(),
|
||||
msg->IsGeometrySelectionAllowed());
|
||||
break;
|
||||
}
|
||||
ProcessSelection(msg);
|
||||
|
@ -1343,10 +1344,13 @@ void FrontendRenderer::ProcessSelection(ref_ptr<SelectObjectMessage> msg)
|
|||
m_selectionTrackInfo = SelectionTrackInfo(modelView.GlobalRect(), startPosition);
|
||||
}
|
||||
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<CheckSelectionGeometryMessage>(
|
||||
msg->GetFeatureID(), m_selectionShape->GetRecacheId()),
|
||||
MessagePriority::Normal);
|
||||
if (msg->IsGeometrySelectionAllowed())
|
||||
{
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<CheckSelectionGeometryMessage>(
|
||||
msg->GetFeatureID(), m_selectionShape->GetRecacheId()),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -534,12 +534,14 @@ public:
|
|||
{}
|
||||
|
||||
SelectObjectMessage(SelectionShape::ESelectedObject selectedObject,
|
||||
m2::PointD const & glbPoint, FeatureID const & featureID, bool isAnim)
|
||||
m2::PointD const & glbPoint, FeatureID const & featureID,
|
||||
bool isAnim, bool isGeometrySelectionAllowed)
|
||||
: m_selected(selectedObject)
|
||||
, m_glbPoint(glbPoint)
|
||||
, m_featureID(featureID)
|
||||
, m_isAnim(isAnim)
|
||||
, m_isDismiss(false)
|
||||
, m_isGeometrySelectionAllowed(isGeometrySelectionAllowed)
|
||||
{}
|
||||
|
||||
Type GetType() const override { return Type::SelectObject; }
|
||||
|
@ -550,6 +552,7 @@ public:
|
|||
FeatureID const & GetFeatureID() const { return m_featureID; }
|
||||
bool IsAnim() const { return m_isAnim; }
|
||||
bool IsDismiss() const { return m_isDismiss; }
|
||||
bool IsGeometrySelectionAllowed() const { return m_isGeometrySelectionAllowed; }
|
||||
|
||||
private:
|
||||
SelectionShape::ESelectedObject m_selected;
|
||||
|
@ -557,6 +560,7 @@ private:
|
|||
FeatureID m_featureID;
|
||||
bool m_isAnim;
|
||||
bool m_isDismiss;
|
||||
bool m_isGeometrySelectionAllowed;
|
||||
};
|
||||
|
||||
class CheckSelectionGeometryMessage : public Message
|
||||
|
|
|
@ -2409,7 +2409,13 @@ void Framework::ActivateMapSelection(bool needAnimation, df::SelectionShape::ESe
|
|||
ASSERT_NOT_EQUAL(selectionType, df::SelectionShape::OBJECT_EMPTY, ("Empty selections are impossible."));
|
||||
m_selectedFeature = info.GetID();
|
||||
if (m_drapeEngine != nullptr)
|
||||
m_drapeEngine->SelectObject(selectionType, info.GetMercator(), info.GetID(), needAnimation);
|
||||
{
|
||||
bool isGeometrySelectionAllowed = false;
|
||||
if (!m_lastTapEvent || !m_lastTapEvent->m_info.m_isLong)
|
||||
isGeometrySelectionAllowed = true;
|
||||
m_drapeEngine->SelectObject(selectionType, info.GetMercator(), info.GetID(), needAnimation,
|
||||
isGeometrySelectionAllowed);
|
||||
}
|
||||
|
||||
SetDisplacementMode(DisplacementModeManager::SLOT_MAP_SELECTION,
|
||||
ftypes::IsHotelChecker::Instance()(info.GetTypes()) /* show */);
|
||||
|
|
Loading…
Add table
Reference in a new issue