forked from mirror/openmw-tes3mp
Rotate around center of selection.
This commit is contained in:
parent
571969cd65
commit
101c3cc90d
1 changed files with 6 additions and 5 deletions
|
@ -323,14 +323,15 @@ void CSVRender::InstanceMode::drag (const QPoint& pos, int diffX, int diffY, dou
|
|||
osg::Vec3f camBack = eye - centre;
|
||||
|
||||
// Convert coordinate system
|
||||
int widgetWidth = getWorldspaceWidget().width();
|
||||
osg::Vec3f screenCenter = getScreenCoords(getSelectionCenter(selection));
|
||||
|
||||
int widgetHeight = getWorldspaceWidget().height();
|
||||
|
||||
int newX = pos.x() - widgetWidth / 2;
|
||||
int newY = -pos.y() + widgetHeight / 2;
|
||||
float newX = pos.x() - screenCenter.x();
|
||||
float newY = (widgetHeight - pos.y()) - screenCenter.y();
|
||||
|
||||
int oldX = newX - diffX;
|
||||
int oldY = newY - diffY; // diffY appears to already be flipped
|
||||
float oldX = newX - diffX;
|
||||
float oldY = newY - diffY; // diffY appears to already be flipped
|
||||
|
||||
osg::Vec3f oldVec = osg::Vec3f(oldX, oldY, 0);
|
||||
oldVec.normalize();
|
||||
|
|
Loading…
Reference in a new issue