# Value's not getting proper during co-ordinates calculation

**URL:** <https://pdfjs.community/t/values-not-getting-proper-during-co-ordinates-calculation/107>\
**Category:** Technical Support\
**Created:** [July 2, 2020, 10:44am UTC](https://pdfjs.community/t/values-not-getting-proper-during-co-ordinates-calculation/107 "2020-07-02T10:44:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![vivek.sonawane](https://avatars.discourse-cdn.com/v4/letter/v/e95f7d/32.png) [@vivek.sonawane](https://pdfjs.community/u/vivek.sonawane)\
**Post date:** [July 2, 2020, 10:44am UTC](https://pdfjs.community/t/values-not-getting-proper-during-co-ordinates-calculation/107/1 "2020-07-02T10:44:46Z")

</div>

Hi,  
As mentioned in following answer link : [Trigger 'mouseMove' and 'click' event while drawing an annotation](https://pdfjs.community/t/trigger-mousemove-and-click-event-while-drawing-an-annotation/93)

I have retrieved x,y co-ordinates from “mouseMove” event and also calculated distance between 2 points as per Pythagoras theorem i.e sqrt(a2+b2) .But i am not able to get desired value for annotation.

value doesn’t match from popup measurement overlay(right bottom corner) and got from code provided below.  
code:

```javascript
this.viewerInstance.docViewer.on('click', evt => {
        let tool = instance.docViewer.getToolMode();
        instance.docViewer.on('click', evt => {
          if (this.annotation === 'AnnotationCreatePerimeterMeasurement'
            || this.annotation === 'AnnotationCreateAreaMeasurement') {
            let annot = tool.annotation;
            if (annot) {
              if(annot.getPath().length >= 2) {
                let point_one = (( annot.getPath()[1].x - annot.getPath()[0].x) * ( annot.getPath()[1].x - annot.getPath()[0].x));
                let point_two = (( annot.getPath()[1].y - annot.getPath()[0].y) * ( annot.getPath()[1].y - annot.getPath()[0].y));
                let newstr:any = Math.sqrt(point_one + point_two);
                let final:number = parseFloat(newstr) ;
                console.log(final); // <== this console prints value
              }
            }
          }
        });
      });

```

Also another question is, if we set scale for any page ,then by calling getPath(), do we get co-ordinates with respect to newly set scale or default scale? if its default scale co-ordinates then how can i get proper value for specific annotation of specific scale.

could anyone please provide comments on this.

---

_[View the full topic](https://pdfjs.community/t/values-not-getting-proper-during-co-ordinates-calculation/107)._
