1
0
Fork 0

Remote-Canvas: nicer UI fades

This commit is contained in:
James Turner 2017-11-04 10:47:14 +00:00
parent 81a753cfa1
commit c03d7b3c1f
3 changed files with 21 additions and 16 deletions

View file

@ -244,10 +244,10 @@ bool FGCanvasElement::onChildAdded(LocalProp *prop)
} else if (nm == "visible") { } else if (nm == "visible") {
return true; return true;
} else if (nm == "tf-rot-index") { } else if (nm == "tf-rot-index") {
// ignored, this is noise from the Nasal SVG parswer // ignored, this is noise from the Nasal SVG parser
return true; return true;
} else if (nm.startsWith("center-offset-")) { } else if (nm.startsWith("center-offset-")) {
// ignored, this is noise from the Nasal SVG parswer // ignored, this is noise from the Nasal SVG parser
return true; return true;
} else if (nm == "center") { } else if (nm == "center") {
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::onCenterChanged); connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::onCenterChanged);

View file

@ -5,6 +5,7 @@ Item {
id: root id: root
property bool showDecorations: true property bool showDecorations: true
property alias canvas: canvasDisplay.canvas property alias canvas: canvasDisplay.canvas
property bool showUi: true
//clip: true; //clip: true;
@ -44,6 +45,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: parent.height height: parent.height
visible: showUi
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

View file

@ -2,26 +2,34 @@ import QtQuick 2.0
import FlightGear 1.0 as FG import FlightGear 1.0 as FG
Rectangle { Rectangle {
property bool __uiVisible: true property bool uiVisible: true
width: 1024 width: 1024
height: 768 height: 768
color: "black" color: "black"
property double __uiOpacity: uiVisible ? 1.0 : 0.0
property bool __uiVisible: true
Behavior on __uiOpacity {
SequentialAnimation {
ScriptAction { script: if (uiVisible) __uiVisible = true; }
NumberAnimation { duration: 250 }
ScriptAction { script: if (!uiVisible) __uiVisible = false; }
}
}
Image { Image {
opacity: visible ? 0.5 : 0.0 opacity: __uiOpacity * 0.5
source: "qrc:///images/checkerboard" source: "qrc:///images/checkerboard"
fillMode: Image.Tile fillMode: Image.Tile
anchors.fill: parent anchors.fill: parent
visible: __uiVisible visible: __uiVisible
Behavior on opacity {
NumberAnimation { duration: 400 }
}
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
__uiVisible = !__uiVisible; uiVisible = !uiVisible;
} }
} }
@ -30,6 +38,7 @@ Rectangle {
delegate: CanvasFrame { delegate: CanvasFrame {
id: display id: display
canvas: modelData canvas: modelData
showUi: __uiVisible
} }
} }
@ -38,10 +47,7 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 400 width: 400
visible: __uiVisible visible: __uiVisible
opacity: visible ? 1.0: 0.0 opacity: __uiOpacity
Behavior on opacity {
NumberAnimation { duration: 400 }
}
} }
LoadSavePanel { LoadSavePanel {
@ -50,9 +56,6 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
width: 400 width: 400
visible: __uiVisible visible: __uiVisible
opacity: visible ? 1.0: 0.0 opacity: __uiOpacity
Behavior on opacity {
NumberAnimation { duration: 400 }
}
} }
} }