[qml] Optimize QML files and fix syntax warnings

This commit addresses warnings that were raised by QtCreator's linter:
- IDs declared more than once
- variables declared more than once in the same scope
- type coercions
- variables declared as "var" when their type is known
- unclosed "case" in switch-case
This commit is contained in:
Candice Bentéjac 2023-01-27 11:00:51 +01:00
parent 8c2a7bba0f
commit 091346cbb8
18 changed files with 99 additions and 97 deletions

View file

@ -63,10 +63,11 @@ Entity {
currentPosition.x = mouse.x;
currentPosition.y = mouse.y;
const dt = 0.02
const dt = 0.02;
var d;
if(panning) { // translate
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
var tx = axisMX.value * root.translateSpeed * d;
var ty = axisMY.value * root.translateSpeed * d;
mouseHandler.hasMoved = true;
@ -80,7 +81,7 @@ Entity {
return;
}
if(zooming) { // zoom with alt + RMD
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
var tz = axisMX.value * root.translateSpeed * d;
mouseHandler.hasMoved = true;
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)