Type tool: Alt-click on a closed path makes area type too; type along a closed path stays with Type on a Path

This commit is contained in:
ham9zah
2026-11-02 14:36:09 +07:00
committed by bflatastic
parent 6d948f4679
commit 601f4854cd
5 changed files with 45 additions and 31 deletions
+4 -5
View File
@@ -55,7 +55,6 @@ impl Tool for TypeTool {
}
self.press = Some((ev.pos, self.snap.press(cx, ev.pos, self.editing.as_slice(), None)));
self.held = Some(self.acting(ev.mods));
self.held_alt = ev.mods.alt && self.editing.is_none();
self.drag = None;
vec![]
}
@@ -633,12 +632,12 @@ impl Tool for TypeTool {
/// The pointer of the Type tool that a press would act as with the keys held, or, while a
/// press is held, of the one it acts as ([`TypeTool::acting`]).
fn cursor(&self, cx: &ToolContext, p: Point, m: Mods) -> Cursor {
let ((mode, vertical), alt) = match (self.press, self.held) {
(Some(_), Some(held)) => (held, self.held_alt),
_ => (self.acting(m), m.alt && self.editing.is_none()),
let (mode, vertical) = match (self.press, self.held) {
(Some(_), Some(held)) => held,
_ => self.acting(m),
};
// While type is being edited a click on a path only ends the editing.
let in_path = if self.editing.is_some() { None } else { Self::in_path(cx, p, mode, alt) };
let in_path = if self.editing.is_some() { None } else { Self::in_path(cx, p, mode) };
match (in_path, vertical) {
(Some((_, false)), false) => Cursor::TypeArea,
(Some((_, false)), true) => Cursor::TypeAreaVertical,