Framebuffer: Add keyboard controls for scaling.

This commit is contained in:
Michael Drake 2019-08-03 11:00:09 +01:00
parent acad436d68
commit 3a4477413a
1 changed files with 34 additions and 0 deletions

View File

@ -910,6 +910,40 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
widget_scroll_y(gw, 100, false);
break;
case NSFB_KEY_MINUS:
if (modifier & FBTK_MOD_RCTRL ||
modifier & FBTK_MOD_LCTRL) {
float scale = browser_window_get_scale(gw->bw);
scale -= 0.1;
if (scale < 0.1) {
scale = 0.1;
}
if (scale > 0.95 && scale < 1.05) {
scale = 1;
}
browser_window_set_scale(gw->bw, scale, true);
}
break;
case NSFB_KEY_EQUALS: /* PLUS */
if (modifier & FBTK_MOD_RCTRL ||
modifier & FBTK_MOD_LCTRL) {
float scale = browser_window_get_scale(gw->bw);
scale += 0.1;
if (scale > 0.95 && scale < 1.05) {
scale = 1;
}
browser_window_set_scale(gw->bw, scale, true);
}
break;
case NSFB_KEY_0: /* PLUS */
if (modifier & FBTK_MOD_RCTRL ||
modifier & FBTK_MOD_LCTRL) {
browser_window_set_scale(gw->bw, 1, true);
}
break;
case NSFB_KEY_RSHIFT:
modifier |= FBTK_MOD_RSHIFT;
break;