Snapping: tangent and perpendicular snapping, View > Snapping (#2530)

Squashed from #2537 onto main.
This commit is contained in:
bflatastic
2026-10-23 03:22:54 +07:00
parent ffeb37f481
commit 8bf7ffe39d
38 changed files with 431 additions and 21 deletions
+2
View File
@@ -235,6 +235,8 @@ pub const PREF_SPECS: &[PrefSpec] = &[
p!("measurementLabels", "Smart Guides", "Display Options", "Measurement Labels", bool),
p!("spacingGuides", "Smart Guides", "Display Options", "Spacing Guides", bool),
p!("snappingTolerance", "Smart Guides", "", "Snapping Tolerance", num(0.0, 40.0, "pt")),
p!("snapTangent", "Smart Guides", "Geometric Guides", "Snap to Tangent", bool),
p!("snapPerpendicular", "Smart Guides", "Geometric Guides", "Snap to Perpendicular", bool),
// Slices
p!("showSliceNumbers", "Slices", "", "Show Slice Numbers", bool),
p!("sliceLineColor", "Slices", "", "Line Color", color),
+4
View File
@@ -969,6 +969,8 @@ pub struct Prefs {
pub measurement_labels: bool,
pub spacing_guides: bool,
pub snapping_tolerance: f64,
pub snap_tangent: bool,
pub snap_perpendicular: bool,
// Slices
pub show_slice_numbers: bool,
pub slice_line_color: String,
@@ -1218,6 +1220,8 @@ impl Default for Prefs {
measurement_labels: true,
spacing_guides: true,
snapping_tolerance: 4.0,
snap_tangent: true,
snap_perpendicular: true,
show_slice_numbers: true,
slice_line_color: s("#ff3f3f"),
hyphenation_language: s("English: USA"),
+2
View File
@@ -238,6 +238,8 @@ impl Session {
// wins instead of pixels quietly rounding every drag to whole points (#1816).
snap_to_pixel: view.snap_to_pixel && !view.snap_to_grid,
snap_to_point: view.snap_to_point,
snap_tangent: self.prefs.snap_tangent,
snap_perpendicular: self.prefs.snap_perpendicular,
snap_to_glyph: view.snap_to_glyph && view.smart_guides && !view.snap_to_grid,
corner_widgets: view.corner_widgets,
fill_active: self.fill_active,