rootston: fix input events for rotated views

This commit is contained in:
emersion 2019-03-02 13:42:35 +01:00 committed by Drew DeVault
parent c2178d51a8
commit 6a60dafe59
2 changed files with 6 additions and 20 deletions

View file

@ -30,11 +30,11 @@ void rotate_child_position(double *sx, double *sy, double sw, double sh,
}
// Coordinates relative to the center of the subsurface
double ox = *sx - pw/2 + sw/2,
oy = *sy - ph/2 + sh/2;
double cx = *sx - pw/2 + sw/2,
cy = *sy - ph/2 + sh/2;
// Rotated coordinates
double rx = cos(rotation)*ox - sin(rotation)*oy,
ry = cos(rotation)*oy + sin(rotation)*ox;
double rx = cos(rotation)*cx - sin(rotation)*cy,
ry = cos(rotation)*cy + sin(rotation)*cx;
*sx = rx + pw/2 - sw/2;
*sy = ry + ph/2 - sh/2;
}