MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / openSelectionContextMenu

Method openSelectionContextMenu

App/interaction/ToolsManager.cpp:193–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193bool 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
217void ToolsManager::setSelectedAtomsFixed(bool fixed) {
218 if (simulation == nullptr || pickingSystem == nullptr) {

Callers

nothing calls this directly

Calls 5

pickAtomMethod · 0.80
containsMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected