QmlDesigner: Fix edit view issues caused by quick3d api changes

Change-Id: I4bb110ff4693c57089f659e0f125c9f89c6bdb9c
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2019-10-25 11:45:52 +03:00
parent 3476dbd560
commit baced09bc7
4 changed files with 17 additions and 18 deletions

View File

@@ -37,11 +37,11 @@ Node {
// Read-only
property real relativeScale: 1
onGlobalTransformChanged: updateScale()
onSceneTransformChanged: updateScale()
onAutoScaleChanged: updateScale()
Connections {
target: view3D.camera
onGlobalTransformChanged: updateScale()
onSceneTransformChanged: updateScale()
}
function getScale(baseScale)
@@ -60,16 +60,16 @@ Node {
// "anchor" distance. Map the two positions back to the target node, and measure the
// distance between them now, in the 3D scene. The difference of the two distances,
// view and scene, will tell us what the distance independent scale should be.
var posInView1 = view3D.mapFrom3DScene(positionInScene);
var posInView1 = view3D.mapFrom3DScene(scenePosition);
var posInView2 = Qt.vector3d(posInView1.x + 100, posInView1.y, posInView1.z);
var rayPos1 = view3D.mapTo3DScene(Qt.vector3d(posInView2.x, posInView2.y, 0));
var rayPos2 = view3D.mapTo3DScene(Qt.vector3d(posInView2.x, posInView2.y, 10));
var planeNormal = view3D.camera.forward;
var rayHitPos = helper.rayIntersectsPlane(rayPos1, rayPos2, positionInScene,
var rayHitPos = helper.rayIntersectsPlane(rayPos1, rayPos2, scenePosition,
planeNormal);
relativeScale = positionInScene.minus(rayHitPos).length() / 100;
relativeScale = scenePosition.minus(rayHitPos).length() / 100;
}
}