Repository navigation
Land #2825, #2347, #2350, #2103, #3164: PER, TAN and Center from anywhere on the object, Tab through every snap, CIRCLE tangents, viewport-frozen layers #3351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 35 commits
90a239b
97fbaf7
98401d6
f4f0702
4a0063f
64cb95d
55ec024
4ce72c6
8acdcee
595ccf2
c40ff96
a3560a1
28ed9c5
1998da2
29bf02b
1b577e9
c00bc59
b1dcb46
c2af11d
a2f7321
080c96a
5bfba91
6971715
0ca0af9
9746b69
fe3b20a
ded4122
ca90388
472d366
71f4879
0314c8b
c647cb4
0b2cfae
f8769d9
3944964
334bcc3
7aaee29
d049a1c
adca169
17e0c81
7afe6b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,14 +126,36 @@ pub fn snap_name(m: u32) -> &'static str { | |
| mode::ALL.iter().find(|(b, _)| *b == m).map_or("None", |(_, n)| *n) | ||
| } | ||
|
|
||
| /// The candidate snaps near `cursor` for Tab cycling: every object snap within the aperture, the | ||
| /// one [`crate::snap::osnap`] picks first and the rest in its order (specific snaps nearest | ||
| /// first, then deferred snaps, then Nearest), without repeats. | ||
| /// The candidate snaps near `cursor` for Tab cycling: the snap [`crate::snap::osnap`] picks | ||
| /// first, then every other snap of the modes in `osmode` under the aperture (each endpoint of | ||
| /// each object, each intersection …; [`crate::snap::osnap_all`]), best first, without repeats. | ||
| pub fn snap_candidates(d: &Drawing, space: &Space, cursor: Vec2, aperture: f64, osmode: u32, base: Option<Vec2>, deferred: bool) -> Vec<SnapHit> { | ||
| if osmode & !mode::HATCH == 0 || osmode & mode::OFF != 0 { | ||
| snap_candidates_with_frozen(d, space, cursor, aperture, osmode, base, deferred, &[]) | ||
| } | ||
|
|
||
| /// [`snap_candidates`] skipping entities (and block leaves) on `frozen` layers in `space`. | ||
| #[allow(clippy::too_many_arguments)] | ||
| pub fn snap_candidates_with_frozen( | ||
| d: &Drawing, | ||
| space: &Space, | ||
| cursor: Vec2, | ||
| aperture: f64, | ||
| osmode: u32, | ||
| base: Option<Vec2>, | ||
| deferred: bool, | ||
| frozen: &[String], | ||
| ) -> Vec<SnapHit> { | ||
| // A base that is not a number would give meaningless perpendiculars and tangents. | ||
| if osmode & !mode::HATCH == 0 || osmode & mode::OFF != 0 || base.is_some_and(|b| !b.is_finite()) { | ||
| return Vec::new(); | ||
| } | ||
| crate::snap::osnap_all(d, space, cursor, aperture, osmode, base, deferred) | ||
| let mut out: Vec<SnapHit> = crate::snap::osnap_with_frozen(d, space, cursor, aperture, osmode, base, deferred, frozen).into_iter().collect(); | ||
| for h in crate::snap::osnap_all_with_frozen(d, space, cursor, aperture, osmode, base, deferred, frozen) { | ||
| if !out.iter().any(|o| o.same(&h, aperture)) { | ||
| out.push(h); | ||
| } | ||
| } | ||
| out | ||
| } | ||
|
|
||
| /// Strip the international (`_`) and transparent (`'`) prefixes a modifier may be typed with. | ||
|
|
@@ -343,12 +365,15 @@ impl Session { | |
| Frame::Snap { mode } => { | ||
| // Snap the point with this mode alone, within the aperture. | ||
| let prompt = self.current_prompt(); | ||
| let space = self.space(); | ||
| let (doc, space, frozen) = { | ||
| let st = self.state()?; | ||
| (st.doc.clone(), st.edit_space(), st.viewport_frozen().to_vec()) | ||
| }; | ||
| let aperture = self.pixel_size() * self.settings.aperture.max(1.0); | ||
| let hatch = if self.settings.osnaphatch { mode::HATCH } else { 0 }; | ||
| let base = prompt.as_ref().and_then(|q| q.base); | ||
| let deferred = prompt.as_ref().is_some_and(|q| q.deferred); | ||
| let hit = crate::snap::osnap(self.doc()?, &space, p, aperture, mode | hatch, base, deferred); | ||
| let hit = crate::snap::osnap_with_frozen(&doc, &space, p, aperture, mode | hatch, base, deferred, &frozen); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the Tab-selected hit when an END override consumes a point. When an END override is pending, Consume the override with the hit the canvas already selected. Keep the re-query only for typed coordinates, which carry no
|
||
| match hit { | ||
| Some(h) if self.point_mods.is_empty() => return self.input_snapped(h), | ||
| Some(h) => p = h.point, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CIRCLE 3P misses valid tangent circles on the far side of the picks.
For a CIRCLE 3P with two plain points and a TAN pick on an arc,
ttt_wherereturnsNonewhen the only valid circle lies on the opposite side of the picks. The seeds are the centroid circle and the circumcircle through the picks. For this input both seeds lie on the positive-y side, so the solver never reaches the valid circle. The arc-sweep filter then rejects the only circle it finds.Example: plain points at (3,0) and (5,0), and a TAN pick at (0,1) on the unit arc from 90° to 310°. The valid circle has center (4, −√48) and radius 7. It touches the arc at 300°, inside the sweep. The mirror circle, with center (4, √48), touches at 60°, outside the sweep, and is rejected. The command then reports "Circle does not exist."
The solver must find a valid tangent circle on the picked arc whenever one exists. Its search must cover both sides of the picks, not only the side of the circumcircle. The method is open: seeding, mirrored starts, or another approach can satisfy this requirement.