13
0

Fix tracking-text offset

If position along a given axis is not tracked, then the
offset was applied repeatedly to the current position.
This caused the coordinate to run away.
This commit is contained in:
Robin Gareus 2020-12-30 00:04:47 +01:00
parent d741f01ad0
commit 8a14a7a00b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -61,14 +61,16 @@ TrackingText::pointer_motion (Duple const& winpos)
if (!track_x) { if (!track_x) {
pos.x = position ().x; pos.x = position ().x;
} else {
pos.x += offset.x;
} }
if (!track_y) { if (!track_y) {
pos.y = position ().y; pos.y = position ().y;
} else {
pos.y += offset.y;
} }
pos = pos.translate (offset);
/* keep inside the window */ /* keep inside the window */
Rect r (0, 0, _canvas->width (), _canvas->height ()); Rect r (0, 0, _canvas->width (), _canvas->height ());