Main.qml declared both layouts at once: the small per-object windows and the full-screen overlay. Both of them write the controller's catCenter, which is where the eyes look for the cursor. Two bindings on one property overwrite each other, so catCenter alternated every frame between the cat window's real centre and the hidden overlay's, whose height is zero. look.y flipped between -0.495 and 1.0 sixty times a second and the pupils jumped with it. Each layout now sits behind its own Loader and only the one the platform needs is built. The small windows moved into Desktop.qml so a single component can hold all three of them. Measured in the running app while walking, the eye's vertical travel went from 2.6 px to 0.40 px, and look.y is now a single steady value. It also stops a second, invisible cat from animating in the background. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.2 KiB
QML
44 lines
1.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import TNCat
|
|
|
|
// Root is not a window. Exactly one of the two layouts is built, because both
|
|
// of them drive the controller's catCenter; having both alive made the two
|
|
// bindings overwrite each other every frame and the eyes jumped with them.
|
|
QtObject {
|
|
id: app
|
|
|
|
required property CatController cat
|
|
required property AppSettings settings
|
|
|
|
function openSettings() {
|
|
settingsWindow.show()
|
|
settingsWindow.raise()
|
|
settingsWindow.requestActivate()
|
|
}
|
|
|
|
readonly property Loader desktopLoader: Loader {
|
|
active: !Platform.overlayMode
|
|
sourceComponent: Desktop {
|
|
cat: app.cat
|
|
settings: app.settings
|
|
onSettingsRequested: app.openSettings()
|
|
}
|
|
}
|
|
|
|
readonly property Loader overlayLoader: Loader {
|
|
active: Platform.overlayMode
|
|
sourceComponent: OverlayWindow {
|
|
cat: app.cat
|
|
settings: app.settings
|
|
overlayActive: true
|
|
onSettingsRequested: app.openSettings()
|
|
}
|
|
}
|
|
|
|
readonly property SettingsWindow settingsWindow: SettingsWindow {
|
|
cat: app.cat
|
|
settings: app.settings
|
|
}
|
|
}
|