diff --git a/solidify/overlap.c b/solidify/overlap.c index 95b2a1a..cebf03c 100644 --- a/solidify/overlap.c +++ b/solidify/overlap.c @@ -312,12 +312,21 @@ static void rotate(struct matrix *m, double r) static void do_shift(struct matrix *m, int dx, int dy) { m->b[0] += dx; - m->b[1] -= dy; + m->b[1] += dy; } static void shift(struct matrix *m, int dx, int dy, int dir) { + /* + * Wheeling "up" in each quadrant shifts in the respective direction, + * wheeling "down" in the opposite direction. + * + * No rule without exception: we treat the "down" quadrant like the + * "up" quadrant, because it would be extremely counter-intuitive to + * wheel "up" to move "down". + */ + if (dx > 0 && dy < dx && dy > -dx) do_shift(m, dir, 0); if (dx < 0 && dy < -dx && dy > dx) @@ -325,7 +334,7 @@ static void shift(struct matrix *m, int dx, int dy, int dir) if (dy > 0 && dx < dy && dx > -dy) do_shift(m, 0, dir); if (dy < 0 && dx < -dy && dx > dy) - do_shift(m, 0, -dir); + do_shift(m, 0, dir); /* exception ! */ } @@ -363,14 +372,14 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, if (center) shift(&s->a->m, dx, dy, 1); else - rotate(&s->a->m, -r); + rotate(&s->a->m, dx > 0 ? r : -r); draw_image(darea, s, osd); break; case GDK_SCROLL_DOWN: if (center) shift(&s->a->m, dx, dy, -1); else - rotate(&s->a->m, r); + rotate(&s->a->m, dx > 0 ? -r : r); draw_image(darea, s, osd); break; default: