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
3 changes: 2 additions & 1 deletion crates/ui-egui/src/panes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5209,7 +5209,8 @@ fn symbol_editor(app: &mut RustGisApp, ui: &mut Ui, s: Symbol, g: GeometryType,
});
egui::Grid::new("symbol_grid").num_columns(2).spacing(vec2(10.0, 6.0)).show(ui, |ui| {
if g != GeometryType::Polyline {
ui.label(tl!("Color"));
// The same name as the ribbon's Drawing group gives this `layer.color` button.
ui.label(tl!("Fill"));
let mut c = c32(s.fill);
let resp = crate::widgets::color_button(ui, &mut c);
if resp.changed() {
Expand Down
15 changes: 14 additions & 1 deletion crates/ui-egui/src/ribbon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4402,7 +4402,9 @@ fn drawing_group(app: &mut RustGisApp, ui: &mut Ui, layer: &rustgis_engine::map:
crate::widgets::one_step_per_press(app, &resp);
let _ = app.run("layer.color", json!({"color": crate::theme::rgba(c).hex8()}));
}
ui.label(egui::RichText::new(tl!("Color")).size(11.5));
// A line has no inside: its colour is the line's (the outline is the "Outline" width below).
let name = if layer.geometry_type() == GeometryType::Polyline { tl!("Color") } else { tl!("Fill") };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (naming, non-blocking): the same layer.color command is still labelled "Color" for polygon and point layers in the Symbology pane (crates/ui-egui/src/panes.rs, symbol_editor, about line 5212), and its command title is "Symbol Color". After this change the ribbon says "Fill" for that command. docs/contributing.md › Ribbon guidelines asks for one name per thing across ribbon, panes and Command Search. Aligning the pane label, or noting the difference in the PR, would satisfy that. Naming can wait for the release quality pass if you prefer.

ui.label(egui::RichText::new(name).size(11.5));
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
});
let mut w = layer.renderer.base_symbol().stroke_width;
ui.horizontal(|ui| {
Expand Down Expand Up @@ -5291,6 +5293,17 @@ mod tests {
assert!(h.query_by_label("No Fill").is_some());
}

#[test]
fn drawing_names_the_colour_by_what_it_changes() {
let mut h = drawing_harness();
for (layer, fill) in [("Countries", true), ("Cities", true), ("Rivers", false)] {
h.state_mut().run("layer.select", json!({"layer": layer})).unwrap();
h.run();
// The colour well itself is also labelled "Color", so only "Fill" tells the two apart.
assert_eq!(h.query_by_label("Fill").is_some(), fill, "{layer}");
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
}

/// Drags a number of the harness from `at` by 16, 32 and 48 points, calling `each` between.
fn drag_by(h: &mut egui_kittest::Harness<'static, RustGisApp>, at: egui::Pos2, mut each: impl FnMut(&RustGisApp)) {
h.hover_at(at);
Expand Down
Loading