Merge pull request #4781 from storytold/fix/shared-edge-panel-fields

Path Precision Tools: the Shared Edges fields read like the others in the panel
This commit is contained in:
BFlat
2026-10-31 07:57:58 +07:00
committed by GitHub
@@ -5,13 +5,15 @@ use egui::Ui;
use serde_json::{Value, json};
use vectorcraft_tools::addons::shared_edge::{COINCIDENCE, DIAMETER, DIAMETER_RANGE, ID, MAX_COINCIDENCE};
use super::{LABEL_W, run};
use super::run;
use crate::VectorcraftApp;
use crate::widgets;
/// The menu's command: the tool, with the panel its values are in.
pub const COMMAND: &str = "addon.pathtools.sharedEdgeTool";
const FIELD_W: f32 = 96.0;
/// Wide enough for "Coincidence:".
const LABEL_W: f32 = 80.0;
/// Object › Plug-ins › Path Precision Tools › Shared Edge Merge Tool.
pub fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
@@ -27,12 +29,12 @@ pub(super) fn section(app: &mut VectorcraftApp, ui: &mut Ui) {
widgets::subheader(ui, "Shared Edges");
let mut set: Option<Value> = None;
widgets::label_row(ui, tl!("Diameter:"), LABEL_W, |ui| {
if let Some(v) = widgets::range_field(ui, "shared-edge-diameter", diameter, DIAMETER_RANGE.0..=DIAMETER_RANGE.1, "pt", 2, FIELD_W) {
if let Some(v) = widgets::range_field(ui, "shared-edge-diameter", diameter, DIAMETER_RANGE.0..=DIAMETER_RANGE.1, " pt", 2, FIELD_W) {
set = Some(json!({ "diameter": v }));
}
});
widgets::label_row(ui, tl!("Coincidence:"), LABEL_W, |ui| {
if let Some(v) = widgets::range_field(ui, "shared-edge-tolerance", tolerance, 0.0..=MAX_COINCIDENCE, "pt", 3, FIELD_W) {
if let Some(v) = widgets::range_field(ui, "shared-edge-tolerance", tolerance, 0.0..=MAX_COINCIDENCE, " pt", 3, FIELD_W) {
set = Some(json!({ "tolerance": v }));
}
});