Prevent material selection cursor from going past its bounds