visual tools: Add EndDrag and EndHold hooks

This commit is contained in:
arch1t3cht 2023-01-14 14:14:42 +01:00
parent bfdf01df9a
commit 8b142a05e5
2 changed files with 9 additions and 0 deletions

View file

@ -208,6 +208,9 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
else
SetSelection(active_feature, true);
}
} else {
for (auto sel : sel_features)
EndDrag(sel);
}
active_feature = nullptr;
@ -218,6 +221,7 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
else if (holding) {
if (!event.LeftIsDown()) {
holding = false;
EndHold();
parent->ReleaseMouse();
parent->SetFocus();

View file

@ -166,6 +166,8 @@ private:
virtual bool InitializeHold() { return false; }
/// @brief Called on every mouse event during a hold
virtual void UpdateHold() { }
/// @brief Called when the hold ended
virtual void EndHold() { }
/// @brief Called at the beginning of a drag
/// @param feature The visual feature clicked on
@ -174,6 +176,9 @@ private:
/// @brief Called on every mouse event during a drag
/// @param feature The current feature to process; not necessarily the one clicked on
virtual void UpdateDrag(FeatureType *feature) { }
/// @brief Called at the end of a drag
/// @param feature The current feature to process; not necessarily the one clicked on
virtual void EndDrag(FeatureType *feature) { }
protected:
std::set<FeatureType *> sel_features; ///< Currently selected visual features