QmlDesigner: Maintain grid size while zooming

Task-number: QDS-1622
Change-Id: I488b78304866b40b16d17d643816aa899ccb4cd9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2020-02-10 16:13:58 +02:00
parent a12d3721c0
commit 159c82802b

View File

@@ -39,7 +39,7 @@ View3D {
// Empirical cameraZoomFactor values at which the grid zoom level is doubled. The values are // Empirical cameraZoomFactor values at which the grid zoom level is doubled. The values are
// approximately uniformally distributed over the non-linear range of cameraZoomFactor. // approximately uniformally distributed over the non-linear range of cameraZoomFactor.
readonly property var grid_thresholds: [0.1, 0.265, 0.55, 1.10, 2.35, 4.9, 10.0, 20.5, 42.0, 85.0, 999999.0] readonly property var grid_thresholds: [0.55, 1.10, 2.35, 4.9, 10.0, 20.5, 42.0, 85.0, 999999.0]
property var thresIdx: 1 property var thresIdx: 1
property var thresPerc: 1.0 // percentage of cameraZoomFactor to the current grid zoom threshold (0.0 - 1.0) property var thresPerc: 1.0 // percentage of cameraZoomFactor to the current grid zoom threshold (0.0 - 1.0)
@@ -55,7 +55,7 @@ View3D {
HelperGrid { HelperGrid {
id: helperGrid id: helperGrid
lines: 20 + Math.round((1 - thresPerc) * 20); lines: Math.pow(2, grid_thresholds.length - thresIdx - 1);
step: 100 * grid_thresholds[0] * Math.pow(2, thresIdx - 1); step: 100 * grid_thresholds[0] * Math.pow(2, thresIdx - 1);
subdivAlpha: thresPerc; subdivAlpha: thresPerc;
} }