Sketcher: fixes #13999
This commit is contained in:
@@ -157,13 +157,15 @@ private:
|
||||
toolWidgetManager.resetControls();
|
||||
}
|
||||
|
||||
void onModeChanged() override
|
||||
bool onModeChanged() override
|
||||
{
|
||||
DrawSketchHandler::resetPositionText();
|
||||
toolWidgetManager.onHandlerModeChanged();
|
||||
DSDefaultHandler::onModeChanged();
|
||||
|
||||
toolWidgetManager.afterHandlerModeChanged();
|
||||
if (DSDefaultHandler::onModeChanged()) {
|
||||
// If onModeChanged returns false, then the handler has been purged.
|
||||
toolWidgetManager.afterHandlerModeChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void onConstructionMethodChanged() override
|
||||
|
||||
@@ -219,7 +219,10 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onModeChanged() {};
|
||||
virtual bool onModeChanged()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
private:
|
||||
SelectModeT Mode;
|
||||
@@ -479,8 +482,10 @@ protected:
|
||||
* 3. createAutoConstraints() : Must be provided with the commands to create autoconstraints
|
||||
*
|
||||
* It recomputes if not solves and handles continuous mode automatically
|
||||
*
|
||||
* It returns true if the handler has been purged.
|
||||
*/
|
||||
void finish()
|
||||
bool finish()
|
||||
{
|
||||
if (this->isState(SelectMode::End)) {
|
||||
unsetCursor();
|
||||
@@ -507,8 +512,9 @@ protected:
|
||||
Base::Console().Error(e.what());
|
||||
}
|
||||
|
||||
handleContinuousMode();
|
||||
return handleContinuousMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief This function resets the handler to the initial state.
|
||||
@@ -547,16 +553,18 @@ protected:
|
||||
*
|
||||
* It performs all the operations in reset().
|
||||
*/
|
||||
void handleContinuousMode()
|
||||
bool handleContinuousMode()
|
||||
{
|
||||
if (continuousMode) {
|
||||
// This code enables the continuous creation mode.
|
||||
reset();
|
||||
// It is ok not to call to purgeHandler in continuous creation mode because the
|
||||
// handler is destroyed by the quit() method on pressing the right button of the mouse
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
sketchgui->purgeHandler(); // no code after, Handler get deleted in ViewProvider
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//@}
|
||||
@@ -627,10 +635,11 @@ protected:
|
||||
|
||||
/** @brief Default behaviour that upon arriving to the End state of the state machine, the
|
||||
* command is finished. */
|
||||
void onModeChanged() override
|
||||
bool onModeChanged() override
|
||||
{
|
||||
angleSnappingControl();
|
||||
finish(); // internally checks that state is SelectMode::End, and only finishes then.
|
||||
return !finish(); // internally checks that state is SelectMode::End, and only finishes
|
||||
// then.
|
||||
};
|
||||
//@}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user