Skip to content

Commit 6a57a1d

Browse files
committed
bugfix touch update going out of bounds uint16_t
1 parent 0fa0dfb commit 6a57a1d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

klib/hardware/touch/touch.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ namespace klib::hardware::touch {
119119
else {
120120
// scale the x and y to the display width/height
121121
const vector2<uint16_t> xy = (
122-
(position * vector2<uint16_t>{DisplayWidth, DisplayHeight}) /
123-
vector2<uint16_t>{Width, Height}
124-
);
122+
(position.cast<uint32_t>() * vector2<uint32_t>{DisplayWidth, DisplayHeight}) /
123+
vector2<uint32_t>{Width, Height}
124+
).cast<uint16_t>();
125125

126126
// update the id in the array
127127
data[id] = {

0 commit comments

Comments
 (0)