Applications/Internet/Cyberia: Echo window mouse wheel events
Now, we can (kind of) scroll the page from anywhere in the viewport :^)
This commit is contained in:
parent
7878e28027
commit
61c287f446
1 changed files with 16 additions and 8 deletions
|
@ -20,6 +20,7 @@ TextInputWidget* addressbar1 = NULL;
|
|||
|
||||
I64 old_window_width = -1;
|
||||
I64 old_window_height = -1;
|
||||
I64 old_mouse_z = Mouse.z;
|
||||
|
||||
class @browser
|
||||
{
|
||||
|
@ -264,6 +265,14 @@ U0 @cyberia_new_tab()
|
|||
// cyberia->a("tabs")->append(new_tab);
|
||||
}
|
||||
|
||||
U0 @cyberia_vscroll_change(Widget*)
|
||||
{
|
||||
if (!browser || !browser->renderer)
|
||||
return;
|
||||
|
||||
@reflow_node_list(browser->renderer);
|
||||
}
|
||||
|
||||
U0 @cyberia_win_repaint(Window*)
|
||||
{
|
||||
if (!win || !addressbar1 || !background1 || !vscroll1 || !status1 || !statusbackdrop1)
|
||||
|
@ -280,6 +289,13 @@ U0 @cyberia_win_repaint(Window*)
|
|||
vscroll1->width = 16;
|
||||
vscroll1->height = background1->ctx->height;
|
||||
|
||||
I64 delta_z = Mouse.z - old_mouse_z;
|
||||
if (delta_z) {
|
||||
vscroll1->scroll += delta_z;
|
||||
@cyberia_vscroll_change(vscroll1);
|
||||
}
|
||||
old_mouse_z = Mouse.z;
|
||||
|
||||
if (StrLen(&status2->text)) {
|
||||
status1->y = win->height;
|
||||
status2->y = win->height - 40;
|
||||
|
@ -348,14 +364,6 @@ U0 @cyberia_win_mouseat(Window*)
|
|||
Free(resolved_href);
|
||||
}
|
||||
|
||||
U0 @cyberia_vscroll_change(Widget*)
|
||||
{
|
||||
if (!browser || !browser->renderer)
|
||||
return;
|
||||
|
||||
@reflow_node_list(browser->renderer);
|
||||
}
|
||||
|
||||
U0 @cyberia_init()
|
||||
{
|
||||
win = Compositor.CreateWindow(24, 24, 992, 768, WIN_FLAGS_DEFAULT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue