1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 01:14:04 +02:00

eeshow/gui-over.c: outwitted myself with the overlay direction logic

This commit is contained in:
Werner Almesberger 2016-08-15 04:33:34 -03:00
parent 5e9bc68093
commit 562f36b20c

View File

@ -101,18 +101,10 @@ fprintf(stderr, "%d + %d %d + %d\n",
w = ink_w + 2 * style->pad; w = ink_w + 2 * style->pad;
h = ink_h + 2 * style->pad; h = ink_h + 2 * style->pad;
if (dx < 0 || dy < 0) {
double x1, y1, x2, y2;
int sw, sh;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
sw = x2 - x1;
sh = y2 - y1;
if (dx < 0) if (dx < 0)
x = sw - x - w; x -= w;
if (dy < 0) if (dy < 0)
y = sh - y - h; y -= h;
}
tx = x - ink_rect.x / PANGO_SCALE + style->pad; tx = x - ink_rect.x / PANGO_SCALE + style->pad;
ty = y - ink_rect.y / PANGO_SCALE + style->pad; ty = y - ink_rect.y / PANGO_SCALE + style->pad;
@ -194,14 +186,23 @@ void overlay_draw_all(struct overlay *overlays, cairo_t *cr, int x, int y)
int dx = 1; int dx = 1;
int dy = 1; int dy = 1;
if (x < 0 || y < 0) {
double x1, y1, x2, y2;
int sw, sh;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
sw = x2 - x1;
sh = y2 - y1;
if (x < 0) { if (x < 0) {
x = -x; x = sw + x;
dx = -1; dx = -1;
} }
if (y < 0) { if (y < 0) {
y = -y; y = sh + y;
dy = -1; dy = -1;
} }
}
overlay_draw_all_d(overlays, cr, x, y, dx, dy); overlay_draw_all_d(overlays, cr, x, y, dx, dy);
} }