WebViewer Version: 8.1.0
Core.Math.Quad method “toRect()” not working as expected
Hello!
I’m having an issue when trying to convert a Quad into a Rect using the method “toRect()”. It seems to return a wrong Rect object, that seems to have only one Point (x1, y1 is equal to x2, y2) and it is a square (height and width have always the same value).
Steps to reproduce it:
annotation <-- this is a TextHighlightAnnotation
const rects = annotation.Quads.map(quad => {
// on a side note calling directly quad.toRect() doesn't work
const {x1, y1, x2, y2, x3, y3, x4, y4} = quad;
const realQuad = new Core.Math.Quad(x1, y1, x2, y2, x3, y3, x4, y4);
return realQuad.toRect();
});
When I try to print the “toRect” function it gives this result:
function function(){return new ba.a(this.x4,this.x4,this.x2,this.x2)}
but shoudn’t it be more like:
function function(){return new ba.a(this.x4,this.y4,this.x2,this.y2)}
?
For the moment I bypassed the issue by creating the Rect object directly.
Edit to add more context:
I’m not using the default viewer, I’m implementing a custom viewer.
Thank you!