mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-21 02:09:25 +08:00
fix(meetings): clarify the inherited-window predicate
This commit is contained in:
@@ -338,7 +338,7 @@ impl Capsule {
|
||||
/// takes the pointer.
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
fn fit_recording_window(&self) {
|
||||
if self.presentation.from_offer() {
|
||||
if self.presentation.inherits_offer_window() {
|
||||
return;
|
||||
}
|
||||
if let (Some(resize), Some(Kind::Recording(shown))) = (&self.resize, &self.kind) {
|
||||
@@ -506,7 +506,7 @@ impl Capsule {
|
||||
|
||||
/// The capsule's window size, for snapping a drag.
|
||||
fn window_size(&self) -> (f32, f32) {
|
||||
if self.presentation.from_offer() {
|
||||
if self.presentation.inherits_offer_window() {
|
||||
return self.presentation.window();
|
||||
}
|
||||
match &self.kind {
|
||||
@@ -1700,7 +1700,7 @@ mod tests {
|
||||
commands.try_recv(),
|
||||
Ok(ControllerCommand::Record(candidate, Some(_))) if candidate.key == "meeting-slack"
|
||||
));
|
||||
assert!(rt.state.presentation.from_offer());
|
||||
assert!(rt.state.presentation.inherits_offer_window());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -104,7 +104,7 @@ pub(super) fn actions(
|
||||
.build_push(p.k),
|
||||
};
|
||||
face.key(key).on_press(move |c: &mut Capsule| {
|
||||
if !c.presentation.from_offer()
|
||||
if !c.presentation.inherits_offer_window()
|
||||
&& c.more_open == choosing
|
||||
&& matches!(c.kind, Some(Kind::Offer(shown, _)) if shown == id)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ pub(super) fn actions(
|
||||
|
||||
impl Capsule {
|
||||
fn record_offer(&mut self) {
|
||||
if self.presentation.from_offer() {
|
||||
if self.presentation.inherits_offer_window() {
|
||||
return;
|
||||
}
|
||||
let Some(Kind::Offer(id, candidate)) = &self.kind else {
|
||||
@@ -203,7 +203,7 @@ impl Capsule {
|
||||
}
|
||||
|
||||
pub(super) fn expire_offer(&mut self) {
|
||||
if self.presentation.from_offer() {
|
||||
if self.presentation.inherits_offer_window() {
|
||||
return;
|
||||
}
|
||||
let Some(Kind::Offer(id, candidate)) = &self.kind else {
|
||||
|
||||
@@ -407,7 +407,7 @@ fn pending_offers_never_mask_a_failure_or_adopt_another_start() {
|
||||
let (mut rt, rx, _) = runtime(offer(slack_huddle()), false, false, PANEL);
|
||||
drop(rx); // A rejected send is still an offer, not a pending recording.
|
||||
tap(&mut rt, "record");
|
||||
assert!(!rt.state.presentation.from_offer());
|
||||
assert!(!rt.state.presentation.inherits_offer_window());
|
||||
assert!(rt.find("record").is_some() && rt.find("elapsed").is_none());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Reveal {
|
||||
}
|
||||
|
||||
impl Presentation {
|
||||
pub(super) fn from_offer(&self) -> bool {
|
||||
pub(super) fn inherits_offer_window(&self) -> bool {
|
||||
self.travel.at.is_some() || self.departure.is_some()
|
||||
}
|
||||
pub(super) fn begin(&mut self, id: OfferId, candidate: MeetingCandidate) {
|
||||
@@ -340,7 +340,7 @@ fn draw(p: Paint, dark: Paint, c: &Capsule, id: OfferId, candidate: &MeetingCand
|
||||
)
|
||||
.child(row().key("actions").gap(8.0).children(actions))
|
||||
.opacity(alpha * (1. - t * 3.).max(0.));
|
||||
let page = if a.from_offer() || rules != c.more_open || alpha < 0.2 {
|
||||
let page = if a.inherits_offer_window() || rules != c.more_open || alpha < 0.2 {
|
||||
page.inert().a11y_hidden()
|
||||
} else {
|
||||
page
|
||||
@@ -348,7 +348,7 @@ fn draw(p: Paint, dark: Paint, c: &Capsule, id: OfferId, candidate: &MeetingCand
|
||||
let radius = lerp(panel_radius(p), REST_HEIGHT * 0.5);
|
||||
let label = match &c.kind {
|
||||
Some(Kind::Recording(r)) => format!("{} · {}", tr("Recording"), r.title),
|
||||
_ if a.from_offer() => tr("Starting…").to_owned(),
|
||||
_ if a.inherits_offer_window() => tr("Starting…").to_owned(),
|
||||
_ => title,
|
||||
};
|
||||
let mut shell = row()
|
||||
@@ -426,7 +426,7 @@ fn draw(p: Paint, dark: Paint, c: &Capsule, id: OfferId, candidate: &MeetingCand
|
||||
.child(region(radius, h - 2. * radius, 0.))
|
||||
.children(bands)
|
||||
.on_pointer_move(|c: &mut Capsule, p| {
|
||||
if !c.presentation.from_offer() {
|
||||
if !c.presentation.inherits_offer_window() {
|
||||
c.presentation.pointer = Some((p.x, p.y));
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user