Assembly: Esc pref

This commit is contained in:
PaddleStroke
2024-01-30 15:14:32 +01:00
parent 593ce34e02
commit 7d1f1f2143
6 changed files with 103 additions and 4 deletions

View File

@@ -28,6 +28,7 @@
#include <vector>
#include <sstream>
#include <iostream>
#include <Inventor/events/SoKeyboardEvent.h>
#endif
#include <App/Link.h>
@@ -235,6 +236,21 @@ App::DocumentObject* ViewProviderAssembly::getActivePart() const
return activeView->getActiveObject<App::DocumentObject*>(PARTKEY);
}
bool ViewProviderAssembly::keyPressed(bool pressed, int key)
{
if (key == SoKeyboardEvent::ESCAPE) {
if (isInEditMode()) {
ParameterGrp::handle hPgr = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Assembly");
return !hPgr->GetBool("LeaveEditWithEscape", true);
}
}
return false; // handle all other key events
}
bool ViewProviderAssembly::mouseMove(const SbVec2s& cursorPos, Gui::View3DInventorViewer* viewer)
{
// Initialize or end the dragging of parts