visual tools: Add EndDrag and EndHold hooks
This commit is contained in:
parent
bfdf01df9a
commit
8b142a05e5
2 changed files with 9 additions and 0 deletions
|
@ -208,6 +208,9 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
||||||
else
|
else
|
||||||
SetSelection(active_feature, true);
|
SetSelection(active_feature, true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (auto sel : sel_features)
|
||||||
|
EndDrag(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
active_feature = nullptr;
|
active_feature = nullptr;
|
||||||
|
@ -218,6 +221,7 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
||||||
else if (holding) {
|
else if (holding) {
|
||||||
if (!event.LeftIsDown()) {
|
if (!event.LeftIsDown()) {
|
||||||
holding = false;
|
holding = false;
|
||||||
|
EndHold();
|
||||||
|
|
||||||
parent->ReleaseMouse();
|
parent->ReleaseMouse();
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
|
|
|
@ -166,6 +166,8 @@ private:
|
||||||
virtual bool InitializeHold() { return false; }
|
virtual bool InitializeHold() { return false; }
|
||||||
/// @brief Called on every mouse event during a hold
|
/// @brief Called on every mouse event during a hold
|
||||||
virtual void UpdateHold() { }
|
virtual void UpdateHold() { }
|
||||||
|
/// @brief Called when the hold ended
|
||||||
|
virtual void EndHold() { }
|
||||||
|
|
||||||
/// @brief Called at the beginning of a drag
|
/// @brief Called at the beginning of a drag
|
||||||
/// @param feature The visual feature clicked on
|
/// @param feature The visual feature clicked on
|
||||||
|
@ -174,6 +176,9 @@ private:
|
||||||
/// @brief Called on every mouse event during a drag
|
/// @brief Called on every mouse event during a drag
|
||||||
/// @param feature The current feature to process; not necessarily the one clicked on
|
/// @param feature The current feature to process; not necessarily the one clicked on
|
||||||
virtual void UpdateDrag(FeatureType *feature) { }
|
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:
|
protected:
|
||||||
std::set<FeatureType *> sel_features; ///< Currently selected visual features
|
std::set<FeatureType *> sel_features; ///< Currently selected visual features
|
||||||
|
|
Loading…
Reference in a new issue