From 28a6865ce7187c9c74bd5f9709fc416a12955713 Mon Sep 17 00:00:00 2001 From: Rodney Date: Feb 21 2022 17:42:58 +0000 Subject: Merge pull request #4265 from shun-iwasawa/fix_fxgadget_picking Fix fx gadget picking --- diff --git a/toonz/sources/tnztools/edittoolgadgets.cpp b/toonz/sources/tnztools/edittoolgadgets.cpp index 8217577..7c8127a 100644 --- a/toonz/sources/tnztools/edittoolgadgets.cpp +++ b/toonz/sources/tnztools/edittoolgadgets.cpp @@ -1831,15 +1831,16 @@ void FxGadgetController::draw(bool picking) { //--------------------------------------------------------------------------- void FxGadgetController::selectById(unsigned int id) { - std::map::iterator it; - it = m_idTable.find(id); - FxGadget *selectedGadget = it != m_idTable.end() ? it->second : 0; + std::map::iterator it = m_idTable.find(id); + FxGadget *selectedGadget = it != m_idTable.end() ? it->second : nullptr; if (selectedGadget != m_selectedGadget) { if (m_selectedGadget) m_selectedGadget->select(-1); m_selectedGadget = selectedGadget; - if (m_selectedGadget) - m_selectedGadget->select(id - m_selectedGadget->getId()); } + if (!m_selectedGadget) return; + int handleId = id - m_selectedGadget->getId(); + if (!m_selectedGadget->isSelected(handleId)) + m_selectedGadget->select(handleId); } //---------------------------------------------------------------------------