How to stop at fixed point

Untitled

I want to 3 click mouse then stop at this point.But I only stop drawing when click one point on arrow. Thank you!

My code here:
manager.addListener(‘drawnext’, (data) => {
console.log(‘drawnext’, data);

  if (this.countPoint > 2) {
    console.log('drawend')
  }

);

To finish drawing, Click the last point once more.

I want finish by the determined point.

If you want to stop the line drawing, click the last point again or double-click on the end point.
Please refer to the description in the tooltip in the example.
http://apis.map.kakao.com/web/sample/basicDrawingLibrary/