proper z sorting for click collisions