forked from 1b-agent/opencadstudio-upstream
fix: open-issue sweep — drawing, plot, snap, layout and UI fixes
Fixes: - Font prompt no longer lists bundled ltypeshp/qcadshp shape files (#1626) - Wide polylines step at a discontinuous segment width; PEDIT marks the current vertex; keyword steps refresh the command preview (#1628) - Radius-0 fillet drops the zero-length segment it left, so the corner fillets again (#1422) - FILLET Trim / No trim option (#1558) - True-colour wires plot in their own colour; colour picker stores the value it shows (#1621) - Model tab keeps its page setup; "Save changes to layout" in Model (#1620) - QNEW default template in Options > Files; .dwt in the open dialog (#1134, #1113) - GRIDUNIT / GRIDMODE / PERSPECTIVE variables (#1618, #1524) - PTYPE (#1433) - ZOOM nX / nXP (#1465) - CHSPACE between model and paper space through a viewport (#1428) - Moving a dimension keeps its automatic text placement - Shell icon; "&&" button labels (#1554) - LINETYPE Load from a .lin file (#1588) - XLINE / RAY hide the crosshair arms (#1437) - Dynamic-input boxes keep clear of the crosshair and each other (#1546) - Snap marker colour setting, dark default on light canvases (#1497, #1229, #1128) - Dimension style precision as a 0.00 pattern dropdown (#1426) - Node graph nodes left of the origin no longer clip away (#1592) - Collapse button in the command history header (#1094) - Freeze-in-current-viewport toggle in the ribbon layer list (#1466) - Geometric Center object snap for closed polylines (#1369) New strings translated in all 21 locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abf302eba5
commit
178c7dff41
70 files changed
+1227
-145
No files matched your search
@@ -677,6 +677,7 @@ impl OpenCADStudio {
|
||||
None
|
||||
};
|
||||
let is_escape = matches!(&input, StepInput::Escape);
|
||||
let keyed = matches!(&input, StepInput::Text(_) | StepInput::Enter);
|
||||
let result: Option<CmdResult> = {
|
||||
let Some(cmd) = self.tabs[i].active_cmd.as_mut() else {
|
||||
return (Task::none(), false);
|
||||
@@ -703,7 +704,15 @@ impl OpenCADStudio {
|
||||
self.tabs[i].pending_pause_tokens = None;
|
||||
}
|
||||
match result {
|
||||
Some(r) => (self.apply_cmd_result(r), true),
|
||||
Some(r) => {
|
||||
let task = self.apply_cmd_result(r);
|
||||
// A keyword can move the step without the cursor moving
|
||||
// (PEDIT Next vertex): redraw its preview now (#1628).
|
||||
if keyed && self.active_tab == i {
|
||||
self.refresh_active_cmd_preview(i);
|
||||
}
|
||||
(task, true)
|
||||
}
|
||||
None => (Task::none(), false),
|
||||
}
|
||||
}
|
||||
|
||||
+20
-4
@@ -911,13 +911,29 @@ impl OpenCADStudio {
|
||||
.or_else(|| cmd.strip_prefix("ZOOM S "))
|
||||
.or_else(|| cmd.strip_prefix("ZS "))
|
||||
.unwrap_or("1");
|
||||
if let Ok(factor) = rest.trim().parse::<f32>() {
|
||||
if factor > 0.0 {
|
||||
self.tabs[i].scene.remember_current_view();
|
||||
self.tabs[i].scene.zoom_camera(1.0 / factor);
|
||||
// nXP scales the active viewport against paper space, nX (or
|
||||
// a bare n) the current view (#1465). n may be an expression
|
||||
// such as 1/50.
|
||||
let rest = rest.trim().to_ascii_uppercase();
|
||||
let (number, xp) = match rest.strip_suffix("XP") {
|
||||
Some(n) => (n, true),
|
||||
None => (rest.strip_suffix('X').unwrap_or(&rest), false),
|
||||
};
|
||||
let factor = crate::app::expr_eval::eval_number(number.trim())
|
||||
.filter(|f| f.is_finite() && *f > 0.0);
|
||||
match factor {
|
||||
Some(factor) if xp && self.tabs[i].scene.set_viewport_scale_factor(factor) => {
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line
|
||||
.push_output(crate::tf!("Zoom Scale ×{factor:.3}").as_ref());
|
||||
}
|
||||
Some(factor) => {
|
||||
self.tabs[i].scene.remember_current_view();
|
||||
self.tabs[i].scene.zoom_camera(1.0 / factor as f32);
|
||||
self.command_line
|
||||
.push_output(crate::tf!("Zoom Scale ×{factor:.3}").as_ref());
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -634,6 +634,9 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"FITSPLINE",
|
||||
// System variables (typeable directly).
|
||||
"MIRRTEXT",
|
||||
"PERSPECTIVE",
|
||||
"GRIDMODE",
|
||||
"GRIDUNIT",
|
||||
"ZOOMWHEEL",
|
||||
"ZOOMFACTOR",
|
||||
"SHORTCUTMENU",
|
||||
@@ -844,6 +847,7 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"MLSTYLE",
|
||||
"MS",
|
||||
"MSPACE",
|
||||
"CHSPACE",
|
||||
"NAVVCUBE",
|
||||
"NEW",
|
||||
"OBJIMPORT",
|
||||
|
||||
@@ -3,6 +3,65 @@ use super::*;
|
||||
impl OpenCADStudio {
|
||||
pub(super) fn dispatch_styleprops(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
match cmd {
|
||||
// View / grid variables held by the app rather than the header,
|
||||
// typed bare or through SETVAR (#1524, #1618).
|
||||
cmd if matches!(
|
||||
cmd.strip_prefix("SETVAR ").unwrap_or(cmd).split_whitespace().next(),
|
||||
Some("PERSPECTIVE" | "GRIDMODE" | "GRIDUNIT")
|
||||
) =>
|
||||
{
|
||||
let mut words = cmd.strip_prefix("SETVAR ").unwrap_or(cmd).splitn(2, ' ');
|
||||
let name = words.next().unwrap_or_default().to_string();
|
||||
let value = words.next().map(str::trim).filter(|v| !v.is_empty());
|
||||
let current = match name.as_str() {
|
||||
"PERSPECTIVE" => {
|
||||
let persp = self.tabs[i].scene.camera.borrow().projection
|
||||
== crate::scene::Projection::Perspective;
|
||||
(persp as i32).to_string()
|
||||
}
|
||||
"GRIDMODE" => (self.show_grid as i32).to_string(),
|
||||
_ => format!("{},{}", self.grid_spacing_x, self.grid_spacing_y),
|
||||
};
|
||||
let Some(value) = value else {
|
||||
self.command_line
|
||||
.push_output(&crate::tf!("Enter new value for {name} <{current}>:"));
|
||||
self.pending_setvar = Some(name);
|
||||
return Some(Task::none());
|
||||
};
|
||||
match (name.as_str(), value) {
|
||||
("PERSPECTIVE", "0" | "1") => {
|
||||
return Some(Task::done(Message::SetProjection(value == "0")));
|
||||
}
|
||||
("GRIDMODE", "0" | "1") => {
|
||||
if (value == "1") != self.show_grid {
|
||||
return Some(Task::done(Message::ToggleGrid));
|
||||
}
|
||||
}
|
||||
("GRIDUNIT", _) => {
|
||||
let mut parts = value.split(',').map(|p| p.trim().parse::<f32>());
|
||||
let x = parts.next().and_then(Result::ok).filter(|v| *v > 0.0);
|
||||
let y = match parts.next() {
|
||||
Some(p) => p.ok().filter(|v| *v > 0.0),
|
||||
None => x,
|
||||
};
|
||||
let (Some(x), Some(y)) = (x, y) else {
|
||||
self.command_line.push_error(
|
||||
crate::t!("Requires two positive values (x,y) or one for both.")
|
||||
.as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
};
|
||||
self.grid_spacing_x = x;
|
||||
self.grid_spacing_y = y;
|
||||
self.sync_vport_display(i);
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
_ => self
|
||||
.command_line
|
||||
.push_error(crate::t!("Requires 0 or 1").as_ref()),
|
||||
}
|
||||
return Some(Task::none());
|
||||
}
|
||||
"CETRANSPARENCY" => return self.dispatch_styleprops("SETVAR CETRANSPARENCY", i),
|
||||
cmd if cmd.starts_with("CETRANSPARENCY ") => {
|
||||
return self.dispatch_styleprops(&format!("SETVAR {cmd}"), i);
|
||||
@@ -84,9 +143,10 @@ impl OpenCADStudio {
|
||||
use crate::command::KeywordCommand;
|
||||
let c = KeywordCommand::new(
|
||||
"LINETYPE",
|
||||
"LINETYPE [List / Set]:",
|
||||
"LINETYPE [List / Set / Load]:",
|
||||
vec![
|
||||
("List", "LIST", None),
|
||||
("Load", "LOAD", None),
|
||||
("Set", "SET", Some("LINETYPE SET linetype name (ByLayer / ByBlock / …):")),
|
||||
],
|
||||
);
|
||||
@@ -98,6 +158,13 @@ impl OpenCADStudio {
|
||||
let parts: Vec<&str> = raw_rest.split_whitespace().collect();
|
||||
let sub = parts.get(0).map(|s| s.to_uppercase()).unwrap_or_default();
|
||||
match sub.as_str() {
|
||||
// Load the definitions of a `.lin` file (#1588).
|
||||
"LOAD" | "L" => {
|
||||
return Some(Task::perform(
|
||||
crate::io::pick_linetype_file(),
|
||||
Message::LinetypeLoaded,
|
||||
));
|
||||
}
|
||||
"" | "LIST" | "?" => {
|
||||
let ltypes: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
@@ -3247,7 +3314,7 @@ impl OpenCADStudio {
|
||||
);
|
||||
}
|
||||
}
|
||||
cmd if cmd == "DDPTYPE" => {
|
||||
cmd if cmd == "DDPTYPE" || cmd == "PTYPE" => {
|
||||
// The dialog shows the magnitude; the sign (relative/absolute)
|
||||
// is driven by the radio buttons. A positive PDSIZE is absolute;
|
||||
// zero or negative is relative.
|
||||
|
||||
@@ -548,6 +548,102 @@ impl OpenCADStudio {
|
||||
return Some(Task::done(Message::PspaceCommand));
|
||||
}
|
||||
|
||||
// ── CHSPACE — move objects between model and paper space through
|
||||
// a viewport, keeping their apparent size and place (#1428).
|
||||
// Inside a viewport the selection goes to the sheet; on the
|
||||
// sheet it goes into the model through the viewport under it.
|
||||
"CHSPACE" => {
|
||||
let handles: Vec<codec::Handle> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
.into_iter()
|
||||
.map(|(h, _)| h)
|
||||
.collect();
|
||||
if self.tabs[i].scene.current_layout == "Model" {
|
||||
self.command_line
|
||||
.push_error(crate::t!("CHSPACE: Command not allowed in the Model tab.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
if handles.is_empty() {
|
||||
use crate::modules::draw::select::SelectObjectsCommand;
|
||||
let cmd = SelectObjectsCommand::new("CHSPACE");
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
return Some(Task::none());
|
||||
}
|
||||
let scene = &self.tabs[i].scene;
|
||||
let to_paper = scene.active_viewport.is_some();
|
||||
let frame = match scene.active_viewport {
|
||||
Some(vp) => scene.viewport_frame(vp),
|
||||
None => {
|
||||
// The viewport under the middle of the selection.
|
||||
let (mut lo, mut hi) = (glam::DVec2::MAX, glam::DVec2::MIN);
|
||||
for wire in scene.wire_models_for(&handles) {
|
||||
let [x0, y0, x1, y1] = wire.aabb.map(f64::from);
|
||||
if [x0, y0, x1, y1].iter().all(|v| v.is_finite()) {
|
||||
lo = lo.min(glam::DVec2::new(x0, y0));
|
||||
hi = hi.max(glam::DVec2::new(x1, y1));
|
||||
}
|
||||
}
|
||||
let mid = (lo + hi) * 0.5;
|
||||
mid.is_finite()
|
||||
.then(|| scene.viewport_frames_at_paper_point(mid.extend(0.0)))
|
||||
.and_then(|frames| frames.into_iter().next())
|
||||
}
|
||||
};
|
||||
let Some(frame) = frame else {
|
||||
self.command_line.push_error(
|
||||
crate::t!("CHSPACE: No plan-view viewport to change space through.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
};
|
||||
use crate::command::EntityTransform as T;
|
||||
let z = glam::DVec3::Z;
|
||||
let steps = if to_paper {
|
||||
[
|
||||
T::Translate((-frame.model_target).extend(0.0)),
|
||||
T::Rotate { center: glam::DVec3::ZERO, axis: z, angle_rad: frame.twist },
|
||||
T::Scale { center: glam::DVec3::ZERO, factor: frame.scale },
|
||||
T::Translate(frame.paper_center.extend(0.0)),
|
||||
]
|
||||
} else {
|
||||
[
|
||||
T::Translate((-frame.paper_center).extend(0.0)),
|
||||
T::Scale { center: glam::DVec3::ZERO, factor: 1.0 / frame.scale },
|
||||
T::Rotate { center: glam::DVec3::ZERO, axis: z, angle_rad: -frame.twist },
|
||||
T::Translate(frame.model_target.extend(0.0)),
|
||||
]
|
||||
};
|
||||
self.push_undo_snapshot(i, "CHSPACE");
|
||||
let scene = &mut self.tabs[i].scene;
|
||||
let entities: Vec<codec::EntityType> = handles
|
||||
.iter()
|
||||
.filter_map(|h| scene.document.get_entity(*h).cloned())
|
||||
.collect();
|
||||
scene.deselect_all();
|
||||
scene.erase_entities(&handles);
|
||||
// The clones land in the other space: the sheet with no active
|
||||
// viewport, the model with one.
|
||||
let active = scene.active_viewport;
|
||||
scene.active_viewport = if to_paper { None } else { Some(frame.viewport) };
|
||||
let moved: Vec<codec::Handle> =
|
||||
entities.into_iter().map(|e| scene.add_entity_clone(e)).collect();
|
||||
scene.active_viewport = active;
|
||||
for step in &steps {
|
||||
scene.transform_entities(&moved, step);
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
let count = moved.len();
|
||||
self.command_line.push_output(
|
||||
if to_paper {
|
||||
crate::tf!("CHSPACE: {count} object(s) changed to paper space.")
|
||||
} else {
|
||||
crate::tf!("CHSPACE: {count} object(s) changed to model space.")
|
||||
}
|
||||
.as_ref(),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Viewport arrangement shortcuts ────────────────────────────
|
||||
// Tile the model viewports into preset splits. Each delegates to the
|
||||
// matching VPORTS configuration so the Model/paper handling stays in
|
||||
|
||||
@@ -88,6 +88,11 @@ impl OpenCADStudio {
|
||||
return;
|
||||
}
|
||||
let active = self.tabs[i].active_layer.clone();
|
||||
let vp_column = self.tabs[i].scene.active_viewport.and_then(|vp| {
|
||||
(self.tabs[i].scene.current_layout != "Model")
|
||||
.then(|| self.tabs[i].layers.vp_cols.iter().position(|c| c.handle == vp))
|
||||
.flatten()
|
||||
});
|
||||
let infos: Vec<crate::ui::ribbon::LayerInfo> = self.tabs[i]
|
||||
.layers
|
||||
.layers
|
||||
@@ -100,6 +105,8 @@ impl OpenCADStudio {
|
||||
visible: l.visible,
|
||||
frozen: l.frozen,
|
||||
locked: l.locked,
|
||||
vp_frozen: vp_column
|
||||
.map(|column| (column, l.vp_frozen.get(column).copied().unwrap_or(false))),
|
||||
})
|
||||
.collect();
|
||||
let names: Vec<String> = infos.iter().map(|l| l.name.clone()).collect();
|
||||
|
||||
@@ -590,6 +590,10 @@ pub(super) struct OpenCADStudio {
|
||||
crosshair_color: Option<[u8; 3]>,
|
||||
/// Editable Options buffer for the crosshair colour.
|
||||
crosshair_color_input: String,
|
||||
/// Explicit object-snap marker colour; `None` keeps the automatic one.
|
||||
snap_marker_color: Option<[u8; 3]>,
|
||||
/// Editable Options buffer for the snap marker colour.
|
||||
snap_marker_color_input: String,
|
||||
/// Defer the ISOLINES mesh rebuild until the slider is released.
|
||||
isolines_awaiting_regen: bool,
|
||||
/// Edit buffer for the SNAPANG field on the Options Drafting page. Kept
|
||||
@@ -1024,6 +1028,8 @@ pub(super) struct OpenCADStudio {
|
||||
check_missing_fonts: bool,
|
||||
/// Custom font source base URL; empty selects the community repository.
|
||||
font_source_url: String,
|
||||
/// Template a new drawing starts from (QNEW); empty = blank.
|
||||
qnew_template: String,
|
||||
/// Editable copy of `font_source_url` shown in the missing-fonts prompt.
|
||||
font_source_input: String,
|
||||
donation_prompt_version: String,
|
||||
@@ -2289,6 +2295,10 @@ pub enum Message {
|
||||
LineweightDisplayScaleChanged(i32),
|
||||
/// Edit the optional crosshair RGB value; blank restores automatic contrast.
|
||||
CrosshairColorChanged(String),
|
||||
SnapMarkerColorChanged(String),
|
||||
/// Options → Files: the default template for new drawings.
|
||||
QnewTemplateChanged(String),
|
||||
QnewTemplateBrowse,
|
||||
/// Set the default type/version used when first saving a new drawing.
|
||||
DefaultSaveFormatChanged(String),
|
||||
/// Select one of Iced's built-in themes or the editable Custom theme.
|
||||
@@ -3678,6 +3688,8 @@ pub enum Message {
|
||||
// ── Plot Style Table ─────────────────────────────────────────────────
|
||||
/// Open file dialog to load a CTB/STB plot style table.
|
||||
PlotStyleLoad,
|
||||
/// LINETYPE Load: the picked `.lin` file's text, `None` when cancelled.
|
||||
LinetypeLoaded(Option<String>),
|
||||
/// Callback when the user picks (or cancels) a CTB/STB file.
|
||||
/// The Load… picker finished: a table, nothing (cancelled), or why the
|
||||
/// file could not be read.
|
||||
@@ -4151,6 +4163,8 @@ impl OpenCADStudio {
|
||||
cursor_type: settings::CursorType::Crosshair,
|
||||
crosshair_color: None,
|
||||
crosshair_color_input: String::new(),
|
||||
snap_marker_color: None,
|
||||
snap_marker_color_input: String::new(),
|
||||
isolines_awaiting_regen: false,
|
||||
snap_angle_input: "0".to_string(),
|
||||
lineweight_display_scale: 100,
|
||||
@@ -4338,6 +4352,7 @@ impl OpenCADStudio {
|
||||
default_assoc_prompted: false,
|
||||
check_missing_fonts: true,
|
||||
font_source_url: String::new(),
|
||||
qnew_template: String::new(),
|
||||
font_source_input: String::new(),
|
||||
donation_prompt_version: String::new(),
|
||||
read_only: false,
|
||||
|
||||
@@ -251,6 +251,7 @@ const SNAP_ORDER: &[SnapType] = &[
|
||||
SnapType::Endpoint,
|
||||
SnapType::Midpoint,
|
||||
SnapType::Center,
|
||||
SnapType::GeometricCenter,
|
||||
SnapType::Node,
|
||||
SnapType::Quadrant,
|
||||
SnapType::Intersection,
|
||||
@@ -276,6 +277,7 @@ fn snap_bit(s: SnapType) -> Option<i32> {
|
||||
SnapType::Midpoint => 2,
|
||||
SnapType::Center => 4,
|
||||
SnapType::Node => 8,
|
||||
SnapType::GeometricCenter => 1024,
|
||||
SnapType::Quadrant => 16,
|
||||
SnapType::Intersection => 32,
|
||||
SnapType::Insertion => 64,
|
||||
@@ -430,6 +432,8 @@ pub struct UserSettings {
|
||||
pub cursor_type: CursorType,
|
||||
/// Explicit crosshair RGB. `None` keeps automatic background contrast.
|
||||
pub crosshair_color: Option<[u8; 3]>,
|
||||
/// Explicit object-snap marker RGB. `None` keeps the automatic colour.
|
||||
pub snap_marker_color: Option<[u8; 3]>,
|
||||
/// Model-space lineweight preview scale as a percentage.
|
||||
pub lineweight_display_scale: i32,
|
||||
/// Isometric drafting changes the grid and crosshair to the active axis
|
||||
@@ -459,6 +463,9 @@ pub struct UserSettings {
|
||||
/// so an intranet folder or a private GitHub raw folder both work.
|
||||
#[serde(default)]
|
||||
pub font_source_url: String,
|
||||
/// Drawing new tabs start from (QNEW template); empty = a blank drawing.
|
||||
#[serde(default)]
|
||||
pub qnew_template: String,
|
||||
/// App version whose donation prompt has been displayed.
|
||||
pub donation_prompt_version: String,
|
||||
/// The graphics verdict (`GpuStatus::identity()`) whose warning popup the
|
||||
@@ -819,6 +826,7 @@ impl Default for UserSettings {
|
||||
ncopy_bind: false,
|
||||
cursor_type: CursorType::Crosshair,
|
||||
crosshair_color: None,
|
||||
snap_marker_color: None,
|
||||
lineweight_display_scale: 100,
|
||||
isometric_drafting: false,
|
||||
iso_plane: IsoPlane::Left,
|
||||
@@ -827,6 +835,7 @@ impl Default for UserSettings {
|
||||
default_assoc_prompted: false,
|
||||
check_missing_fonts: true,
|
||||
font_source_url: String::new(),
|
||||
qnew_template: String::new(),
|
||||
donation_prompt_version: String::new(),
|
||||
gpu_warning_silenced: String::new(),
|
||||
disabled_plugins: Vec::new(),
|
||||
|
||||
@@ -1311,6 +1311,7 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.tabs[i]
|
||||
.layers
|
||||
.sync_with_viewports(&doc_layers, vp_info);
|
||||
self.sync_ribbon_layers();
|
||||
// Per-viewport layer visibility changes the resident
|
||||
// assembly, not any entity's tessellated geometry.
|
||||
self.tabs[i].scene.bump_geometry_no_blocks();
|
||||
|
||||
+13
-2
@@ -681,6 +681,7 @@ impl OpenCADStudio {
|
||||
ncopy_bind: self.ncopy_bind,
|
||||
cursor_type: self.cursor_type,
|
||||
crosshair_color: self.crosshair_color,
|
||||
snap_marker_color: self.snap_marker_color,
|
||||
lineweight_display_scale: self.lineweight_display_scale,
|
||||
isometric_drafting: self.isometric_drafting,
|
||||
iso_plane: self.iso_plane,
|
||||
@@ -689,6 +690,7 @@ impl OpenCADStudio {
|
||||
default_assoc_prompted: self.default_assoc_prompted,
|
||||
check_missing_fonts: self.check_missing_fonts,
|
||||
font_source_url: self.font_source_url.clone(),
|
||||
qnew_template: self.qnew_template.clone(),
|
||||
donation_prompt_version: self.donation_prompt_version.clone(),
|
||||
gpu_warning_silenced: self.gpu_warning_silenced.clone(),
|
||||
disabled_plugins: {
|
||||
@@ -791,6 +793,11 @@ impl OpenCADStudio {
|
||||
.crosshair_color
|
||||
.map(crate::app::config::rgb_to_hex)
|
||||
.unwrap_or_default();
|
||||
self.snap_marker_color = s.snap_marker_color;
|
||||
self.snap_marker_color_input = s
|
||||
.snap_marker_color
|
||||
.map(crate::app::config::rgb_to_hex)
|
||||
.unwrap_or_default();
|
||||
self.lineweight_display_scale = s.lineweight_display_scale.clamp(25, 200);
|
||||
self.isometric_drafting = s.isometric_drafting;
|
||||
self.iso_plane = s.iso_plane;
|
||||
@@ -808,6 +815,7 @@ impl OpenCADStudio {
|
||||
self.default_assoc_prompted = s.default_assoc_prompted;
|
||||
self.check_missing_fonts = s.check_missing_fonts;
|
||||
self.font_source_url = s.font_source_url.clone();
|
||||
self.qnew_template = s.qnew_template.clone();
|
||||
self.font_source_input = s.font_source_url.clone();
|
||||
self.donation_prompt_version = s.donation_prompt_version.clone();
|
||||
self.gpu_warning_silenced = s.gpu_warning_silenced.clone();
|
||||
@@ -3603,10 +3611,13 @@ impl OpenCADStudio {
|
||||
pub(super) fn apply_plot_page_settings(&mut self) {
|
||||
let i = self.active_tab;
|
||||
let layout_name = self.tabs[i].scene.current_layout.clone();
|
||||
let ps = self.plot_settings_from_dialog(self.dialog_base_settings());
|
||||
if layout_name == "Model" {
|
||||
// Model keeps its page setup too (#1620); it has no sheet limits.
|
||||
self.tabs[i].scene.set_layout_plot_settings(&layout_name, &ps);
|
||||
self.tabs[i].dirty = true;
|
||||
return;
|
||||
}
|
||||
let ps = self.plot_settings_from_dialog(self.dialog_base_settings());
|
||||
let (w, h) = plot_dialog_sheet_mm(&self.plot_dialog);
|
||||
let plot_area = self.plot_dialog.area.clone();
|
||||
let center = ps.flags.plot_centered;
|
||||
@@ -5360,7 +5371,7 @@ impl OpenCADStudio {
|
||||
// into it when "Save changes to layout" is on, so the page setup
|
||||
// remembers the last plot the way other applications expect. The
|
||||
// runtime paper/scale choices drive this one plot operation either way.
|
||||
if !preview && d.save_to_layout && d.paper_space {
|
||||
if !preview && d.save_to_layout {
|
||||
self.apply_dialog_to_layout();
|
||||
} else {
|
||||
self.sync_dialog_plot_runtime();
|
||||
|
||||
@@ -1877,6 +1877,20 @@ impl OpenCADStudio {
|
||||
self.sync_ribbon_from_selection();
|
||||
// A fresh drawing starts with grid/snap off (its tile defaults).
|
||||
self.adopt_view_display(self.active_tab);
|
||||
// QNEW: start from the default template when one is set (#1113).
|
||||
let template = self.qnew_template.trim().to_string();
|
||||
if !template.is_empty() {
|
||||
match self.apply_template(&template) {
|
||||
Ok(_) => {
|
||||
self.tabs[idx].dirty = false;
|
||||
self.refresh_layer_panel();
|
||||
self.sync_ribbon_styles();
|
||||
}
|
||||
Err(error) => self.command_line.push_error(
|
||||
error["error"].as_str().unwrap_or("template"),
|
||||
),
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -5809,6 +5823,10 @@ impl OpenCADStudio {
|
||||
if id == crate::modules::insert::insert_block::GALLERY_ID {
|
||||
self.refresh_block_palette();
|
||||
}
|
||||
// The per-viewport freeze column follows the active viewport.
|
||||
if id == crate::ui::ribbon::widgets::LAYER_COMBO_ID {
|
||||
self.refresh_layer_panel();
|
||||
}
|
||||
self.ribbon.toggle_dropdown(&id);
|
||||
}
|
||||
Task::none()
|
||||
@@ -8005,6 +8023,39 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::QnewTemplateChanged(path) => {
|
||||
self.qnew_template = path;
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
Message::QnewTemplateBrowse => Task::perform(
|
||||
async {
|
||||
crate::sys::file_dialog()
|
||||
.add_filter(
|
||||
crate::t!("Drawing Template (*.dwt)").as_ref(),
|
||||
&["dwt", "DWT", "dwg", "DWG", "dxf", "DXF"],
|
||||
)
|
||||
.pick_file()
|
||||
.await
|
||||
.map(|handle| crate::sys::handle_path(&handle).display().to_string())
|
||||
},
|
||||
|path| match path {
|
||||
Some(path) => Message::QnewTemplateChanged(path),
|
||||
None => Message::Noop,
|
||||
},
|
||||
),
|
||||
Message::SnapMarkerColorChanged(value) => {
|
||||
self.snap_marker_color_input = value.clone();
|
||||
if value.trim().is_empty() {
|
||||
self.snap_marker_color = None;
|
||||
self.persist_settings_if_changed();
|
||||
} else if let Some(rgb) = crate::app::config::parse_hex(&value) {
|
||||
self.snap_marker_color = Some(rgb);
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::DefaultSaveFormatChanged(format) => {
|
||||
self.default_save_format = crate::io::canonical_save_format(&format).to_string();
|
||||
self.persist_settings_if_changed();
|
||||
@@ -9835,6 +9886,22 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── Plot Style Table ──────────────────────────────────────────────
|
||||
Message::LinetypeLoaded(Some(source)) => {
|
||||
let i = self.active_tab;
|
||||
self.push_undo_snapshot(i, "LINETYPE");
|
||||
let added = crate::io::linetypes::populate_document_from_source(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&source,
|
||||
);
|
||||
if added > 0 {
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].scene.bump_geometry();
|
||||
}
|
||||
self.command_line
|
||||
.push_output(crate::tf!("{added} linetype(s) loaded.").as_ref());
|
||||
Task::none()
|
||||
}
|
||||
Message::LinetypeLoaded(None) => Task::none(),
|
||||
Message::PlotStyleLoad => {
|
||||
Task::perform(crate::io::pick_plot_style(), Message::PlotStyleLoaded)
|
||||
}
|
||||
|
||||
@@ -925,6 +925,13 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
iso_plane: self.iso_plane,
|
||||
snap_angle_deg: self.snap_angle_deg,
|
||||
pick_pending: self.pending_pick_label().is_some(),
|
||||
// An infinite-line preview runs along the arms; drop them
|
||||
// so the preview stays visible (#1437).
|
||||
hide_arms: tab
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.is_some_and(|c| matches!(c.name(), "XLINE" | "RAY")),
|
||||
snap_color: self.snap_marker_color,
|
||||
},
|
||||
crate::ui::overlay::SelectionVisualOptions {
|
||||
area: self.model_space.selection_area,
|
||||
|
||||
@@ -383,11 +383,14 @@ impl OpenCADStudio {
|
||||
crate::ui::window::options::Folders::default()
|
||||
}
|
||||
},
|
||||
&self.qnew_template,
|
||||
self.double_click_block_refedit,
|
||||
self.double_click_block_attedit,
|
||||
self.cursor_type,
|
||||
self.crosshair_color,
|
||||
&self.crosshair_color_input,
|
||||
self.snap_marker_color,
|
||||
&self.snap_marker_color_input,
|
||||
self.lineweight_display_scale,
|
||||
&self.model_space,
|
||||
&self.model_bg_input,
|
||||
|
||||
+16
-7
@@ -951,25 +951,34 @@ pub(crate) fn tapered_band_points(
|
||||
let seg_count = if is_closed { n } else { n.saturating_sub(1) };
|
||||
let mut pts: Vec<[f64; 3]> = Vec::with_capacity(seg_count + 1);
|
||||
let mut widths: Vec<f32> = Vec::with_capacity(seg_count + 1);
|
||||
let mut push = |x: f64, y: f64, w: f32| {
|
||||
let (wx, wy, wz) = to_wcs(x, y);
|
||||
pts.push([wx, wy, wz]);
|
||||
let mut push = |xy: Option<(f64, f64)>, w: f32| {
|
||||
// `None` is the NaN separator that breaks the band.
|
||||
pts.push(xy.map_or([f64::NAN; 3], |(x, y)| to_wcs(x, y).into()));
|
||||
widths.push(w);
|
||||
};
|
||||
let mut prev_end_width: Option<f64> = None;
|
||||
for i in 0..seg_count {
|
||||
let (p0, bulge, sw0, ew0) = verts[i];
|
||||
let (p1, _, _, _) = verts[(i + 1) % n];
|
||||
if i == 0 {
|
||||
push(p0[0], p0[1], sw0 as f32);
|
||||
match prev_end_width {
|
||||
None => push(Some((p0[0], p0[1])), sw0 as f32),
|
||||
// A segment starting at another width than the last one ended
|
||||
// steps there: break the band and restart it (#1628).
|
||||
Some(prev) if (prev - sw0).abs() > 1e-9 => {
|
||||
push(None, 0.0);
|
||||
push(Some((p0[0], p0[1])), sw0 as f32);
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
prev_end_width = Some(ew0);
|
||||
if bulge.abs() < 1e-9 {
|
||||
push(p1[0], p1[1], ew0 as f32);
|
||||
push(Some((p1[0], p1[1])), ew0 as f32);
|
||||
} else if let Some(arc) = BulgeArc::from_bulge(p0, p1, bulge) {
|
||||
let samples = arc.tessellate_angle(kernel::tessellation::DEFAULT_ANGLE);
|
||||
let segments = samples.len().saturating_sub(1).max(1);
|
||||
for (index, s) in samples.into_iter().enumerate().skip(1) {
|
||||
let t = index as f64 / segments as f64;
|
||||
push(s[0], s[1], (sw0 + (ew0 - sw0) * t) as f32);
|
||||
push(Some((s[0], s[1])), (sw0 + (ew0 - sw0) * t) as f32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -842,12 +842,22 @@ fn large_radial_rotation(d: &DimensionLargeRadial) -> f64 {
|
||||
}
|
||||
|
||||
fn apply_transform(dim: &mut Dimension, t: &EntityTransform) {
|
||||
// A zero text point is the "placed automatically" sentinel, not a
|
||||
// location: moving it to wherever the origin lands left the text there.
|
||||
let auto_text = {
|
||||
let base = dim.base();
|
||||
let p = base.text_middle_point;
|
||||
!base.text_user_positioned && p.x == 0.0 && p.y == 0.0 && p.z == 0.0
|
||||
};
|
||||
crate::scene::view::transform::apply_standard_entity_transform(dim, t, |entity, p1, p2| {
|
||||
codec::Entity::apply_transform(
|
||||
entity,
|
||||
&crate::scene::view::transform::reflection_about_xy_line(p1, p2),
|
||||
);
|
||||
});
|
||||
if auto_text {
|
||||
reset_automatic_text_position(dim.base_mut());
|
||||
}
|
||||
}
|
||||
|
||||
impl PropertyEditable for Dimension {
|
||||
|
||||
+4
-1
@@ -82,7 +82,10 @@ pub fn missing_shx_fonts(doc: &CadDocument) -> Vec<String> {
|
||||
// The primary font and the big font (Asian double-byte glyphs) are
|
||||
// both plain .shx files the style depends on.
|
||||
for file in [style.font_file.trim(), style.big_font_file.trim()] {
|
||||
if file.is_empty() || !file.to_ascii_lowercase().ends_with(".shx") {
|
||||
if file.is_empty()
|
||||
|| !file.to_ascii_lowercase().ends_with(".shx")
|
||||
|| crate::io::linetypes::is_bundled_shape_file(file)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let resolved = crate::io::resolve_image_file(file, base).is_some()
|
||||
|
||||
@@ -345,6 +345,13 @@ fn bundled_shape_name(file: &str, number: i16) -> Option<&'static str> {
|
||||
.map(|(_, name, _)| *name)
|
||||
}
|
||||
|
||||
/// Whether `file` is a shape file the bundled LFF substitutes stand in for,
|
||||
/// so its absence on disk never needs reporting.
|
||||
pub fn is_bundled_shape_file(file: &str) -> bool {
|
||||
let stem = shape_file_stem(file);
|
||||
BUNDLED_SHAPES.iter().any(|(f, _, _)| *f == stem)
|
||||
}
|
||||
|
||||
/// The drawing's shape-file STYLE for `file`, added when missing (an empty
|
||||
/// name, as shape files are stored).
|
||||
fn shape_file_style(doc: &mut CadDocument, file: &str) -> codec::Handle {
|
||||
|
||||
+12
-1
@@ -170,9 +170,10 @@ impl From<&str> for OpenLoadError {
|
||||
pub async fn pick_open_path() -> Option<(PathBuf, u64)> {
|
||||
let handle = crate::sys::file_dialog()
|
||||
.set_title(crate::t!("Open CAD file").as_ref())
|
||||
.add_filter(crate::t!("CAD Files").as_ref(), &["dwg", "dxf", "bak", "sv$", "DWG", "DXF", "BAK"])
|
||||
.add_filter(crate::t!("CAD Files").as_ref(), &["dwg", "dxf", "dwt", "bak", "sv$", "DWG", "DXF", "DWT", "BAK"])
|
||||
.add_filter(crate::t!("DWG Files").as_ref(), &["dwg", "DWG"])
|
||||
.add_filter(crate::t!("DXF Files").as_ref(), &["dxf", "DXF"])
|
||||
.add_filter(crate::t!("Drawing Template (*.dwt)").as_ref(), &["dwt", "DWT"])
|
||||
.add_filter(crate::t!("Backup / Autosave").as_ref(), &["bak", "sv$", "BAK"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.pick_file()
|
||||
@@ -1761,6 +1762,16 @@ mod save_failure_tests {
|
||||
/// picked from outside the plot styles folder is copied into it (unless a
|
||||
/// file of that name is already there), so the dialog lists it from now on
|
||||
/// and page setups naming it resolve after a restart.
|
||||
/// Pick a `.lin` linetype definition file and return its text (#1588).
|
||||
pub async fn pick_linetype_file() -> Option<String> {
|
||||
let handle = crate::sys::file_dialog()
|
||||
.set_title(crate::t!("Load Linetypes").as_ref())
|
||||
.add_filter(crate::t!("Linetype Files").as_ref(), &["lin", "LIN"])
|
||||
.pick_file()
|
||||
.await?;
|
||||
Some(String::from_utf8_lossy(&handle.read().await).into_owned())
|
||||
}
|
||||
|
||||
pub async fn pick_plot_style() -> Result<Option<plot_style::PlotStyleTable>, String> {
|
||||
let dialog = crate::sys::file_dialog()
|
||||
.set_title(crate::t!("Load Plot Style Table").as_ref())
|
||||
|
||||
@@ -771,7 +771,9 @@ fn append_pdf_page(
|
||||
}
|
||||
// Near-white and near-yellow (viewport active border) → dark grey for print
|
||||
// (only when no CTB override was applied).
|
||||
if !color_overridden {
|
||||
// `aci == 0` is an explicit true colour and plots as drawn, like the
|
||||
// hatch pass (#1621); only a pure white there is an unresolved colour 7.
|
||||
if !color_overridden && (wire.aci != 0 || [r, g, b] == [1.0; 3]) {
|
||||
// An authored white (not colour 7) plots as drawn, like on screen.
|
||||
let is_light = r > 0.80
|
||||
&& g > 0.80
|
||||
|
||||
+18
-3
@@ -1768,7 +1768,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"LINE Specify first point:" => Some(("draw", "line-specify-first-point")),
|
||||
"LINE Specify next point [Close/Undo]:" => Some(("draw", "line-specify-next-point-close-undo")),
|
||||
"LINE Specify next point [Undo]:" => Some(("draw", "line-specify-next-point-undo")),
|
||||
"LINETYPE [List / Set]:" => Some(("styles", "linetype-list-set")),
|
||||
"LINETYPE [List / Set / Load]:" => Some(("styles", "linetype-list-set")),
|
||||
"LINETYPE SET linetype name (ByLayer / ByBlock / …):" => Some(("styles", "linetype-set-linetype-name-bylayer-byblock")),
|
||||
"LINETYPE: \"{name}\" is not loaded. Use LINETYPE LIST to see available linetypes." => Some(("styles", "linetype-name-is-not-loaded-use-linetype-list")),
|
||||
"LIST: no entities selected. Select entities first." => Some(("inquiry", "list-no-entities-selected-select-entities-firs")),
|
||||
@@ -4873,11 +4873,26 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Are you sure you want to reset? You will lose all your current shortcuts!" => Some(("common", "are-you-sure-you-want-to-reset-you-will-lose-all-your-current-shortcuts")),
|
||||
"Yes, reset" => Some(("common", "yes-reset")),
|
||||
"Reset to default" => Some(("common", "reset-to-default")),
|
||||
"Apply && Exit" => Some(("common", "apply-exit")),
|
||||
"Apply & Exit" => Some(("common", "apply-exit")),
|
||||
"Shortcut already used for command: {} → {}" => Some(("common", "shortcut-already-used-for-command")),
|
||||
"Unknown command: {}" => Some(("command", "unknown-command-cmd")),
|
||||
"Unsaved changes will be discarded." => Some(("common", "unsaved-changes-will-be-discarded")),
|
||||
"Discard && close" => Some(("common", "discard-close")),
|
||||
"Discard & close" => Some(("common", "discard-close")),
|
||||
"CHSPACE: Command not allowed in the Model tab." => Some(("common", "chspace-model-tab")),
|
||||
"CHSPACE: No plan-view viewport to change space through." => Some(("common", "chspace-no-viewport")),
|
||||
"CHSPACE: {count} object(s) changed to paper space." => Some(("common", "chspace-to-paper")),
|
||||
"CHSPACE: {count} object(s) changed to model space." => Some(("common", "chspace-to-model")),
|
||||
"Blank drawing" => Some(("common", "blank-drawing")),
|
||||
"Default template for new drawings" => Some(("common", "default-template-new-drawings")),
|
||||
"FILLET Enter Trim mode option [Trim/No trim] <Trim>:" => Some(("common", "fillet-trim-mode-trim")),
|
||||
"FILLET Enter Trim mode option [Trim/No trim] <No trim>:" => Some(("common", "fillet-trim-mode-no-trim")),
|
||||
"Linetype Files" => Some(("common", "linetype-files")),
|
||||
"Load Linetypes" => Some(("common", "load-linetypes")),
|
||||
"Requires two positive values (x,y) or one for both." => Some(("common", "requires-two-positive-values")),
|
||||
"Snap marker color" => Some(("common", "snap-marker-color")),
|
||||
"{added} linetype(s) loaded." => Some(("common", "linetypes-loaded")),
|
||||
"Geometric Center" => Some(("common", "geometric-center-snap")),
|
||||
"No trim" => Some(("common", "no-trim-option")),
|
||||
"Keep editing" => Some(("common", "keep-editing")),
|
||||
"MCP control is off" => Some(("common", "mcp-control-is-off")),
|
||||
"MCP is handling a request" => Some(("common", "mcp-is-handling-a-request")),
|
||||
|
||||
@@ -32,6 +32,7 @@ thread_local! {
|
||||
static HELIX_HEIGHT: Cell<f64> = Cell::new(1.0);
|
||||
static HELIX_TURNS: Cell<f64> = Cell::new(3.0);
|
||||
static HELIX_COUNTER_CLOCKWISE: Cell<bool> = Cell::new(true);
|
||||
static FILLET_TRIM: Cell<bool> = Cell::new(true); // TRIMMODE
|
||||
}
|
||||
|
||||
macro_rules! accessors {
|
||||
@@ -85,6 +86,13 @@ pub fn get_helix_counter_clockwise() -> bool {
|
||||
pub fn set_helix_counter_clockwise(value: bool) {
|
||||
HELIX_COUNTER_CLOCKWISE.with(|current| current.set(value));
|
||||
}
|
||||
pub fn get_fillet_trim() -> bool {
|
||||
FILLET_TRIM.with(|value| value.get())
|
||||
}
|
||||
|
||||
pub fn set_fillet_trim(value: bool) {
|
||||
FILLET_TRIM.with(|current| current.set(value));
|
||||
}
|
||||
accessors!(
|
||||
get_donut_inner_diameter,
|
||||
set_donut_inner_diameter,
|
||||
|
||||
@@ -81,5 +81,5 @@ impl CadCommand for PointCommand {
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POINT", "MULTIPOINT"] }); // PointCommand
|
||||
// Point display style system variables + dialog.
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["PDMODE", "PDSIZE", "DDPTYPE"]
|
||||
names: &["PDMODE", "PDSIZE", "DDPTYPE", "PTYPE"]
|
||||
});
|
||||
@@ -9,7 +9,7 @@
|
||||
// Pick two lines (line-only; arcs are not chamferable).
|
||||
// Finds intersection, backs off dist1 along line 1 and dist2 along line 2.
|
||||
|
||||
use codec::entities::{Arc as ArcEnt, Line as LineEnt, LwPolyline};
|
||||
use codec::entities::{Arc as ArcEnt, Line as LineEnt, LwPolyline, LwVertex};
|
||||
|
||||
// Shared plane geometry, from opencadkernel via the local adapters.
|
||||
use super::geom;
|
||||
@@ -1354,6 +1354,9 @@ enum FilletStep {
|
||||
// Radius may be typed directly or measured by picking two points.
|
||||
WaitingForRadius,
|
||||
|
||||
/// Trim / No trim: whether the picked objects are cut back to the arc.
|
||||
TrimMode,
|
||||
|
||||
RadiusSecondPoint {
|
||||
first: DVec3,
|
||||
},
|
||||
@@ -1398,12 +1401,16 @@ impl FilletCommand {
|
||||
/// Switch to the radius sub-step, remembering the first pick (if any) so
|
||||
/// it can be restored afterwards.
|
||||
fn enter_radius_substep(&mut self) {
|
||||
self.enter_substep(FilletStep::WaitingForRadius);
|
||||
}
|
||||
|
||||
fn enter_substep(&mut self, step: FilletStep) {
|
||||
self.resume_second = if let FilletStep::Second { h1, e1, click1 } = &self.step {
|
||||
Some((*h1, e1.clone(), *click1))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.step = FilletStep::WaitingForRadius;
|
||||
self.step = step;
|
||||
}
|
||||
|
||||
/// Leave the radius sub-step, resuming the second pick when a first object
|
||||
@@ -1415,7 +1422,12 @@ impl FilletCommand {
|
||||
};
|
||||
}
|
||||
|
||||
fn continue_after_fillet(&mut self, replacements: Vec<(Handle, Vec<EntityType>)>) -> CmdResult {
|
||||
fn continue_after_fillet(&mut self, mut replacements: Vec<(Handle, Vec<EntityType>)>) -> CmdResult {
|
||||
for entity in replacements.iter_mut().flat_map(|(_, entities)| entities.iter_mut()) {
|
||||
if let EntityType::LwPolyline(poly) = entity {
|
||||
drop_zero_length_segments(poly);
|
||||
}
|
||||
}
|
||||
self.all_entities.retain(|entity| {
|
||||
!replacements
|
||||
.iter()
|
||||
@@ -1488,6 +1500,12 @@ impl CadCommand for FilletCommand {
|
||||
FilletStep::RadiusSecondPoint { .. } => {
|
||||
crate::t!("FILLET Specify second point for radius:").into_owned()
|
||||
}
|
||||
FilletStep::TrimMode => if defaults::get_fillet_trim() {
|
||||
crate::t!("FILLET Enter Trim mode option [Trim/No trim] <Trim>:")
|
||||
} else {
|
||||
crate::t!("FILLET Enter Trim mode option [Trim/No trim] <No trim>:")
|
||||
}
|
||||
.into_owned(),
|
||||
FilletStep::Second { .. } => {
|
||||
crate::tf!(
|
||||
"FILLET Select second object (Line/Arc/LwPolyline) [R={:.4}]:",
|
||||
@@ -1509,10 +1527,14 @@ impl CadCommand for FilletCommand {
|
||||
}
|
||||
opts.push(CmdOption::new("Polyline", "P"));
|
||||
opts.push(CmdOption::new("Radius", "R"));
|
||||
opts.push(CmdOption::new("Trim", "T"));
|
||||
opts
|
||||
}
|
||||
FilletStep::Second { .. } => {
|
||||
vec![CmdOption::new("Radius", "R")]
|
||||
vec![CmdOption::new("Radius", "R"), CmdOption::new("Trim", "T")]
|
||||
}
|
||||
FilletStep::TrimMode => {
|
||||
vec![CmdOption::new("Trim", "T"), CmdOption::new("No trim", "N")]
|
||||
}
|
||||
FilletStep::Polyline
|
||||
| FilletStep::WaitingForRadius
|
||||
@@ -1521,7 +1543,7 @@ impl CadCommand for FilletCommand {
|
||||
}
|
||||
|
||||
fn wants_text_input(&self) -> bool {
|
||||
matches!(self.step, FilletStep::WaitingForRadius)
|
||||
matches!(self.step, FilletStep::WaitingForRadius | FilletStep::TrimMode)
|
||||
}
|
||||
|
||||
fn dyn_field(&self) -> crate::command::DynField {
|
||||
@@ -1552,6 +1574,16 @@ impl CadCommand for FilletCommand {
|
||||
// Invalid — stay and re-prompt
|
||||
Some(CmdResult::NeedPoint)
|
||||
}
|
||||
FilletStep::TrimMode => {
|
||||
match text.trim().to_uppercase().as_str() {
|
||||
"" => {}
|
||||
"T" | "TRIM" => defaults::set_fillet_trim(true),
|
||||
"N" | "NO TRIM" | "NOTRIM" => defaults::set_fillet_trim(false),
|
||||
_ => return Some(CmdResult::NeedPoint),
|
||||
}
|
||||
self.resume_after_radius();
|
||||
Some(CmdResult::NeedPoint)
|
||||
}
|
||||
FilletStep::First | FilletStep::Second { .. } => {
|
||||
let t = text.trim();
|
||||
let upper = t.to_uppercase();
|
||||
@@ -1562,6 +1594,10 @@ impl CadCommand for FilletCommand {
|
||||
if upper == "U" || upper == "UNDO" {
|
||||
return self.undo_last();
|
||||
}
|
||||
if upper == "T" || upper == "TRIM" {
|
||||
self.enter_substep(FilletStep::TrimMode);
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
// "R" alone → enter sub-step to collect radius
|
||||
if upper == "R" {
|
||||
self.enter_radius_substep();
|
||||
@@ -1594,6 +1630,7 @@ impl CadCommand for FilletCommand {
|
||||
self.step,
|
||||
FilletStep::WaitingForRadius
|
||||
| FilletStep::RadiusSecondPoint { .. }
|
||||
| FilletStep::TrimMode
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1619,7 +1656,8 @@ impl CadCommand for FilletCommand {
|
||||
|
||||
match &self.step {
|
||||
FilletStep::WaitingForRadius
|
||||
| FilletStep::RadiusSecondPoint { .. } => {
|
||||
| FilletStep::RadiusSecondPoint { .. }
|
||||
| FilletStep::TrimMode => {
|
||||
return CmdResult::NeedPoint;
|
||||
}
|
||||
|
||||
@@ -1689,6 +1727,17 @@ impl CadCommand for FilletCommand {
|
||||
|
||||
if let Some(e2) = e2 {
|
||||
match compute_fillet_entities(&e1, click1, &e2, click, self.radius) {
|
||||
// No trim: the objects stay as they are; only the arc
|
||||
// is added (#1558).
|
||||
Some((_, _, maybe_arc)) if !defaults::get_fillet_trim() => {
|
||||
let Some(arc) = maybe_arc else {
|
||||
return CmdResult::NeedPoint;
|
||||
};
|
||||
self.step = FilletStep::First;
|
||||
self.resume_second = None;
|
||||
self.made += 1;
|
||||
CmdResult::CommitEntity(arc)
|
||||
}
|
||||
Some((new_e1, new_e2, maybe_arc)) => {
|
||||
let mut first_replacements = vec![new_e1];
|
||||
if let Some(arc) = maybe_arc {
|
||||
@@ -1719,7 +1768,8 @@ impl CadCommand for FilletCommand {
|
||||
|
||||
match &self.step {
|
||||
FilletStep::WaitingForRadius
|
||||
| FilletStep::RadiusSecondPoint { .. } => vec![],
|
||||
| FilletStep::RadiusSecondPoint { .. }
|
||||
| FilletStep::TrimMode => vec![],
|
||||
FilletStep::Polyline => {
|
||||
let preview = self
|
||||
.entity_index
|
||||
@@ -1780,20 +1830,21 @@ impl CadCommand for FilletCommand {
|
||||
if let Some((new_e1, new_e2, maybe_arc)) =
|
||||
compute_fillet_entities(&e1, click1, &e2, click, self.radius)
|
||||
{
|
||||
let mut out = vec![
|
||||
WireModel::solid(
|
||||
let mut out = Vec::new();
|
||||
if defaults::get_fillet_trim() {
|
||||
out.push(WireModel::solid(
|
||||
"fillet_e1".into(),
|
||||
entity_pts(&new_e1),
|
||||
WireModel::CYAN,
|
||||
false,
|
||||
),
|
||||
WireModel::solid(
|
||||
));
|
||||
out.push(WireModel::solid(
|
||||
"fillet_e2".into(),
|
||||
entity_pts(&new_e2),
|
||||
WireModel::CYAN,
|
||||
false,
|
||||
),
|
||||
];
|
||||
));
|
||||
}
|
||||
if let Some(arc) = maybe_arc {
|
||||
out.push(WireModel::solid(
|
||||
"fillet_arc".into(),
|
||||
@@ -1856,6 +1907,29 @@ impl CadCommand for FilletCommand {
|
||||
}
|
||||
}
|
||||
|
||||
/// A radius-0 fillet over an existing arc leaves its two ends on one point;
|
||||
/// the zero-length segment between them blocked every later fillet of that
|
||||
/// corner (#1422). The later vertex carries the next segment, so it survives.
|
||||
fn drop_zero_length_segments(poly: &mut LwPolyline) {
|
||||
let same = |a: &LwVertex, b: &LwVertex| {
|
||||
(a.location.x - b.location.x).abs() < 1e-9 && (a.location.y - b.location.y).abs() < 1e-9
|
||||
};
|
||||
let mut i = 0;
|
||||
while i + 1 < poly.vertices.len() && poly.vertices.len() > 2 {
|
||||
if same(&poly.vertices[i], &poly.vertices[i + 1]) {
|
||||
poly.vertices.remove(i);
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if poly.is_closed && poly.vertices.len() > 2 {
|
||||
let n = poly.vertices.len();
|
||||
if same(&poly.vertices[n - 1], &poly.vertices[0]) {
|
||||
poly.vertices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ══════════════════════════════════════════════════════════════════════════
|
||||
// ChamferCommand
|
||||
// ══════════════════════════════════════════════════════════════════════════
|
||||
@@ -2448,16 +2522,16 @@ mod tests {
|
||||
1.0,
|
||||
vec![line(0.0, 0.0, 10.0, 0.0, 1), line(0.0, 0.0, 0.0, 10.0, 2)],
|
||||
);
|
||||
assert_eq!(keywords(&command), ["P", "R"]);
|
||||
assert_eq!(keywords(&command), ["P", "R", "T"]);
|
||||
assert!(command.on_text_input("U").is_none(), "nothing to undo yet");
|
||||
command.on_entity_pick(Handle::new(1), DVec3::new(5.0, 0.0, 0.0));
|
||||
assert!(matches!(
|
||||
command.on_entity_pick(Handle::new(2), DVec3::new(0.0, 5.0, 0.0)),
|
||||
CmdResult::ReplaceManyContinue(_)
|
||||
));
|
||||
assert_eq!(keywords(&command), ["U", "P", "R"]);
|
||||
assert_eq!(keywords(&command), ["U", "P", "R", "T"]);
|
||||
assert!(matches!(command.on_text_input("U"), Some(CmdResult::UndoDocument)));
|
||||
assert_eq!(keywords(&command), ["P", "R"]);
|
||||
assert_eq!(keywords(&command), ["P", "R", "T"]);
|
||||
// The host hands the restored document back; the cache follows it.
|
||||
let mut doc = codec::CadDocument::new();
|
||||
let _ = doc.add_entity(line(0.0, 0.0, 20.0, 0.0, 7));
|
||||
|
||||
@@ -9,6 +9,7 @@ use glam::DVec3;
|
||||
use rustc_hash::FxHashMap as HashMap;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::scene::model::wire_model::WireModel;
|
||||
use crate::t;
|
||||
|
||||
const TAU: f64 = std::f64::consts::TAU;
|
||||
@@ -188,6 +189,24 @@ impl PeditCommand {
|
||||
}
|
||||
}
|
||||
|
||||
/// WCS location of a vertex of the polyline being edited.
|
||||
fn vertex_world(&self, index: usize) -> Option<DVec3> {
|
||||
let entity = self.target.and_then(|handle| self.entities.get(&handle.value()))?;
|
||||
let (ocs, n) = match entity {
|
||||
EntityType::LwPolyline(p) => {
|
||||
let v = p.vertices.get(index)?;
|
||||
((v.location.x, v.location.y, p.elevation), &p.normal)
|
||||
}
|
||||
EntityType::Polyline2D(p) => {
|
||||
let v = p.vertices.get(index)?;
|
||||
((v.location.x, v.location.y, p.elevation), &p.normal)
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
let (x, y, z) = crate::scene::view::transform::ocs_point_to_wcs(ocs, (n.x, n.y, n.z));
|
||||
Some(DVec3::new(x, y, z))
|
||||
}
|
||||
|
||||
fn vertex_count(&self) -> usize {
|
||||
self.target.and_then(|handle| self.entities.get(&handle.value())).map_or(0, |entity| match entity {
|
||||
EntityType::LwPolyline(polyline) => polyline.vertices.len(),
|
||||
@@ -237,6 +256,40 @@ impl CadCommand for PeditCommand {
|
||||
"PEDIT"
|
||||
}
|
||||
|
||||
/// Edit-vertex steps mark the current vertex with a screen-sized X (#1628).
|
||||
fn on_mouse_move(&mut self, _pt: DVec3) -> Option<WireModel> {
|
||||
let index = match self.mode {
|
||||
Mode::PolyVertex(i)
|
||||
| Mode::PolyTangent(i)
|
||||
| Mode::PolyMove(i)
|
||||
| Mode::PolyInsert(i)
|
||||
| Mode::PolyWidthStart(i, _)
|
||||
| Mode::PolyWidthEnd(i, _) => i,
|
||||
Mode::PolyRange { end, .. } => end,
|
||||
_ => return None,
|
||||
};
|
||||
let origin = self.vertex_world(index)?;
|
||||
let at = |dx: f64, dy: f64| {
|
||||
let p = origin + DVec3::new(dx, dy, 0.0);
|
||||
[p.x, p.y, p.z]
|
||||
};
|
||||
let h = 0.5;
|
||||
let mut wire = WireModel::solid_f64(
|
||||
"pedit_vertex_marker".into(),
|
||||
vec![at(-h, -h), at(h, h), [f64::NAN; 3], at(-h, h), at(h, -h)],
|
||||
WireModel::CYAN,
|
||||
false,
|
||||
);
|
||||
wire.point_marker = Some(crate::scene::model::wire_model::PointMarker {
|
||||
origin,
|
||||
normal: DVec3::Z,
|
||||
axis_x: DVec3::X,
|
||||
axis_y: DVec3::Y,
|
||||
viewport_percent: 3.0,
|
||||
});
|
||||
Some(wire)
|
||||
}
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match &self.mode {
|
||||
Mode::PickTarget => {
|
||||
|
||||
@@ -31,6 +31,7 @@ const SUBTRACT_ICON: &[u8] = include_bytes!("../../../assets/icons/model/subtrac
|
||||
const INTERSECT_ICON: &[u8] = include_bytes!("../../../assets/icons/model/intersect.svg");
|
||||
const FILLET_ICON: &[u8] = include_bytes!("../../../assets/icons/model/fillet.svg");
|
||||
const CHAMFER_ICON: &[u8] = include_bytes!("../../../assets/icons/model/chamfer.svg");
|
||||
const SHELL_ICON: &[u8] = include_bytes!("../../../assets/icons/model/shell.svg");
|
||||
|
||||
/// Helper to declare a ribbon tool that fires a named command.
|
||||
fn tool(id: &'static str, label: &'static str, icon: &'static [u8]) -> ToolDef {
|
||||
@@ -93,7 +94,7 @@ impl CadModule for ModelModule {
|
||||
tools: vec![
|
||||
RibbonItem::LargeTool(tool("FILLETEDGE", "Fillet Edge", FILLET_ICON)),
|
||||
RibbonItem::LargeTool(tool("CHAMFEREDGE", "Chamfer", CHAMFER_ICON)),
|
||||
RibbonItem::LargeTool(tool("SHELL", "Shell", PRESSPULL_ICON)),
|
||||
RibbonItem::LargeTool(tool("SHELL", "Shell", SHELL_ICON)),
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -97,6 +97,13 @@ impl CadCommand for ZoomWindowCommand {
|
||||
self.scale_prompt = true;
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
// A scale factor straight at the first prompt: n, nX or nXP.
|
||||
upper if upper.ends_with('X')
|
||||
|| upper.ends_with("XP")
|
||||
|| crate::app::expr_eval::eval_number(&upper).is_some() =>
|
||||
{
|
||||
return Some(CmdResult::Dispatch(format!("ZOOM SCALE {text}")));
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
Some(CmdResult::Dispatch(command.to_string()))
|
||||
|
||||
@@ -180,6 +180,21 @@ pub(crate) fn text_contrast_background(
|
||||
/// Split each absolute f64 source point into double-single (high, low) f32
|
||||
/// buffers in one pass — the relative-to-eye residual the GPU/CPU reconstruct
|
||||
/// to f64 precision at UTM-scale coordinates.
|
||||
/// Area centroid of a closed polyline, for the Geometric Center snap.
|
||||
fn geometric_center(entity: &EntityType) -> Option<glam::DVec3> {
|
||||
let closed = match entity {
|
||||
EntityType::LwPolyline(p) => p.is_closed && p.vertices.len() >= 3,
|
||||
EntityType::Polyline2D(p) => p.is_closed() && p.vertices.len() >= 3,
|
||||
_ => false,
|
||||
};
|
||||
if !closed {
|
||||
return None;
|
||||
}
|
||||
let planar = crate::entities::curve::entity_curve(entity)?;
|
||||
let center = planar.curve.enclosed_centroid()?;
|
||||
Some(glam::DVec3::from_array(planar.plane.point_at(center)))
|
||||
}
|
||||
|
||||
pub(crate) fn points_to_ds(
|
||||
src: impl IntoIterator<Item = [f64; 3]>,
|
||||
) -> (Vec<[f32; 3]>, Vec<[f32; 3]>) {
|
||||
@@ -1102,7 +1117,10 @@ pub fn tessellate(
|
||||
)),
|
||||
_ => convert(entity, document),
|
||||
});
|
||||
if let Some(te) = te {
|
||||
if let Some(mut te) = te {
|
||||
if let Some(center) = geometric_center(entity) {
|
||||
te.snap_pts.push((center, SnapHint::GeometricCenter));
|
||||
}
|
||||
match te.object {
|
||||
// ── Text / MText: pre-tessellated glyph strokes ───────────────
|
||||
//
|
||||
|
||||
@@ -54,7 +54,7 @@ pub(crate) fn osnap_type_for(snap: crate::snap::SnapType) -> u8 {
|
||||
S::Nearest | S::Extension => osnap::NEAR,
|
||||
S::ApparentIntersection => osnap::APPARENT_INT,
|
||||
S::Parallel => osnap::PARA,
|
||||
S::Grid | S::ObjectPick | S::Vertex | S::EdgeMidpoint | S::FaceCenter | S::Knot | S::FacePerpendicular | S::NearestFace => {
|
||||
S::GeometricCenter | S::Grid | S::ObjectPick | S::Vertex | S::EdgeMidpoint | S::FaceCenter | S::Knot | S::FacePerpendicular | S::NearestFace => {
|
||||
osnap::NONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6300,6 +6300,39 @@ impl Scene {
|
||||
Some(scale_handle)
|
||||
}
|
||||
|
||||
/// Scale the active viewport to `factor` paper units per model unit
|
||||
/// (ZOOM nXP). A named scale of that factor is linked as its annotation
|
||||
/// scale; otherwise the viewport keeps a custom scale.
|
||||
pub fn set_viewport_scale_factor(&mut self, factor: f64) -> bool {
|
||||
let Some(viewport) = self.explicit_viewport_handle() else {
|
||||
return false;
|
||||
};
|
||||
let unit_factor = self.annotation_scale_unit_factor();
|
||||
let named = self.document.objects.values().find_map(|object| match object {
|
||||
ObjectType::Scale(scale)
|
||||
if !scale.is_temporary
|
||||
&& (scale.factor() * unit_factor - factor).abs() <= 1.0e-9 * factor.max(1.0) =>
|
||||
{
|
||||
Some(scale.name.clone())
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
if let Some(name) = named {
|
||||
return self.set_viewport_scale_named_for(viewport, &name).is_some();
|
||||
}
|
||||
match self.document.get_entity_mut(viewport) {
|
||||
Some(EntityType::Viewport(vp)) if !vp.status.locked && factor > 1.0e-9 => {
|
||||
vp.custom_scale = factor;
|
||||
vp.view_height = vp.height / factor;
|
||||
}
|
||||
_ => return false,
|
||||
}
|
||||
self.notify_viewport_changed(viewport);
|
||||
self.resident_wire_sets.borrow_mut().clear();
|
||||
self.bump_geometry();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn viewport_annotation_scale_synced(&self) -> Option<bool> {
|
||||
let viewport = self.explicit_viewport_handle()?;
|
||||
let EntityType::Viewport(vp) = self.document.get_entity(viewport)? else {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
pub enum SnapHint {
|
||||
/// Geometric center of a circle, arc, or ellipse.
|
||||
Center,
|
||||
/// Area centroid of a closed polyline.
|
||||
GeometricCenter,
|
||||
/// Point entity location.
|
||||
Node,
|
||||
/// 0 / 90 / 180 / 270 ° point on a circle/arc (within arc span).
|
||||
|
||||
+9
-1
@@ -30,6 +30,8 @@ pub enum SnapType {
|
||||
Endpoint,
|
||||
Midpoint,
|
||||
Center,
|
||||
/// Area centroid of a closed polyline (#1369).
|
||||
GeometricCenter,
|
||||
Node,
|
||||
Quadrant,
|
||||
Intersection,
|
||||
@@ -83,6 +85,7 @@ pub const ALL_SNAP_MODES: &[(SnapType, &str, &str)] = &[
|
||||
(SnapType::Endpoint, "◻", "Endpoint"),
|
||||
(SnapType::Midpoint, "△", "Midpoint"),
|
||||
(SnapType::Center, "◯", "Center"),
|
||||
(SnapType::GeometricCenter, "⊙", "Geometric Center"),
|
||||
(SnapType::Node, "◆", "Node"),
|
||||
(SnapType::Quadrant, "◇", "Quadrant"),
|
||||
(SnapType::Intersection, "✕", "Intersection"),
|
||||
@@ -1440,6 +1443,10 @@ impl Snapper {
|
||||
// else stays on the 2D master + mode set.
|
||||
let (snap_type, on) = match hint {
|
||||
SnapHint::Center => (SnapType::Center, self.is_on(SnapType::Center)),
|
||||
SnapHint::GeometricCenter => (
|
||||
SnapType::GeometricCenter,
|
||||
self.is_on(SnapType::GeometricCenter),
|
||||
),
|
||||
SnapHint::Node => (SnapType::Node, self.is_on(SnapType::Node)),
|
||||
SnapHint::Quadrant => (SnapType::Quadrant, self.is_on(SnapType::Quadrant)),
|
||||
SnapHint::Insertion => (SnapType::Insertion, self.is_on(SnapType::Insertion)),
|
||||
@@ -2602,6 +2609,7 @@ pub(crate) fn snap_tier(t: SnapType) -> u8 {
|
||||
| SnapType::ApparentIntersection
|
||||
| SnapType::Midpoint
|
||||
| SnapType::Center
|
||||
| SnapType::GeometricCenter
|
||||
| SnapType::Node
|
||||
| SnapType::Quadrant
|
||||
| SnapType::Insertion
|
||||
@@ -2663,7 +2671,7 @@ pub(crate) fn snap_priority(t: SnapType) -> u8 {
|
||||
SnapType::Intersection => 1,
|
||||
SnapType::ApparentIntersection => 2,
|
||||
SnapType::Midpoint => 3,
|
||||
SnapType::Center => 4,
|
||||
SnapType::Center | SnapType::GeometricCenter => 4,
|
||||
SnapType::Node => 5,
|
||||
SnapType::Quadrant => 6,
|
||||
SnapType::Insertion => 7,
|
||||
|
||||
@@ -37,8 +37,11 @@ pub fn color_to_aci_string(c: AcadColor) -> String {
|
||||
/// Convert an Iced colour chosen by `iced_aw::ColorPicker` into a DWG true
|
||||
/// colour. ACI-only destinations map it to their closest indexed colour later.
|
||||
pub fn iced_to_acad_color(color: Color) -> AcadColor {
|
||||
let [r, g, b, _] = color.into_rgba8();
|
||||
AcadColor::Rgb { r, g, b }
|
||||
// Truncate the way the picker labels its channels, so the stored colour
|
||||
// is the one the dialog showed; rounding drifted dragged values by one
|
||||
// (#1621).
|
||||
let byte = |c: f32| (c * 255.0) as u8;
|
||||
AcadColor::Rgb { r: byte(color.r), g: byte(color.g), b: byte(color.b) }
|
||||
}
|
||||
|
||||
/// Return the closest CAD Color Index for an RGB colour.
|
||||
|
||||
@@ -985,8 +985,13 @@ impl CommandLine {
|
||||
.on_press(Message::CommandHistoryClear)
|
||||
.style(header_btn_style)
|
||||
.padding([2, 6]);
|
||||
// Collapses the console back to the single input line (#1094).
|
||||
let collapse_btn = button(crate::ui::icons::themed_arrow_down(11.0))
|
||||
.on_press(Message::CommandHistoryToggle)
|
||||
.style(header_btn_style)
|
||||
.padding([2, 6]);
|
||||
let header = container(
|
||||
row![Space::new().width(Length::Fill), copy_btn, clear_btn]
|
||||
row![Space::new().width(Length::Fill), copy_btn, clear_btn, collapse_btn]
|
||||
.spacing(6)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
|
||||
@@ -32,6 +32,8 @@ static REDO: &[u8] = include_bytes!("../../assets/icons/ui/redo.svg");
|
||||
static OSNAP_ENDPOINT: &[u8] = include_bytes!("../../assets/icons/osnap/endpoint.svg");
|
||||
static OSNAP_MIDPOINT: &[u8] = include_bytes!("../../assets/icons/osnap/midpoint.svg");
|
||||
static OSNAP_CENTER: &[u8] = include_bytes!("../../assets/icons/osnap/center.svg");
|
||||
static OSNAP_GEOMETRIC_CENTER: &[u8] =
|
||||
include_bytes!("../../assets/icons/osnap/geometric_center.svg");
|
||||
static OSNAP_NODE: &[u8] = include_bytes!("../../assets/icons/osnap/node.svg");
|
||||
static OSNAP_QUADRANT: &[u8] = include_bytes!("../../assets/icons/osnap/quadrant.svg");
|
||||
static OSNAP_INTERSECTION: &[u8] = include_bytes!("../../assets/icons/osnap/intersection.svg");
|
||||
@@ -51,6 +53,8 @@ static LAY_ON: &[u8] = include_bytes!("../../assets/icons/layers/layon.svg");
|
||||
static LAY_OFF: &[u8] = include_bytes!("../../assets/icons/layers/layoff.svg");
|
||||
static LAY_FRZ: &[u8] = include_bytes!("../../assets/icons/layers/layfrz.svg");
|
||||
static LAY_THW: &[u8] = include_bytes!("../../assets/icons/layers/laythw.svg");
|
||||
static LAY_VP_FRZ: &[u8] = include_bytes!("../../assets/icons/layers/layvpfrz.svg");
|
||||
static LAY_VP_THW: &[u8] = include_bytes!("../../assets/icons/layers/layvpthw.svg");
|
||||
static LAY_LCK: &[u8] = include_bytes!("../../assets/icons/layers/laylck.svg");
|
||||
static LAY_ULK: &[u8] = include_bytes!("../../assets/icons/layers/layulk.svg");
|
||||
|
||||
@@ -630,6 +634,7 @@ pub fn osnap(snap: crate::snap::SnapType) -> &'static [u8] {
|
||||
S::Endpoint => OSNAP_ENDPOINT,
|
||||
S::Midpoint => OSNAP_MIDPOINT,
|
||||
S::Center => OSNAP_CENTER,
|
||||
S::GeometricCenter => OSNAP_GEOMETRIC_CENTER,
|
||||
S::Node => OSNAP_NODE,
|
||||
S::Quadrant => OSNAP_QUADRANT,
|
||||
S::Intersection => OSNAP_INTERSECTION,
|
||||
@@ -694,6 +699,15 @@ pub fn layer_freeze(frozen: bool) -> &'static [u8] {
|
||||
}
|
||||
}
|
||||
|
||||
/// Freeze-in-current-viewport icon bytes (frozen / thawed).
|
||||
pub fn layer_vp_freeze(frozen: bool) -> &'static [u8] {
|
||||
if frozen {
|
||||
LAY_VP_FRZ
|
||||
} else {
|
||||
LAY_VP_THW
|
||||
}
|
||||
}
|
||||
|
||||
/// Layer lock icon bytes (locked / unlocked).
|
||||
pub fn layer_lock(locked: bool) -> &'static [u8] {
|
||||
if locked {
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ pub fn discard_guard<'a>(
|
||||
iced::widget::text(crate::t!("Unsaved changes will be discarded.")).size(13.5),
|
||||
Space::new().height(12),
|
||||
row![
|
||||
button(iced::widget::text(crate::t!("Discard && close")).size(12))
|
||||
button(iced::widget::text(crate::t!("Discard & close")).size(12))
|
||||
.on_press(on_discard)
|
||||
.padding([5, 14])
|
||||
.style(button::danger),
|
||||
|
||||
+11
-5
@@ -518,12 +518,20 @@ impl Graph {
|
||||
_ => None,
|
||||
};
|
||||
let zoom = self.zoom();
|
||||
// Lay the nodes out relative to the visible area's top-left rather
|
||||
// than the graph origin: a `pin` clips to its own bounds, so nodes
|
||||
// left of / above the origin vanished once panned or zoomed out (#1592).
|
||||
let shift = Vector::new(self.pan.x / zoom, self.pan.y / zoom);
|
||||
let mut nodes = stack![];
|
||||
for (node, node_sections) in self.engine.nodes.iter().zip(sections) {
|
||||
let Some(ui) = self.ui.get(&node.id) else {
|
||||
continue;
|
||||
};
|
||||
nodes = nodes.push(pin(self.node_view(node, node_sections)).x(ui.pos.x).y(ui.pos.y));
|
||||
nodes = nodes.push(
|
||||
pin(self.node_view(node, node_sections))
|
||||
.x(ui.pos.x + shift.x)
|
||||
.y(ui.pos.y + shift.y),
|
||||
);
|
||||
}
|
||||
let mut layers = stack![
|
||||
canvas(Wires { wires, pending, width: 2.0 * zoom.max(0.5) })
|
||||
@@ -531,7 +539,6 @@ impl Graph {
|
||||
.height(Length::Fill),
|
||||
Zoomed {
|
||||
content: nodes.width(Length::Fill).height(Length::Fill).into(),
|
||||
pan: self.pan,
|
||||
zoom,
|
||||
},
|
||||
];
|
||||
@@ -955,17 +962,16 @@ impl canvas::Program<Message> for Wires {
|
||||
}
|
||||
|
||||
/// Lays its content out in graph space and draws and hit-tests it through
|
||||
/// `pan` and `zoom`, so every widget inside scales as one picture.
|
||||
/// `zoom`, so every widget inside scales as one picture.
|
||||
struct Zoomed<'a> {
|
||||
content: Element<'a, Message>,
|
||||
pan: Vector,
|
||||
zoom: f32,
|
||||
}
|
||||
|
||||
impl Zoomed<'_> {
|
||||
/// Content coordinates → screen, for a layer whose top-left is `origin`.
|
||||
fn transformation(&self, origin: Point) -> Transformation {
|
||||
Transformation::translate(origin.x + self.pan.x, origin.y + self.pan.y)
|
||||
Transformation::translate(origin.x, origin.y)
|
||||
* Transformation::scale(self.zoom)
|
||||
* Transformation::translate(-origin.x, -origin.y)
|
||||
}
|
||||
|
||||
+70
-1
@@ -239,6 +239,12 @@ pub struct CrosshairOptions {
|
||||
/// the crosshair arms disappear and a blue pickbox remains — the
|
||||
/// screen-level "the client wants YOU to pick" signal.
|
||||
pub pick_pending: bool,
|
||||
/// Draw only the pickbox: the active command previews a line that the
|
||||
/// full-length arms would cover.
|
||||
pub hide_arms: bool,
|
||||
/// Explicit object-snap marker colour; `None` picks one that reads on
|
||||
/// the canvas.
|
||||
pub snap_color: Option<[u8; 3]>,
|
||||
}
|
||||
|
||||
/// Rendering style for the viewport grid.
|
||||
@@ -1517,6 +1523,10 @@ impl canvas::Program<Message> for SelectionCanvas {
|
||||
if let Some((sp, snap_type)) = self.snap {
|
||||
let (r, g, b) = if snap_type == SnapType::ObjectPick {
|
||||
(0.95_f32, 0.50, 0.08) // orange object-snap marker
|
||||
} else if let Some([r, g, b]) = self.crosshair.snap_color {
|
||||
(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0)
|
||||
} else if crate::ui::style::common::canvas_is_light(self.crosshair_bg) {
|
||||
(0.80, 0.45, 0.0) // dark amber: yellow vanishes on a light canvas
|
||||
} else {
|
||||
(1.0, 0.9, 0.1) // classic yellow OSNAP
|
||||
};
|
||||
@@ -1569,6 +1579,25 @@ impl canvas::Program<Message> for SelectionCanvas {
|
||||
let path = canvas::Path::circle(sp, r);
|
||||
frame.stroke(&path, stroke);
|
||||
}
|
||||
SnapType::GeometricCenter => {
|
||||
// Pentagon around a centre dot: the area centroid.
|
||||
let r = 6.5_f32;
|
||||
let path = canvas::Path::new(|b| {
|
||||
for k in 0..5 {
|
||||
let a = -std::f32::consts::FRAC_PI_2
|
||||
+ k as f32 * std::f32::consts::TAU / 5.0;
|
||||
let p = Point::new(sp.x + r * a.cos(), sp.y + r * a.sin());
|
||||
if k == 0 {
|
||||
b.move_to(p);
|
||||
} else {
|
||||
b.line_to(p);
|
||||
}
|
||||
}
|
||||
b.close();
|
||||
});
|
||||
frame.stroke(&path, stroke.clone());
|
||||
frame.fill(&canvas::Path::circle(sp, 1.6), marker);
|
||||
}
|
||||
SnapType::Node => {
|
||||
// Circle with an inscribed X.
|
||||
let r = 5.5_f32;
|
||||
@@ -1915,7 +1944,7 @@ impl canvas::Program<Message> for SelectionCanvas {
|
||||
// The arms stay only for the normal (non-pending) cursor: a
|
||||
// waiting pick shows the box alone, regardless of the UCS
|
||||
// rotation, so the square is unmistakable.
|
||||
if !pick_pending {
|
||||
if !pick_pending && !self.crosshair.hide_arms {
|
||||
for angle in base_angles {
|
||||
let rad = (angle + self.crosshair.snap_angle_deg as f64).to_radians();
|
||||
let dir = Point::new(rad.cos() as f32, -rad.sin() as f32);
|
||||
@@ -3363,6 +3392,37 @@ impl DynInputCanvas {
|
||||
(Self::box_content(b).len() as f32 * DYN_CHAR_W) + DYN_PAD * 2.0
|
||||
}
|
||||
|
||||
/// Slide a box centred at `center` straight away from the crosshair until
|
||||
/// it neither covers the aim point nor a box already placed (#1546).
|
||||
fn clear_of(center: Point, w: f32, cursor: Point, placed: &[iced::Rectangle]) -> Point {
|
||||
const KEEP: f32 = 18.0;
|
||||
let hits = |c: Point| {
|
||||
let r = iced::Rectangle {
|
||||
x: c.x - w * 0.5,
|
||||
y: c.y - DYN_BOX_H * 0.5,
|
||||
width: w,
|
||||
height: DYN_BOX_H,
|
||||
};
|
||||
r.expand(KEEP).contains(cursor) || placed.iter().any(|p| p.intersects(&r))
|
||||
};
|
||||
let (mut dx, mut dy) = (center.x - cursor.x, center.y - cursor.y);
|
||||
let len = (dx * dx + dy * dy).sqrt();
|
||||
if len < 1.0 {
|
||||
(dx, dy) = (0.0, 1.0);
|
||||
} else {
|
||||
(dx, dy) = (dx / len, dy / len);
|
||||
}
|
||||
let mut c = center;
|
||||
for _ in 0..60 {
|
||||
if !hits(c) {
|
||||
break;
|
||||
}
|
||||
c.x += dx * 4.0;
|
||||
c.y += dy * 4.0;
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
/// Draw a value box centred at `center`, clamped inside `bounds`.
|
||||
fn draw_box(
|
||||
frame: &mut canvas::Frame,
|
||||
@@ -3647,6 +3707,7 @@ impl DynInputCanvas {
|
||||
}
|
||||
|
||||
// ── Box placement by role ──
|
||||
let mut placed: Vec<iced::Rectangle> = Vec::with_capacity(self.boxes.len());
|
||||
for b in &self.boxes {
|
||||
let center = b.center.unwrap_or_else(|| match b.role {
|
||||
DynRole::Angle => self.label_screen.unwrap_or_else(|| {
|
||||
@@ -3690,6 +3751,14 @@ impl DynInputCanvas {
|
||||
y: base.y + dy * len * 0.5 + ny * 16.0,
|
||||
},
|
||||
});
|
||||
let w = Self::box_width(b);
|
||||
let center = Self::clear_of(center, w, cursor, &placed);
|
||||
placed.push(iced::Rectangle {
|
||||
x: center.x - w * 0.5,
|
||||
y: center.y - DYN_BOX_H * 0.5,
|
||||
width: w,
|
||||
height: DYN_BOX_H,
|
||||
});
|
||||
Self::draw_box(frame, b, center, bounds, theme);
|
||||
}
|
||||
// Keep the tracking hint near the crosshair in guided layouts.
|
||||
|
||||
@@ -521,6 +521,7 @@ fn snap_override_items() -> Vec<MenuItem> {
|
||||
snap("Apparent Intersection", SnapType::ApparentIntersection),
|
||||
snap("Extension", SnapType::Extension),
|
||||
snap("Center", SnapType::Center),
|
||||
snap("Geometric Center", SnapType::GeometricCenter),
|
||||
snap("Quadrant", SnapType::Quadrant),
|
||||
snap("Tangent", SnapType::Tangent),
|
||||
snap("Perpendicular", SnapType::Perpendicular),
|
||||
|
||||
+13
-1
@@ -128,6 +128,8 @@ pub struct LayerInfo {
|
||||
pub visible: bool,
|
||||
pub frozen: bool,
|
||||
pub locked: bool,
|
||||
/// Layout with an active viewport: (its Layer Manager column, frozen there).
|
||||
pub vp_frozen: Option<(usize, bool)>,
|
||||
}
|
||||
|
||||
/// Full-screen backdrop for an open ribbon dropdown: closes the dropdown when
|
||||
@@ -1042,6 +1044,13 @@ impl Ribbon {
|
||||
crate::ui::icons::layer_lock(ll),
|
||||
Message::LayerToggleLock(info.name.clone()),
|
||||
);
|
||||
// Freeze in the current viewport only (#1466).
|
||||
let vp_freeze = info.vp_frozen.map(|(column, frozen)| {
|
||||
icon_btn(
|
||||
crate::ui::icons::layer_vp_freeze(frozen),
|
||||
Message::LayerToggleVpFreeze(info.name.clone(), column),
|
||||
)
|
||||
});
|
||||
let checkmark: Element<'_, Message> =
|
||||
crate::ui::icons::themed_check_cell(is_active);
|
||||
let label =
|
||||
@@ -1067,7 +1076,10 @@ impl Ribbon {
|
||||
.padding([4, 4]);
|
||||
|
||||
container(
|
||||
row![checkmark, vis, freeze, lock, select]
|
||||
row![checkmark, vis, freeze]
|
||||
.push(vp_freeze)
|
||||
.push(lock)
|
||||
.push(select)
|
||||
.spacing(5)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
|
||||
@@ -310,7 +310,7 @@ pub(super) const TOP_HIST_GAP: f32 = 4.0;
|
||||
|
||||
pub(crate) const UNDO_HISTORY_ID: &str = "UNDO_HISTORY";
|
||||
pub(crate) const REDO_HISTORY_ID: &str = "REDO_HISTORY";
|
||||
pub(super) const LAYER_COMBO_ID: &str = "LAYER_COMBO";
|
||||
pub(crate) const LAYER_COMBO_ID: &str = "LAYER_COMBO";
|
||||
/// Dropdown id for the tab-bar panel-density selector.
|
||||
pub(super) const COLLAPSE_MODE_ID: &str = "COLLAPSE_MODE";
|
||||
pub(super) const PROP_COLOR_ID: &str = "PROP_COLOR";
|
||||
|
||||
+28
-22
@@ -384,6 +384,29 @@ pub fn view_window<'a>(
|
||||
};
|
||||
|
||||
// Linear unit formats shared by DIMLUNIT / DIMALTU.
|
||||
// Precision reads as the number pattern it produces (#1426).
|
||||
const OPT_PREC: &[(&str, &str)] = &[
|
||||
("0", "0"),
|
||||
("1", "0.0"),
|
||||
("2", "0.00"),
|
||||
("3", "0.000"),
|
||||
("4", "0.0000"),
|
||||
("5", "0.00000"),
|
||||
("6", "0.000000"),
|
||||
("7", "0.0000000"),
|
||||
("8", "0.00000000"),
|
||||
];
|
||||
// A precision dropdown, or the read-only value while the option is off.
|
||||
let prec_field = move |label: Cow<'static, str>, fld: DsField, val: &'a str, enabled: bool| -> Element<'a, Message> {
|
||||
if enabled {
|
||||
enum_field(label, fld, val, OPT_PREC)
|
||||
} else {
|
||||
row![lbl(label), mk_field_enabled(fld, val, false)]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center)
|
||||
.into()
|
||||
}
|
||||
};
|
||||
const OPT_LUNIT: &[(&str, &str)] = &[
|
||||
("1", "Scientific"),
|
||||
("2", "Decimal"),
|
||||
@@ -900,8 +923,7 @@ pub fn view_window<'a>(
|
||||
4 => column![
|
||||
text(t!("Linear dimensions")).size(11).style(primary_style),
|
||||
enum_field(t!("Unit format"), DsField::Dimlunit, vals.dimlunit, OPT_LUNIT),
|
||||
row![lbl(t!("Precision")), mk_field(DsField::Dimdec, vals.dimdec)]
|
||||
.spacing(8).align_y(iced::Center),
|
||||
prec_field(t!("Precision"), DsField::Dimdec, vals.dimdec, true),
|
||||
if matches!(vals.dimlunit.trim(), "4" | "5") {
|
||||
enum_field(
|
||||
t!("Fraction format"),
|
||||
@@ -946,8 +968,7 @@ pub fn view_window<'a>(
|
||||
vals.dimaunit,
|
||||
&[("0", "Decimal degrees"), ("1", "Degrees, minutes, seconds"), ("2", "Gradians"), ("3", "Radians"), ("4", "Surveyor's units")],
|
||||
),
|
||||
row![lbl(t!("Precision")), mk_field(DsField::Dimadec, vals.dimadec)]
|
||||
.spacing(8).align_y(iced::Center),
|
||||
prec_field(t!("Precision"), DsField::Dimadec, vals.dimadec, true),
|
||||
enum_field(
|
||||
t!("Zero suppression"),
|
||||
DsField::Dimazin,
|
||||
@@ -970,24 +991,14 @@ pub fn view_window<'a>(
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
row![
|
||||
lbl(t!("Precision")),
|
||||
mk_field_enabled(DsField::Dimaltd, vals.dimaltd, vals.dimalt)
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
prec_field(t!("Precision"), DsField::Dimaltd, vals.dimaltd, vals.dimalt),
|
||||
if vals.dimalt {
|
||||
enum_field(t!("Unit format"), DsField::Dimaltu, vals.dimaltu, OPT_LUNIT)
|
||||
} else {
|
||||
row![lbl(t!("Unit format")), container(text(alternate_unit_name).size(11).style(muted_style)).padding([4, 7]).width(150)]
|
||||
.spacing(8).align_y(iced::Center).into()
|
||||
},
|
||||
row![
|
||||
lbl(t!("Tolerance precision")),
|
||||
mk_field_enabled(DsField::Dimalttd, vals.dimalttd, vals.dimalt)
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
prec_field(t!("Tolerance precision"), DsField::Dimalttd, vals.dimalttd, vals.dimalt),
|
||||
row![
|
||||
lbl(t!("Round off")),
|
||||
mk_field_enabled(DsField::Dimaltrnd, vals.dimaltrnd, vals.dimalt)
|
||||
@@ -1042,12 +1053,7 @@ pub fn view_window<'a>(
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
row![
|
||||
lbl(t!("Precision")),
|
||||
mk_field_enabled(DsField::Dimtdec, vals.dimtdec, vals.dimtol || vals.dimlim)
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
prec_field(t!("Precision"), DsField::Dimtdec, vals.dimtdec, vals.dimtol || vals.dimlim),
|
||||
row![
|
||||
lbl(t!("Height scale")),
|
||||
mk_field_enabled(DsField::Dimtfac, vals.dimtfac, vals.dimtol || vals.dimlim)
|
||||
|
||||
@@ -218,7 +218,7 @@ pub fn view_window<'a>(
|
||||
.on_press(Message::AliasEditorApply)
|
||||
.padding([4, 16])
|
||||
.style(button::primary);
|
||||
let apply_exit = button(text(t!("Apply && Exit")).size(12))
|
||||
let apply_exit = button(text(t!("Apply & Exit")).size(12))
|
||||
.on_press(Message::AliasEditorApplyExit)
|
||||
.padding([4, 16])
|
||||
.style(button::primary);
|
||||
@@ -307,7 +307,7 @@ pub fn view_window<'a>(
|
||||
text(t!("Unsaved changes will be discarded.")).size(14),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
button(text(t!("Discard && close")).size(12))
|
||||
button(text(t!("Discard & close")).size(12))
|
||||
.on_press(Message::AliasEditorCloseDiscard)
|
||||
.padding([4, 12])
|
||||
.style(button::danger),
|
||||
|
||||
@@ -209,11 +209,14 @@ pub fn view_window<'a>(
|
||||
zoom_factor_input: &'a str,
|
||||
drawing_prefs: DrawingPrefs,
|
||||
folders: Folders,
|
||||
qnew_template: &'a str,
|
||||
double_click_block_refedit: bool,
|
||||
double_click_block_attedit: bool,
|
||||
cursor_type: CursorType,
|
||||
crosshair_color: Option<[u8; 3]>,
|
||||
crosshair_color_input: &'a str,
|
||||
snap_marker_color: Option<[u8; 3]>,
|
||||
snap_marker_color_input: &'a str,
|
||||
lineweight_display_scale: i32,
|
||||
model_space: &'a crate::app::config::ModelSpaceThemeConfig,
|
||||
model_bg_input: &'a str,
|
||||
@@ -522,6 +525,24 @@ pub fn view_window<'a>(
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let snap_rgb = snap_marker_color.unwrap_or([255, 230, 26]);
|
||||
let snap_swatch = container(Space::new())
|
||||
.width(28)
|
||||
.height(22)
|
||||
.style(move |theme: &Theme| container::Style {
|
||||
background: Some(Background::Color(iced::Color::from_rgb8(
|
||||
snap_rgb[0],
|
||||
snap_rgb[1],
|
||||
snap_rgb[2],
|
||||
))),
|
||||
border: Border {
|
||||
color: theme.palette().background.strong.color,
|
||||
width: 1.0,
|
||||
radius: 3.0.into(),
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let model_bg_rgb = model_space.custom_bg.unwrap_or(crate::app::config::CLASSIC_CAD_DARK_BG);
|
||||
|
||||
let paper_bg_rgb = model_space.custom_paper_bg.unwrap_or(crate::app::config::DEFAULT_PAPER_BG);
|
||||
@@ -769,6 +790,18 @@ pub fn view_window<'a>(
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
.push(Space::new().height(10))
|
||||
.push(
|
||||
row![
|
||||
text(crate::t!("Snap marker color")).size(12).width(140),
|
||||
snap_swatch,
|
||||
text_input(crate::t!("#RRGGBB or blank").as_ref(), snap_marker_color_input)
|
||||
.on_input(Message::SnapMarkerColorChanged)
|
||||
.width(150),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
.push(Space::new().height(6))
|
||||
.push(
|
||||
text(crate::t!("Leave the color blank to keep automatic viewport contrast."))
|
||||
@@ -1666,6 +1699,21 @@ pub fn view_window<'a>(
|
||||
folder_row(crate::t!("Plugins"), folders.plugins.clone()),
|
||||
Space::new().height(12),
|
||||
folder_row(crate::t!("Autosave files"), folders.autosave.clone()),
|
||||
Space::new().height(16),
|
||||
text(crate::t!("Default template for new drawings")).size(12),
|
||||
Space::new().height(4),
|
||||
row![
|
||||
text_input(crate::t!("Blank drawing").as_ref(), qnew_template)
|
||||
.on_input(Message::QnewTemplateChanged)
|
||||
.size(11)
|
||||
.width(Fill),
|
||||
button(text(crate::t!("Browse...")).size(11))
|
||||
.padding([4, 10])
|
||||
.style(button::secondary)
|
||||
.on_press(Message::QnewTemplateBrowse),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
]
|
||||
.spacing(0)
|
||||
.width(sizing.width);
|
||||
|
||||
@@ -1553,7 +1553,7 @@ pub fn view_window(
|
||||
paper_space_option(s.paperspace_last, t!("Paper space last"), PlotFlag::PaperspaceLast),
|
||||
check(t!("Merge overlapping lines"), s.merge_lines, PlotFlag::MergeLines),
|
||||
check(t!("Plot stamp"), s.stamp, PlotFlag::Stamp),
|
||||
paper_space_option(s.save_to_layout, t!("Save changes to layout"), PlotFlag::SaveToLayout),
|
||||
check(t!("Save changes to layout"), s.save_to_layout, PlotFlag::SaveToLayout),
|
||||
]
|
||||
.spacing(6)
|
||||
.width(width),
|
||||
|
||||
@@ -241,7 +241,7 @@ pub fn view_window<'a>(
|
||||
.on_press(Message::ShortcutEditorApply)
|
||||
.padding([4, 16])
|
||||
.style(button::primary);
|
||||
let apply_exit = button(text(t!("Apply && Exit")).size(12))
|
||||
let apply_exit = button(text(t!("Apply & Exit")).size(12))
|
||||
.on_press(Message::ShortcutEditorApplyExit)
|
||||
.padding([4, 16])
|
||||
.style(button::primary);
|
||||
@@ -330,7 +330,7 @@ pub fn view_window<'a>(
|
||||
text(t!("Unsaved changes will be discarded.")).size(14),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
button(text(t!("Discard && close")).size(12))
|
||||
button(text(t!("Discard & close")).size(12))
|
||||
.on_press(Message::ShortcutEditorCloseDiscard)
|
||||
.padding([4, 12])
|
||||
.style(button::danger),
|
||||
|
||||
Reference in new issue
Block a user