1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3import { AppState, ComponentData, Orientation } from "../../appState.slint";
4import { FullScreenWidgetLoader } from "fullScreenWidgetLoader.slint";
5import { FullScreenWidgetLoaderSW } from "fullScreenWidgetLoaderSW.slint";
6import { Animation } from "../../common.slint";
7
8
9export component FullScreenView inherits Rectangle {
10 property <ComponentData> landscape-data: { id: "", x: 60, y: 60, width: 1800, height: 900, background: #00bf1d, visible: true };
11 property <ComponentData> portrait-data: AppState.graphics-accelerator-available ? { id: "", x: 60, y: 60, width: 900, height: 1800, background: #00bf1d, visible: true } : { id: "", x: 160, y: 560, width: 800, height: 800, background: #00bf1d, visible: true };
12 property <ComponentData> full-screen-data: AppState.orientation == Orientation.landscape ? landscape-data : portrait-data;
13 property <bool> full-screen: false;
14 in property <length> nudge-y: 0px;
15
16 backdrop := Rectangle {
17 y: -nudge-y;
18 width: 100%;
19 height: 100%;
20 opacity: 0;
21 background: black;
22 touchCatcher := TouchArea { }
23
24 states [
25 isVisible when AppState.full-screen-index != -1 && full-screen: {
26 opacity: 0.7;
27 in {
28 animate opacity {
29 duration: Animation.full-screen-duration;
30 easing: ease-in-out-sine;
31 }
32 }
33 out {
34 animate opacity {
35 duration: Animation.full-screen-duration;
36 easing: ease-in-out-sine;
37 }
38 }
39 }
40 ]
41 }
42
43 if AppState.graphics-accelerator-available: FullScreenWidgetLoader {
44 in-out property <ComponentData> normal-layout-data;
45 data: full-screen ? full-screen-data : normal-layout-data;
46 property <string> full-screen-index: AppState.full-screen-index;
47 changed full-screen-index => {
48 full-screen = false;
49 closeTimer.running = true;
50 }
51 init => {
52 self.index = AppState.full-screen-index;
53 self.type = AppState.component-details[AppState.full-screen-index].type;
54 self.normal-layout-data = AppState.current-layout-data.components[AppState.full-screen-index];
55 }
56 }
57
58 if !AppState.graphics-accelerator-available: FullScreenWidgetLoaderSW {
59 in-out property <ComponentData> normal-layout-data;
60 data: full-screen ? full-screen-data : normal-layout-data;
61 property <string> full-screen-index: AppState.full-screen-index;
62 changed full-screen-index => {
63 full-screen = false;
64 closeTimer.running = true;
65 }
66 init => {
67 self.index = AppState.full-screen-index;
68 self.type = AppState.component-details[AppState.full-screen-index].type;
69 self.normal-layout-data = AppState.current-layout-data.components[AppState.full-screen-index];
70 }
71 }
72
73 closeTimer := Timer {
74 running: false;
75 interval: Animation.full-screen-duration;
76 triggered => {
77 AppState.showing-full-screen = false;
78 AppState.last-selected-index = -1;
79 }
80 }
81
82 Timer {
83 interval: 1ms;
84 triggered => {
85 self.running = false;
86 full-screen = true;
87 }
88 }
89}
90