| 191 | } |
| 192 | |
| 193 | bool ToolsManager::openSelectionContextMenu(glm::ivec2 mousePos) { |
| 194 | if (uiState == nullptr || pickingSystem == nullptr || renderer == nullptr || !renderer->get()) { |
| 195 | return false; |
| 196 | } |
| 197 | |
| 198 | syncPickingWorldToActive(true); |
| 199 | |
| 200 | AtomHit hit{}; |
| 201 | if (!pickingSystem->pickAtom(mousePos, 10.0f, hit)) { |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | const auto& selectedAtomIds = pickingSystem->getSelectedAtomIds(); |
| 206 | if (selectedAtomIds.empty() || !selectedAtomIds.contains(hit.id)) { |
| 207 | return false; |
| 208 | } |
| 209 | |
| 210 | uiState->openSelectionContextMenu = true; |
| 211 | uiState->selectionContextMenuX = static_cast<float>(mousePos.x); |
| 212 | uiState->selectionContextMenuY = static_cast<float>(mousePos.y); |
| 213 | uiState->selectedAtomCount = static_cast<int>(selectedAtomIds.size()); |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | void ToolsManager::setSelectedAtomsFixed(bool fixed) { |
| 218 | if (simulation == nullptr || pickingSystem == nullptr) { |