1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-17 20:04:05 +02:00

eeshow/gui/sheet.c: remove glabel pop-up when scrolling

Scrolling changes the geometry and the pop-up ended up at weird places.
This commit is contained in:
Werner Almesberger 2016-08-18 12:24:28 -03:00
parent cb2cdd59e6
commit bbdf819c85

View File

@ -47,25 +47,27 @@ static void canvas_coord(const struct gui_ctx *ctx,
/* ----- Zoom -------------------------------------------------------------- */ /* ----- Zoom -------------------------------------------------------------- */
static void zoom_in(struct gui_ctx *ctx, int x, int y) static bool zoom_in(struct gui_ctx *ctx, int x, int y)
{ {
if (ctx->zoom == 0) if (ctx->zoom == 0)
return; return 0;
ctx->zoom--; ctx->zoom--;
ctx->x = (ctx->x + x) / 2; ctx->x = (ctx->x + x) / 2;
ctx->y = (ctx->y + y) / 2; ctx->y = (ctx->y + y) / 2;
redraw(ctx); redraw(ctx);
return 1;
} }
static void zoom_out(struct gui_ctx *ctx, int x, int y) static bool zoom_out(struct gui_ctx *ctx, int x, int y)
{ {
if (ctx->curr_sheet->w >> ctx->zoom <= 16) if (ctx->curr_sheet->w >> ctx->zoom <= 16)
return; return 0;
ctx->zoom++; ctx->zoom++;
ctx->x = 2 * ctx->x - x; ctx->x = 2 * ctx->x - x;
ctx->y = 2 * ctx->y - y; ctx->y = 2 * ctx->y - y;
redraw(ctx); redraw(ctx);
return 1;
} }
@ -371,11 +373,16 @@ static void sheet_scroll(void *user, int x, int y, int dy)
struct gui_ctx *ctx = user; struct gui_ctx *ctx = user;
int ex, ey; int ex, ey;
canvas_coord(ctx, x, y, &ex, &ey); canvas_coord(ctx, x, y, &ex, &ey);
if (dy < 0) if (dy < 0) {
zoom_in(ctx, ex, ey); if (!zoom_in(ctx, ex, ey))
else return;
zoom_out(ctx, ex, ey); } else {
if (!zoom_out(ctx, ex, ey))
return;
}
dehover_glabel(ctx);
} }