feat(network ui): place nodes on mouse

This commit is contained in:
parker
2025-07-16 20:17:18 +01:00
parent 7e432e975e
commit c7b0b3f63d
2 changed files with 3 additions and 1 deletions

View File

@@ -338,6 +338,9 @@ NodeGraphic* Network::createNode(nt::opConstructor ctorFunc)
if(nt::OpId id = enzo::nt::nm().addOperator(ctorFunc))
{
NodeGraphic* newNode = new NodeGraphic(id);
QPointF cursorPos = view_->mapToScene(mapFromGlobal(QCursor::pos()));
newNode->setPos(cursorPos);
scene_->addItem(newNode);
nodeStore_.emplace(id, newNode);

View File

@@ -83,7 +83,6 @@ void enzo::ui::TabMenu::showOnMouse(float dx, float dy)
setDisabled(false);
std::cout << "showing\n";
QPoint cursorPos = mapToParent(mapFromGlobal(QCursor::pos()));
std::cout << "tab menu pos: " << cursorPos.x() << " " << cursorPos.y() << "\n";
searchBar_->clear();
move(cursorPos + QPoint(dx, dy));
show();