@@ -62,14 +62,19 @@ struct WidgetMover::State {
6262
6363 vrb::Vector result = ProjectPoint (widget, hitPoint);
6464
65- if (parentWidget && moveBehaviour == WidgetMoveBehaviour::KEYBOARD && widget->GetCylinder ()) {
66- // For Cylindrical keyboard move we want to use the x translation from the parent widget (the window)
67- parentWidget->TestControllerIntersection (aStart, aDirection, hitPoint, hitNormal, false , isInWidget, hitDistance);
68- if (hitDistance >= 0 ) {
69- vrb::Vector point = ProjectPoint (parentWidget, hitPoint);
70- result.x () = point.x ();
71- result.z () = point.z ();
65+ if (parentWidget && moveBehaviour == WidgetMoveBehaviour::KEYBOARD ) {
66+ if (widget->GetCylinder ()) {
67+ // For Cylindrical keyboard move we want to use the x translation from the parent widget (the window)
68+ parentWidget->TestControllerIntersection (aStart, aDirection, hitPoint, hitNormal, false , isInWidget, hitDistance);
69+ if (hitDistance >= 0 ) {
70+ vrb::Vector point = ProjectPoint (parentWidget, hitPoint);
71+ result.x () = point.x ();
72+ result.z () = point.z ();
73+ }
7274 }
75+
76+ // Convert the world point to a point relative to the window.
77+ result = parentWidget->GetTransformNode ()->GetWorldTransform ().AfineInverse ().MultiplyPosition (result);
7378 }
7479
7580 return result;
@@ -150,10 +155,8 @@ WidgetMover::HandleMove(const vrb::Vector& aStart, const vrb::Vector& aDirection
150155
151156 vrb::Vector delta = hitPoint - m.initialPoint ;
152157 delta.y () = hitPoint.y () - m.initialPoint .y ();
153- delta.x () = vrb::Vector (hitPoint.x () - m.initialPoint .x (), 0 .0f , hitPoint.z () - m.initialPoint .z ()).Magnitude ();
154- if (hitPoint.x () < m.initialPoint .x ()) {
155- delta.x () *= -1 .0f ;
156- }
158+ delta.x () = hitPoint.x () - m.initialPoint .x ();
159+
157160
158161 if (m.moveBehaviour == WidgetMoveBehaviour::KEYBOARD ) {
159162 return m.HandleKeyboardMove (delta);
0 commit comments