Implements primTouching for edges and the mouse