refactor the entity highlight code to make it work on tablet