git-svn-id: svn://db.shs.com.ru/libs@652 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-04 17:16:13 +00:00
parent 888f970f44
commit 2dbdf09bb9
3 changed files with 33 additions and 14 deletions

View File

@@ -60,19 +60,25 @@ void MouseController::mouseReleaseEvent(QMouseEvent * e) {
view->scene_->selectObjects(hov_objects.toList(), add_ts);
return;
}
if (canSelect_ && mouseSelect_ && e->button() == Qt::LeftButton) {
if (canSelect_ && mouseSelect_) {
if ((lastPos - downPos).manhattanLength() < QApplication::startDragDistance()) {
qDebug() << hov_objects << hov_aims;
if (hov_objects.isEmpty() && hov_aims.isEmpty()) {
view->scene()->clearSelection();
} else {
if (!hov_objects.isEmpty())
view->scene_->selectObject(hov_objects[0], add_ts);
if (!hov_aims.isEmpty()) {
view->scene_->selectObject(hov_aims[0], add_ts);
hov_aims[0]->selected_aim = true;
if (e->button() == Qt::LeftButton) {
//qDebug() << hov_objects << hov_aims;
if (hov_objects.isEmpty() && hov_aims.isEmpty()) {
view->scene()->clearSelection();
} else {
if (!hov_objects.isEmpty())
view->scene_->selectObject(hov_objects[0], add_ts);
if (!hov_aims.isEmpty()) {
view->scene_->selectObject(hov_aims[0], add_ts);
hov_aims[0]->selected_aim = true;
}
}
}
if (e->button() == Qt::RightButton) {
if (view->renderer_.edit_mode && !view->scene()->selectedObjects().isEmpty())
view->context_menu.popup(e->globalPos());
}
}
}
canSelect_ = e->buttons() == 0;