From b0c2d9a2168468214380d94b05d80a4db4835627 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Feb 21 2022 09:21:22 +0000 Subject: 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); } //---------------------------------------------------------------------------