From c4204e61e65c38a2f70deff26c7ef6754b39c9ac Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Thu, 15 Sep 2016 11:40:04 +0300 Subject: [PATCH] Execute DeselectTexCoordCmd only if a coord is selected --- src/Application/States/TextureMappingState.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Application/States/TextureMappingState.cpp b/src/Application/States/TextureMappingState.cpp index 248b1ef..8a3191e 100644 --- a/src/Application/States/TextureMappingState.cpp +++ b/src/Application/States/TextureMappingState.cpp @@ -81,11 +81,21 @@ void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args) } void TextureMappingState::onBackgroundPressed(Application * app, GuiBackgroundEvent & e){ - app->getCmdManager()->exec( - new DeselectTexCoordCmd(app->getGui()->getTextureEditor())); + // Exec the command only if a joint is selected. + bool selected = false; + for(unsigned int i = 0; i < app->getGui()->getTextureEditor()->getJoints().size(); ++i){ + if(app->getGui()->getTextureEditor()->getJoints()[i]->selected){ + selected = true; + break; + } + } - _bTranslateCanvas = true; + if(selected){ + app->getCmdManager()->exec( + new DeselectTexCoordCmd(app->getGui()->getTextureEditor())); + } + _bTranslateCanvas = true; } void TextureMappingState::onMousePressed(Application * app, ofMouseEventArgs & args){