app: fill the screen with a clip in review
The review screen gave the clip a framed stage with the header, the details column and the status bar around it, so a clip watched there filled a fraction of the display. Full screen, the button beside the volume or F, hands the window to the display with no frame of ours and draws the picture alone, letterboxed at 16:9. The controls keep to a band at the bottom: a gradient no taller than they are, the scrubber with its event marks, the transport and an Exit full screen button. The band is its own hover group, so the pointer comes to it for the controls to draw in over 200 ms, and they are gone 400 ms after it leaves. Escape, the button or a double press on the picture leaves, and the double press enters from the windowed stage. Being full screen belongs to the window, not to the review, so App keeps the state it last asked of the window and poll reconciles the two: a way out of the review, a jump to another screen, or a window closed and reopened brings the title bar, the status bar and the frame back.
This commit is contained in:
1 parent
e546ab6969
commit
73b41fa86b
4 files changed
+184
-47
No files matched your search
+143
-46
@@ -47,6 +47,9 @@ pub struct Review {
|
||||
/// move under the pointer.
|
||||
pub frozen_window: Option<(f64, f64)>,
|
||||
pub show_details: bool,
|
||||
/// The window fills the display and the picture fills the window, with the controls over
|
||||
/// its bottom: entered from the transport, a double press on the picture, or F.
|
||||
pub fullscreen: bool,
|
||||
pub highlights: Vec<Highlight>,
|
||||
/// The clip being chosen on the scrubber, once the Clip button is pressed.
|
||||
pub clip: Option<Clip>,
|
||||
@@ -379,6 +382,7 @@ impl Default for Review {
|
||||
highlights: Vec::new(),
|
||||
clip: None,
|
||||
show_details: false,
|
||||
fullscreen: false,
|
||||
export: None,
|
||||
export_note: None,
|
||||
error: None,
|
||||
@@ -501,6 +505,7 @@ pub fn leave(app: &mut App) {
|
||||
app.review.error = None;
|
||||
app.review.export_note = None;
|
||||
app.review.export = None;
|
||||
app.review.fullscreen = false;
|
||||
}
|
||||
/// Called from `poll` while the review screen is up.
|
||||
/// Sound from a second player drifts from the pictures by a few milliseconds a minute. Past a
|
||||
@@ -709,6 +714,81 @@ pub fn view(app: &App, p: Paint) -> El {
|
||||
.child(body)
|
||||
}
|
||||
|
||||
/// The picture filling the window, with the controls over its bottom. The picture is the whole
|
||||
/// screen, so the controls keep to their band: the pointer finds them there, and 200 ms after it
|
||||
/// arrives they draw in, 400 ms after it leaves they are gone again.
|
||||
pub fn fullscreen(app: &App, p: Paint) -> El {
|
||||
let stage = el()
|
||||
.key("fullscreen-stage")
|
||||
.w_full()
|
||||
.h_full()
|
||||
.fill(rune::Color::BLACK)
|
||||
.center();
|
||||
// A double press on the picture leaves the full screen, as it enters one. It sits on the
|
||||
// picture, not the stage, so the controls over it keep their own presses.
|
||||
let stage = match &app.review.player {
|
||||
Some(player) => stage.child(
|
||||
el().key("video")
|
||||
.aspect_fit(16.0 / 9.0)
|
||||
.video(player, SurfaceFit::Fill)
|
||||
.on_double_press(|app: &mut App| app.review.fullscreen = false),
|
||||
),
|
||||
None => stage.child(
|
||||
text(
|
||||
app.review
|
||||
.error
|
||||
.clone()
|
||||
.unwrap_or_else(|| "Loading the clip…".into()),
|
||||
)
|
||||
.key("stage-message")
|
||||
.font(body(13.0))
|
||||
.color(p.muted()),
|
||||
),
|
||||
};
|
||||
// A band on the bottom of the picture, not a sheet over all of it: the gradient reaches
|
||||
// black under the transport and is already gone a hand's width above the scrubber, so the
|
||||
// picture shows at its own brightness on every display. The band is the hover group, so the
|
||||
// pointer has to come to the controls for them to show, and leaving them puts them away.
|
||||
let band = col()
|
||||
.key("fullscreen-controls")
|
||||
.pin(Some(0.0), None, Some(0.0), Some(0.0))
|
||||
.hover_group()
|
||||
.hover_motion(
|
||||
rune::Spring::smooth(0.2, 0.0),
|
||||
rune::Spring::smooth(0.4, 0.0),
|
||||
);
|
||||
let mut controls = col()
|
||||
.key("fullscreen-bar")
|
||||
.w_full()
|
||||
.gap(space::S2)
|
||||
.px(space::S6)
|
||||
.pt(space::S6)
|
||||
.pb(space::S3)
|
||||
.gradient(rune::Color::TRANSPARENT, rune::Color::BLACK.alpha(0.8))
|
||||
.group_opacity(0.0, 1.0);
|
||||
if let Some(game) = app.reviewed() {
|
||||
controls = controls.child(scrubber(app, p, game));
|
||||
}
|
||||
controls = controls.child(
|
||||
row()
|
||||
.key("fullscreen-transport")
|
||||
.w_full()
|
||||
.center_y()
|
||||
.gap(space::S2)
|
||||
.child(playback(app, p))
|
||||
.child(volume(app, p))
|
||||
.child(el().grow(1.0))
|
||||
.child(ui::button(
|
||||
p,
|
||||
"exit-fullscreen",
|
||||
"Exit full screen",
|
||||
false,
|
||||
|app: &mut App| app.review.fullscreen = false,
|
||||
)),
|
||||
);
|
||||
stage.child(band.child(controls))
|
||||
}
|
||||
|
||||
/// The clip itself: the largest 16:9 box that fits, on black, with a message when there is no
|
||||
/// file to play.
|
||||
fn video_stage(app: &App, p: Paint) -> El {
|
||||
@@ -720,7 +800,8 @@ fn video_stage(app: &App, p: Paint) -> El {
|
||||
.fill(rune::Color::BLACK)
|
||||
.radius(radius::LG)
|
||||
.clip_soft(radius::LG)
|
||||
.center();
|
||||
.center()
|
||||
.on_double_press(|app: &mut App| app.review.fullscreen = true);
|
||||
|
||||
match &app.review.player {
|
||||
Some(player) => stage.child(
|
||||
@@ -782,6 +863,67 @@ fn transport(app: &App, p: Paint) -> El {
|
||||
.w_full()
|
||||
.center_y()
|
||||
.gap(space::S2)
|
||||
.child(playback(app, p))
|
||||
.child(volume(app, p))
|
||||
.child(ui::button(
|
||||
p,
|
||||
"fullscreen",
|
||||
"Full screen",
|
||||
false,
|
||||
|app: &mut App| app.review.fullscreen = true,
|
||||
))
|
||||
.child(el().grow(1.0));
|
||||
if let Some(note) = &app.review.export_note {
|
||||
bar = bar.child(
|
||||
text(note.clone())
|
||||
.key("export-note")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
);
|
||||
}
|
||||
let bar = bar
|
||||
.child(ui::button(
|
||||
p,
|
||||
"clip",
|
||||
"Clip",
|
||||
app.review.clip.is_some(),
|
||||
|app: &mut App| app.review.toggle_clip(),
|
||||
))
|
||||
.child(ui::button(
|
||||
p,
|
||||
"toggle-details",
|
||||
&if app.review.show_details {
|
||||
"Hide details".to_string()
|
||||
} else {
|
||||
format!("Highlights · {count}")
|
||||
},
|
||||
false,
|
||||
|app: &mut App| {
|
||||
app.review.show_details = !app.review.show_details;
|
||||
},
|
||||
));
|
||||
|
||||
let mut column = col()
|
||||
.key("transport-bar")
|
||||
.w_full()
|
||||
.gap(space::S2)
|
||||
.child(bar);
|
||||
if let Some(line) = channels(app, p) {
|
||||
column = column.child(line);
|
||||
}
|
||||
if let Some(clip) = app.review.clip {
|
||||
column = column.child(clip_row(app, p, clip));
|
||||
}
|
||||
column
|
||||
}
|
||||
|
||||
/// Back ten seconds, play or pause, forward ten, and the clock: the bar and the full screen
|
||||
/// picture show the same controls.
|
||||
fn playback(app: &App, p: Paint) -> El {
|
||||
row()
|
||||
.key("playback")
|
||||
.center_y()
|
||||
.gap(space::S2)
|
||||
.child(ui::media_button(
|
||||
p,
|
||||
"rewind",
|
||||
@@ -828,52 +970,7 @@ fn transport(app: &App, p: Paint) -> El {
|
||||
.font(type_::MONO_CAPTION)
|
||||
.color(p.muted()),
|
||||
)
|
||||
.child(volume(app, p))
|
||||
.child(el().grow(1.0));
|
||||
if let Some(note) = &app.review.export_note {
|
||||
bar = bar.child(
|
||||
text(note.clone())
|
||||
.key("export-note")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
);
|
||||
}
|
||||
let bar = bar
|
||||
.child(ui::button(
|
||||
p,
|
||||
"clip",
|
||||
"Clip",
|
||||
app.review.clip.is_some(),
|
||||
|app: &mut App| app.review.toggle_clip(),
|
||||
))
|
||||
.child(ui::button(
|
||||
p,
|
||||
"toggle-details",
|
||||
&if app.review.show_details {
|
||||
"Hide details".to_string()
|
||||
} else {
|
||||
format!("Highlights · {count}")
|
||||
},
|
||||
false,
|
||||
|app: &mut App| {
|
||||
app.review.show_details = !app.review.show_details;
|
||||
},
|
||||
));
|
||||
|
||||
let mut column = col()
|
||||
.key("transport-bar")
|
||||
.w_full()
|
||||
.gap(space::S2)
|
||||
.child(bar);
|
||||
if let Some(line) = channels(app, p) {
|
||||
column = column.child(line);
|
||||
}
|
||||
if let Some(clip) = app.review.clip {
|
||||
column = column.child(clip_row(app, p, clip));
|
||||
}
|
||||
column
|
||||
}
|
||||
|
||||
/// One toggle per audio track, shown once the clip carries more than one. A track that is off
|
||||
/// is neither heard nor kept in an export.
|
||||
fn channels(app: &App, p: Paint) -> Option<El> {
|
||||
|
||||
Reference in new issue
Block a user