fix(text_input): draw selected text in the theme's selected_text_color
This commit is contained in:
parent
eec2f7619d
commit
ff7c753302
1 changed files with 32 additions and 20 deletions
|
|
@ -2920,8 +2920,7 @@ pub fn draw<'a, Message>(
|
||||||
text_color
|
text_color
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer.fill_text(
|
let text = Text {
|
||||||
Text {
|
|
||||||
content: if text.is_empty() {
|
content: if text.is_empty() {
|
||||||
placeholder.to_string()
|
placeholder.to_string()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2936,11 +2935,24 @@ pub fn draw<'a, Message>(
|
||||||
shaping: text::Shaping::Advanced,
|
shaping: text::Shaping::Advanced,
|
||||||
wrapping: text::Wrapping::None,
|
wrapping: text::Wrapping::None,
|
||||||
ellipsize: text::Ellipsize::None,
|
ellipsize: text::Ellipsize::None,
|
||||||
},
|
};
|
||||||
|
renderer.fill_text(text.clone(), bounds.position(), color, text_bounds);
|
||||||
|
|
||||||
|
// Redraw the same text in the selected color, clipped to the selection quads,
|
||||||
|
// so glyph shaping and positioning stay identical to the unselected pass.
|
||||||
|
if is_selecting {
|
||||||
|
let shift = Vector::new(alignment_offset - offset, 0.0);
|
||||||
|
for (quad, _) in &cursors {
|
||||||
|
renderer.with_layer(quad.bounds + shift, |renderer| {
|
||||||
|
renderer.fill_text(
|
||||||
|
text.clone(),
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
color,
|
appearance.selected_text_color,
|
||||||
text_bounds,
|
text_bounds,
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: we always must clip with a layer because of what appears to be a tiny-skia text clipping issue.
|
// FIXME: we always must clip with a layer because of what appears to be a tiny-skia text clipping issue.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue