Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge remote-tracking branch 'upstream/main' into fix/6085-text-caret-contrast

itsF4LCON85aa10b16d54
diff --cc crates/ui-egui/src/type_tool.rs
index d85964ed6,a8125201d..88119f917
--- a/crates/ui-egui/src/type_tool.rs
+++ b/crates/ui-egui/src/type_tool.rs
@@@ -1083,14 -1093,15 +1093,15 @@@ pub fn draw_overlay(app: &mut Photocraf
}
}
} else {
- // Blinking caret (Photoshop's ~0.53 s rhythm), solid while dragging.
+ // Blinking caret (Photoshop's ~0.53 s rhythm), solid while dragging or immediately after interaction.
let time = painter.ctx().input(|i| i.time);
- if ed.dragging || (time * 1000.0 / 530.0) as i64 % 2 == 0 {
+ let elapsed = (time - app.ui.caret_blink_time).max(0.0);
+ if ed.dragging || (elapsed * 1000.0 / 530.0) as i64 % 2 == 0 {
let (x, top, bot) = l.caret(a);
let (x, top, bot) = if l.lines.is_empty() { (0.0, -(12.0 * l.px_per_pt.max(1.0)), 3.0) } else { (x, top, bot) };
- let c = if crate::theme::Tokens::get(painter.ctx()).pro { Color32::WHITE } else { Color32::BLACK };
- painter.line_segment([scr(x, top), scr(x, bot)], Stroke::new(1.5, c));
- painter.line_segment([scr(x, top), scr(x, bot)], Stroke::new(0.75, Color32::BLACK));
+ for stroke in CARET_STROKES {
+ painter.line_segment([scr(x, top), scr(x, bot)], stroke);
+ }
}
}
}