git-svn-id: svn://db.shs.com.ru/libs@639 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -61,8 +61,18 @@ void MouseController::mouseReleaseEvent(QMouseEvent * e) {
|
||||
return;
|
||||
}
|
||||
if (canSelect_ && mouseSelect_ && e->button() == Qt::LeftButton) {
|
||||
if ((lastPos - downPos).manhattanLength() < QApplication::startDragDistance() && !hov_objects.isEmpty()) {
|
||||
view->scene_->selectObject(hov_objects[0], add_ts);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
canSelect_ = e->buttons() == 0;
|
||||
@@ -127,9 +137,18 @@ void MouseController::mouseMoveEvent(QMouseEvent * e) {
|
||||
QMatrix4x4 pmat;
|
||||
foreach (ObjectBase * o, objects) {
|
||||
pmat.setToIdentity();
|
||||
if (o->parent())
|
||||
pmat = o->parent()->worldTransform().inverted();
|
||||
o->move((pmat * QVector4D(axe_vector, 0)).toVector3D());
|
||||
if (o->selected_aim) {
|
||||
pmat = o->itransform_.inverted();
|
||||
} else {
|
||||
if (o->parent())
|
||||
pmat = o->parent()->worldTransform().inverted();
|
||||
}
|
||||
QVector3D dv = (pmat * QVector4D(axe_vector, 0)).toVector3D();
|
||||
if (o->selected_aim) {
|
||||
AimedObject * ao = (AimedObject*)o;
|
||||
ao->setAim(ao->aim() + dv);
|
||||
} else
|
||||
o->move(dv);
|
||||
}
|
||||
}
|
||||
if (cur_action == RendererService::haRotate) {
|
||||
|
||||
Reference in New Issue
Block a user