Hi,
As mentioned in following answer link : Trigger 'mouseMove' and 'click' event while drawing an annotation
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:
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.