Identify Objects By: rustfmt

This commit is contained in:
bflatastic committed 2026-10-14 05:13:36 +07:00
1 parent 958c1dffe8
commit bc50c7fa56
4 files changed
+4 -19

No files matched your search

+1 -5
View File
@@ -91,11 +91,7 @@ fn strip_unique(id: &str) -> &str {
return id;
};
let digits = body.get(at + 1..).unwrap_or_default();
if digits.len() >= 20 && digits.bytes().all(|b| b.is_ascii_digit()) {
body.get(..at).unwrap_or(id)
} else {
id
}
if digits.len() >= 20 && digits.bytes().all(|b| b.is_ascii_digit()) { body.get(..at).unwrap_or(id) } else { id }
}
#[cfg(test)]
+1 -4
View File
@@ -377,10 +377,7 @@ fn check_options(cmd: &str, p: &Value, xml_id: bool) -> Result<()> {
&& let Some(name) = str_param(p, "name").filter(|n| !n.trim().is_empty())
&& !vectorcraft_doc::xml_id::is_valid(name)
{
return Err(bad(
cmd,
"Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces)",
));
return Err(bad(cmd, "Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces)"));
}
Ok(())
}
+1 -5
View File
@@ -96,11 +96,7 @@ pub fn open_new(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
let sublayer = p.get("sublayer").and_then(Value::as_bool).unwrap_or(false);
let color = LayerColor::Preset((layers.len() % LAYER_COLORS.len()) as u8);
let name = format!("Layer {i}");
let name = if app.session.prefs.identify_objects_by == "xmlId" {
vectorcraft_doc::xml_id::from_object_name(&name)
} else {
name
};
let name = if app.session.prefs.identify_objects_by == "xmlId" { vectorcraft_doc::xml_id::from_object_name(&name) } else { name };
let fields = json!({
"mode": if sublayer { "newSublayer" } else { "new" }, "layer": true, "name": name, "color": color_field(color),
"template": false, "locked": false, "visible": true, "printable": true, "preview": true, "dimImages": false, "dimPercent": 50,
+1 -5
View File
@@ -691,11 +691,7 @@ fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) {
});
// Name (Preferences › Units › Identify Objects By: Object Name or XML ID).
let xml_id = view.identify_xml_id;
let name = if doc.mask_edit.is_some_and(|m| m.layer == n.id) {
"<Opacity Mask>".to_string()
} else {
n.identify_label(xml_id)
};
let name = if doc.mask_edit.is_some_and(|m| m.layer == n.id) { "<Opacity Mask>".to_string() } else { n.identify_label(xml_id) };
let font = egui::FontId::proportional(13.0);
let renaming: Option<(u64, String)> = ui.data(|d| d.get_temp(rename_id()));
let name_rect = egui::Rect::from_min_max(egui::pos2(x - 2.0, r.center().y - 10.0), egui::pos2(r.right() - 44.0, r.center().y + 10.0));