Click an empty spot to spawn a magnet or select one. Controls for selected magnet Up/down arrows to change its size A/D to rotate F to flip the poles Space to pin or unpin it X to delete it Press R to reset
All code by me.