pointerleave logic