Zooming in on mouse

This commit is contained in:
Synthasmagoria 2026-08-30 18:51:09 +02:00
commit ef350183e2
2 changed files with 12 additions and 3 deletions

View file

@ -905,9 +905,9 @@ program_handle_mouse :: proc(mouse_state: MouseState, top_bar_container, matrix_
mouse_state = .DraggingGrid
break state_label
}
program.grid.zoom_previous = program.grid.zoom
grid_zoom_dimension_lock := v2{1.0 - f32(int(program.grid_zoom_y_only)), 1.0 - f32(int(program.grid_zoom_x_only))}
program.grid.zoom -= grid_zoom_dimension_lock * mouse_wheel.y * 0.2 * program.grid_zoom_speed
screen_size := v2(program_screen_size())
grid_zoom_in_on(&program.grid, {0, 0, screen_size.x, screen_size.y}, rl.GetMousePosition(), mouse_wheel.y * 0.1 * program.grid_zoom_speed)
case .DraggingDraggable:
if !rl.IsMouseButtonDown(.LEFT) {
mouse_state = .Hover