forked from qt-creator/qt-creator
QmlDesigner: Port Edit 3D View to 5.15
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>
This commit is contained in:
committed by
Norihito Tohge
parent
59560fb817
commit
a77ef4ca7f
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
Item {
|
||||
id: cameraCtrl
|
||||
@@ -43,8 +43,8 @@ Item {
|
||||
property int _button
|
||||
property real _zoomFactor: 1
|
||||
property Camera _prevCamera: null
|
||||
readonly property vector3d _defaultCameraPosition: Qt.vector3d(0, 600, -600)
|
||||
readonly property vector3d _defaultCameraRotation: Qt.vector3d(45, 0, 0)
|
||||
readonly property vector3d _defaultCameraPosition: Qt.vector3d(0, 600, 600)
|
||||
readonly property vector3d _defaultCameraRotation: Qt.vector3d(-45, 0, 0)
|
||||
readonly property real _defaultCameraLookAtDistance: _defaultCameraPosition.length()
|
||||
|
||||
function restoreCameraState(cameraState)
|
||||
@@ -68,7 +68,7 @@ Item {
|
||||
_lookAtPoint = Qt.vector3d(0, 0, 0);
|
||||
_zoomFactor = 1;
|
||||
camera.position = _defaultCameraPosition;
|
||||
camera.rotation = _defaultCameraRotation;
|
||||
camera.eulerRotation = _defaultCameraRotation;
|
||||
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
|
||||
_zoomFactor, false);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ Item {
|
||||
if (!camera)
|
||||
return;
|
||||
|
||||
camera.rotation = rotation;
|
||||
camera.eulerRotation = rotation;
|
||||
var newLookAtAndZoom = _generalHelper.focusObjectToCamera(
|
||||
camera, _defaultCameraLookAtDistance, targetObject, view3d, _zoomFactor, updateZoom);
|
||||
_lookAtPoint = newLookAtAndZoom.toVector3d();
|
||||
@@ -151,7 +151,7 @@ Item {
|
||||
onPressed: {
|
||||
if (cameraCtrl.camera && mouse.modifiers === Qt.AltModifier) {
|
||||
cameraCtrl._dragging = true;
|
||||
cameraCtrl._startRotation = cameraCtrl.camera.rotation;
|
||||
cameraCtrl._startRotation = cameraCtrl.camera.eulerRotation;
|
||||
cameraCtrl._startPosition = cameraCtrl.camera.position;
|
||||
cameraCtrl._startLookAtPoint = _lookAtPoint;
|
||||
cameraCtrl._pressPoint = Qt.vector3d(mouse.x, mouse.y, 0);
|
||||
|
||||
Reference in New Issue
Block a user