summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-10 12:41:53 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-10 12:41:53 +0100
commit77bf93c32f281b0b760413320e33ffd7883a065d (patch)
treefe1f415596c742d561db291df1897f22e781181d /widget
parent4b33a450e0b358f5e95993d65f3de1afebeb3aca (diff)
downloadiced-77bf93c32f281b0b760413320e33ffd7883a065d.tar.gz
iced-77bf93c32f281b0b760413320e33ffd7883a065d.tar.bz2
iced-77bf93c32f281b0b760413320e33ffd7883a065d.zip
Use integer coordinates for input caret
This should stop the caret from changing thickness in screens with an integral scale factor.
Diffstat (limited to 'widget')
-rw-r--r--widget/src/text_editor.rs2
-rw-r--r--widget/src/text_input.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index 018ffd9c..c7d62d92 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -538,7 +538,7 @@ where
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
- x: position.x,
+ x: position.x.floor(),
y: position.y,
width: 1.0,
height: self
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index 449524fc..9ed8480a 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -390,7 +390,8 @@ where
Some((
renderer::Quad {
bounds: Rectangle {
- x: text_bounds.x + text_value_width,
+ x: (text_bounds.x + text_value_width)
+ .floor(),
y: text_bounds.y,
width: 1.0,
height: text_bounds.height,