Joystick and buttons as stated before
Alternatively don't have machines in those edges, just having rows or columns with no 'bridging' machines
For mobile, columns are much more effective, especially for machines like kegs where you can eat/enter the eating gui by not clicking properly