aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QmlPuppet: Improve gizmo precisionMiikka Heikkinen2020-09-041-33/+313
| | | | | | | | | | | At high zoom levels, picking precision of the gizmos was not good, because compounding inaccuracies from multiple floating point operations required. Fixed by reimplementing many operations using double precision math. Change-Id: I013876b816379a20b552eb06d2f9cbb3f2aa2d21 Fixes: QDS-2676 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QmlDesigner: Allow starting free drag on initial selection pressMiikka Heikkinen2020-07-031-2/+30
| | | | | | | | | | | Changed object selection to be done on press instead of click, and the initial press now also starts free drag of the selected object after a short distance moved to prevent accidental drags. Change-Id: I61656661cd734d167ef9f8db42d986f0e97402a3 Fixes: QDS-2376 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QmlDesigner: Port Edit 3D View to 5.15Miikka Heikkinen2020-03-041-24/+6
| | | | | | | | | Qt 5.15.0 is now the minimum version to enable Edit 3D view. Change-Id: I15cee59e6a7665477825caa0ae412fc6ac7b570a Fixes: QDS-1694 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QmlDesigner: Fix far away gizmo scalingMiikka Heikkinen2020-01-311-23/+84
| | | | | | | | | | Changed auto scaler math to use more double precision math to improve scaling accuracy when camera is zoomed far or gizmo is far from origin. Change-Id: Ic3020bbf159c0d5d090af9c9b8e8a4aa372d2406 Fixes: QDS-1528 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Use double precision to calculate ray-plane intersectionsMiikka Heikkinen2020-01-241-10/+60
| | | | | | | | | | Float precision becomes issue when calculating ray-plane intersections for gizmo hit detection when camera is very zoomed (in or out). Do the critical calculations in double precision to mitigate the issue. Change-Id: I8c33e17bf19d092e24ab19f8f8f2a54cd83304cc Fixes: QDS-1526 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Fix scale gizmo for child objectsMiikka Heikkinen2020-01-141-76/+22
| | | | | | | | | | | | As global space scaling is not supported, the scaling algorithm could be simplified a lot. Now scaling gizmos work off the relative distance along the scaling rod/plane instead of going through global space, removing the need for complicated and error prone transformations. Change-Id: Iaf0d5b2f31f10ae0b26b6a59b36e9ee4498838c9 Fixes: QDS-1269 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Show 3D edit view gizmos at pivot point of nodeMiikka Heikkinen2020-01-091-4/+24
| | | | | | | Change-Id: I6eb6b2674868d9251e568249cfabc105d0c715d7 Fixes: QDS-1354 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Fix rotation resulting in NaN angle sometimesMiikka Heikkinen2019-12-131-0/+5
| | | | | | | Change-Id: I88f866c6649f7ec25bc96a7393d0930685e5382b Fixes: QDS-1341 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Use separate MouseArea3D to calculate drag vectorMiikka Heikkinen2019-12-111-6/+30
| | | | | | | | | | | | | Using the MouseArea3D linked to gizmo to manage the drag leads to slight unwanted drift on the drag plane, as it moves with the gizmo. Fixed by using a helper MouseArea3D to calculate drag vector. Helper area's transform is set at mouse press time and is not changed during the drag. Change-Id: I50d3f738277bd34005c977423d114abc8dbed520 Fixes: QDS-1312 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Fix planar scaling randomly setting the third axis to zeroMiikka Heikkinen2019-12-041-3/+3
| | | | | | | | | | All the math before checking if the scaling axis is zero can cause enough rounding errors to make qFuzzyIsNull to not think the value is zero anymore, so check increase the check range. Change-Id: I776d44886f061be6c1fd91c09eb8efcfb29e0936 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Fix 3D edit gizmos orientation and rotation orderMiikka Heikkinen2019-12-041-8/+26
| | | | | | | | | | When selected node has non-default rotation order or orientation, gizmos need to account for that. Change-Id: Ie3817fd057b43f708ac1feea3e98e1e44f56d66a Fixes: QDS-1290 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Fix issues with MouseArea3D deactivation detectionMiikka Heikkinen2019-11-221-0/+14
| | | | | | | | | | | Existing mouse grab is now released when MouseArea3D is deactivated or set to no longer grab the mouse. Various gizmos were also set to follow MouseArea3D's dragging property instead of keeping track of drag themselves. Change-Id: I49f968f20b26eb222fc8635b943e9144073fb164 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Implement better camera navigation in 3D edit viewMiikka Heikkinen2019-11-221-3/+2
| | | | | | | | | | | | Edit camera is now controlled as in Qt 3D Studio: ALT + left button orbits camera. ALT + middle button pans camera. ALT + right button zooms camera. Wheel zooms camera. Task-number: QDS-1206 Change-Id: Ia72644073d172b00483ceed8bcc5ffb8dce68741 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Implement RotateGizmo for 3D edit viewMiikka Heikkinen2019-11-181-16/+200
| | | | | | | | | | Added a gizmo for rotating selected object either freely or locked around X, Y, Z, or camera axis. Change-Id: Ib43c7dd3fc0f49f384d5920fce21ea932c4fc90d Task-number: QDS-1196 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Add planar move and scale handles to gizmosMiikka Heikkinen2019-11-081-30/+37
| | | | | | Change-Id: Icae60ec35fc84d731243a005e97b174fa9a94815 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QmlDesigner: Add ScaleGizmo to 3D edit viewMiikka Heikkinen2019-11-081-5/+86
| | | | | | | | | | | ScaleGizmo allows scaling in the direction of local or global axes, as well as uniform scaling. Any scale component cannot be made negative with ScaleGizmo. Change-Id: I9b98d9593e07ded340178b07b73fa1b72421ba20 Fixes: QDS-1195 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QmlDesigner: MoveGizmo improvements in 3D edit viewMiikka Heikkinen2019-11-011-34/+109
| | | | | | | | | | | | | | | | | | Mouse press and release are now properly handled by MouseArea3D. This fixes various issues: - No need to move the mouse after release for release to register. - Drag is no longer limited to the 3D edit window, though it is still limited to the screen. - Drag arrows no longer register start of drag if you click outside the arrow and then move the cursor over the arrow while holding the mouse button down. Also added the missing center ball to the MoveGizmo to allow free dragging along the camera plane. Change-Id: Iab55ae79f8af024534510e5fd29379532ac74025 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlDesigner: Add support for move gadget to 3D edit viewMiikka Heikkinen2019-10-251-0/+251
This proof-of-concept move gadget is based on the move gadget in studio example of QtQuick3D. Change-Id: I1b596443a3e99c16ed214bc464c5367a0f7aa503 Fixes: QDS-1125 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>