Skip to content
Snippets Groups Projects
Commit 67bc95ae authored by Marco Biasini's avatar Marco Biasini
Browse files

reduce number of calls to scene refresh

parent 35b80f7d
Branches
Tags
No related merge requests found
......@@ -134,6 +134,9 @@ MouseEvent::Buttons GLCanvas::TranslateButtons(Qt::MouseButtons buttons) const
void GLCanvas::mouseMoveEvent(QMouseEvent* event)
{
if (!(show_beacon_ || event->buttons())) {
return;
}
if (this->IsToolEvent(event)) {
if (ToolManager::Instance().GetActiveTool()) {
MouseEvent mouse_event(this->TranslateButtons(event->buttons()),
......@@ -163,7 +166,7 @@ void GLCanvas::mousePressEvent(QMouseEvent* event)
this->HandleMousePressEvent(event);
}
last_pos_=QPoint(event->x(), event->y());
this->DoRefresh();
this->DoRefresh();
}
void GLCanvas::mouseReleaseEvent(QMouseEvent* event)
......@@ -181,7 +184,7 @@ void GLCanvas::mouseReleaseEvent(QMouseEvent* event)
}
}
last_pos_=QPoint(event->x(), event->y());
this->DoRefresh();
this->DoRefresh();
}
void GLCanvas::mouseDoubleClickEvent(QMouseEvent* event)
......@@ -203,7 +206,9 @@ void GLCanvas::mouseDoubleClickEvent(QMouseEvent* event)
scene.SetCenter(atom.GetPos());
}
}
this->DoRefresh();
if (show_beacon_) {
this->DoRefresh();
}
}
void GLCanvas::RequestContextMenu(const QPoint& pos)
......
......@@ -55,7 +55,8 @@ void SelectionTool::Click(const MouseEvent& event)
int sel_mode=this->GetSelectionMode();
gfx::Scene& scene=gfx::Scene::Instance();
scene.SetSelectionMode(sel_mode);
scene.Pick(event.GetPos().x(), scene.GetViewport().height-event.GetPos().y(), 8);
scene.Pick(event.GetPos().x(),
scene.GetViewport().height-event.GetPos().y(), 8);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment