mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 13:17:19 -06:00
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:
@@ -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 }));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user