private void handleMouseScroll(object sender, MouseEventArgs e) { if (p_LogicDisabled) { return; } Point mousePosition = PointToClient(Cursor.Position); if (p_EventHijacker != null) { p_EventHijacker.OnMouseScroll(this, mousePosition, e); } //only scroll if no button is currently down if (p_Cursor.MouseButton != MouseButtons.None) { return; } //get the block where the mouse is currently at bool hasBlock; VisibleBlock block = p_MapRenderer.TryGetBlockAtPoint(p_Window.Context, mousePosition, out hasBlock); //adjust zoom int v = (e.Delta < 0 ? -1 : 1); p_Camera.Scale(v * 10); //move camera to the block where the mouse is. if (hasBlock) { p_Camera.MoveCenter(block.BlockX, block.BlockY); } }