The motion could be converted into electrical pulses signifying direction and speed. The ball could detect movement in any direction thanks to interaction with two rollers that in turn spun wheels. plus a couple of two metal wheels that rolled around on the surface that the mouse was placed upon.
The first mouse was invented by Douglas Engelbart in 1964.It is difficult for a modern computer user to imagine a world without the mouse, such is the ubiquitous and usefulness of this device.