move mouse detection to new ui class