From 4473f6d8b7bda3ecb6acaf16e8609a219f7ef6fc Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sat, 13 Jul 2019 00:35:19 +0100 Subject: Implement scroll input --- src/imv.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/imv.c') diff --git a/src/imv.c b/src/imv.c index c6fe9f6..aa99a72 100644 --- a/src/imv.c +++ b/src/imv.c @@ -455,6 +455,14 @@ static void event_handler(void *data, const struct imv_event *e) e->data.mouse_motion.dy, imv->current_image); } break; + case IMV_EVENT_MOUSE_SCROLL: + { + double x, y; + imv_window_get_mouse_position(imv->window, &x, &y); + imv_viewport_zoom(imv->view, imv->current_image, IMV_ZOOM_MOUSE, + x, y, -e->data.mouse_scroll.dy); + } + break; case IMV_EVENT_CUSTOM: consume_internal_event(imv, e->data.custom); break; @@ -464,15 +472,6 @@ static void event_handler(void *data, const struct imv_event *e) } -/* static void scroll_callback(GLFWwindow *window, double x, double y)*/ -/* {*/ -/* (void)x;*/ -/* struct imv *imv = glfwGetWindowUserPointer(window);*/ -/* imv_viewport_zoom(imv->view, imv->current_image, IMV_ZOOM_MOUSE,*/ -/* imv->last_cursor_position.x,*/ -/* imv->last_cursor_position.y, -y);*/ -/* }*/ - static void log_to_stderr(enum imv_log_level level, const char *text, void *data) { (void)data; -- cgit v1.2.3