128 lines
4.2 KiB
Plaintext
128 lines
4.2 KiB
Plaintext
component Instruction inherits Rectangle {
|
|
in property <string> number;
|
|
in property <string> german;
|
|
in property <string> english;
|
|
in property <color> accent;
|
|
in property <bool> active;
|
|
min-width: 0px;
|
|
preferred-width: 0px;
|
|
vertical-stretch: 0;
|
|
background: active ? root.accent.with-alpha(0.13) : #f5f7f8;
|
|
border-radius: 16px;
|
|
|
|
height: max(36px, german-text.height + 6px + english-text.height) + 36px;
|
|
Rectangle {
|
|
x: 18px;
|
|
y: 18px;
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 18px;
|
|
background: root.active ? root.accent : #e6ebed;
|
|
Text {
|
|
text: root.number;
|
|
color: #20302b;
|
|
font-size: 17px;
|
|
font-weight: 700;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
german-text := Text {
|
|
x: 68px;
|
|
y: 18px;
|
|
width: parent.width - 86px;
|
|
height: self.preferred-height;
|
|
text: root.german;
|
|
color: #20302b;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
wrap: word-wrap;
|
|
}
|
|
english-text := Text {
|
|
x: german-text.x;
|
|
y: german-text.y + german-text.height + 6px;
|
|
width: german-text.width;
|
|
height: self.preferred-height;
|
|
text: root.english;
|
|
color: #52635d;
|
|
font-size: 14px;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
|
|
export component AppWindow inherits Window {
|
|
title: "winf photobooth";
|
|
background: #f6f8f5;
|
|
default-font-family: "DejaVu Sans";
|
|
in property <image> video-frame;
|
|
in property <bool> hand-detected: false;
|
|
private property <color> primary: #84bf65;
|
|
private property <color> secondary: #4caee3;
|
|
private property <length> inset: root.width < 700px ? 20px : 32px;
|
|
private property <bool> compact: root.width < 800px;
|
|
|
|
Image {
|
|
width: parent.width;
|
|
height: parent.height;
|
|
source: root.video-frame;
|
|
image-fit: cover;
|
|
}
|
|
|
|
header := Rectangle {
|
|
x: root.inset + root.safe-area-insets.left;
|
|
y: root.inset + root.safe-area-insets.top;
|
|
width: self.preferred-width;
|
|
height: self.preferred-height;
|
|
border-radius: 18px;
|
|
background: #fffffff5;
|
|
HorizontalLayout {
|
|
padding: 14px;
|
|
padding-right: 22px;
|
|
spacing: 12px;
|
|
Image {
|
|
source: @image-url("assets/winf-icon.png");
|
|
width: 44px;
|
|
height: 44px;
|
|
image-fit: contain;
|
|
}
|
|
Text {
|
|
text: "winf photobooth";
|
|
color: #20302b;
|
|
font-size: root.width < 500px ? 20px : 24px;
|
|
font-weight: 600;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Wrap the text before sizing the panel so its bottom inset stays at 16px.
|
|
panel := Rectangle {
|
|
x: root.inset + root.safe-area-insets.left;
|
|
y: root.height - self.height - root.inset - root.safe-area-insets.bottom;
|
|
width: root.width - root.inset * 2 - root.safe-area-insets.left - root.safe-area-insets.right;
|
|
height: root.compact ? first.height + second.height + 44px : max(first.height, second.height) + 32px;
|
|
border-radius: 22px;
|
|
background: #fffffff5;
|
|
first := Instruction {
|
|
x: 16px;
|
|
y: 16px;
|
|
width: root.compact ? parent.width - 32px : (parent.width - 44px) / 2;
|
|
number: "1";
|
|
german: "Hebe deine offene Hand und zeige die Handfläche zur Kamera.";
|
|
english: "Raise your open hand with your palm facing the camera.";
|
|
accent: root.primary;
|
|
active: !root.hand-detected;
|
|
}
|
|
second := Instruction {
|
|
x: root.compact ? 16px : first.x + first.width + 12px;
|
|
y: root.compact ? first.y + first.height + 12px : 16px;
|
|
width: first.width;
|
|
number: "2";
|
|
german: "Halte deine Hand ruhig, bis der Kreis vollständig gefüllt ist.";
|
|
english: "Keep your hand steady until the circle is completely filled.";
|
|
accent: root.secondary;
|
|
active: root.hand-detected;
|
|
}
|
|
}
|
|
}
|