Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/layout/publication/arrangement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub(in crate::cmd::layout) fn arrangement_label(v: &Value, homes: Homes, saved:
}

/// The corners of an arrangement, by surround.
pub(in crate::cmd::layout) fn corners_of(homes: Homes) -> Value {
pub fn corners_of(homes: Homes) -> Value {
Value::Object(ARRANGEMENT_KEYS.iter().zip(homes).map(|(k, h)| ((*k).to_string(), json!(CORNER_NAMES[h]))).collect())
}

Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/layout/publication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(in crate::cmd::layout) fn landscape_suits(aspect: f64, short: f64, long: f64
// An edge sheet's map takes the page's whole width.
let sides = if style == Style::Edge { 0.0 } else { 30.0 * k };
let (iw, ih) = (w - sides, h - texts);
let fw = if matches!(style, Style::Panel | Style::Editorial | Style::Modular) { 0.68 * iw } else { iw };
let fw = if style.has_column() { 0.68 * iw } else { iw };
let (fw, fh) = (fw - 2.0 * LABEL_ROOM_SIDE * k, ih - 2.0 * LABEL_ROOM_END * k);
fw.min(fh / aspect.max(1e-6))
};
Expand Down
11 changes: 11 additions & 0 deletions crates/engine/src/cmd/layout/publication/sheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ pub fn publication_style_accent(style: &str) -> Option<Rgba> {
Style::parse(style).map(Style::accent)
}

/// Whether a [`PUBLICATION_STYLES`] style id keeps the locator and legend in a column beside the
/// map, leaving only the north arrow and scale bar to the frame's corners.
pub fn publication_style_has_column(style: &str) -> bool {
Style::parse(style).is_some_and(Style::has_column)
}

/// How a publication sheet is arranged around its map.
#[derive(Clone, Copy, PartialEq, Debug)]
pub(in crate::cmd::layout) enum Style {
Expand Down Expand Up @@ -144,6 +150,11 @@ impl Style {
}
}

/// Whether it has a column beside the map for the locator and legend.
pub(in crate::cmd::layout) fn has_column(self) -> bool {
matches!(self, Style::Panel | Style::Editorial | Style::Modular)
}

/// Whether its surrounds sit on cards with rounded corners.
pub(in crate::cmd::layout) fn cards(self) -> bool {
matches!(self, Style::Modular | Style::Poster)
Expand Down
5 changes: 5 additions & 0 deletions crates/ui-egui/src/publicationwizard/accent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,28 @@ mod tests {
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
h.get_by_label("Poster").click();
h.run_steps(2);
assert_eq!(h.state().dialogs.publication.as_ref().unwrap().accent, Some(poster), "re-seeded to Poster");
// Unticking on Poster must not remember Banner's or Poster's default as a custom colour.
click(&mut h, "Next");
click(&mut h, "Next");
click(&mut h, "Next");
click(&mut h, "Next");
h.get_by_label("Pick a colour of your own").click();
h.run_steps(2);
assert_eq!(h.state().dialogs.publication.as_ref().unwrap().accent, None);
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
h.get_by_label("Editorial").click();
h.run_steps(2);
click(&mut h, "Next");
click(&mut h, "Next");
click(&mut h, "Next");
click(&mut h, "Next");
h.get_by_label("Pick a colour of your own").click();
h.run_steps(2);
assert_eq!(h.state().dialogs.publication.as_ref().unwrap().accent, Some(editorial), "starts from Editorial");
Expand All @@ -140,6 +144,7 @@ mod tests {
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
click(&mut h, "Back");
h.get_by_label("Banner").click();
h.run_steps(2);
assert_eq!(h.state().dialogs.publication.as_ref().unwrap().accent, Some(red), "custom colour kept");
Expand Down
Loading
Loading