Leave gradient widget in good state on commit

Stop highlighting the hovered or dragged geometry when disabling the
widget.
This commit is contained in:
Lawrence Lee 2021-05-23 12:00:30 -07:00
parent 3ade11c970
commit 4bc69dc30c
2 changed files with 15 additions and 0 deletions

View File

@ -325,6 +325,7 @@ void Gradient::editToggled ()
if (edit->get_active()) { if (edit->get_active()) {
subscribe(); subscribe();
} else { } else {
releaseEdit();
unsubscribe(); unsubscribe();
} }
} }
@ -579,6 +580,19 @@ bool Gradient::drag1(int modifierKey)
return false; return false;
} }
void Gradient::releaseEdit()
{
if (lastObject >= 0) {
if (lastObject == 2 || lastObject == 3) {
EditSubscriber::visibleGeometry.at(2)->state = Geometry::NORMAL;
EditSubscriber::visibleGeometry.at(3)->state = Geometry::NORMAL;
} else {
EditSubscriber::visibleGeometry.at(lastObject)->state = Geometry::NORMAL;
}
}
action = Action::NONE;
}
void Gradient::switchOffEditMode () void Gradient::switchOffEditMode ()
{ {
if (edit->get_active()) { if (edit->get_active()) {

View File

@ -35,6 +35,7 @@ protected:
sigc::connection editConn; sigc::connection editConn;
void editToggled (); void editToggled ();
void releaseEdit();
public: public: