Thank you for replying. I have tried using handleROI.setCorners(point1, point2) which does allow me to draw a quadrilateral but does not retain the shape of a rectangle. The first image is when the interactions is complete one edge is not visible and the next image is when i zoom in all the four edges are visible.
Thanks again for the suggestion. It pointed me in the right direction. I was calculating the (x,y ) value for point2 but overlooked the z value and used 0 instead which was causing that weird behavior. Using the z value same as point1 fixed it.
I am back with another question. I am setting a rectangle widget to the scene using setCorner() function. My question is if there is a way i can draw the rectangle widget with fixed corners without firing it inside handleROI.onInteractiveEvent().
type or paste code here
const handleROI = widgetManager.addWidget(widgetROI);
const point1 = handleROI.getPoint1();
// to convert world coordinates into display coordinates
const point1Display = handleROI.computeWorldToDisplay(renderer, point1, point1, point1)
const dx = Math.abs(point1Display + parseInt(roiDimensions.length));
const dy = Math.abs(point1Display + parseInt(roiDimensions.width));
console.log(' handleROI point2', dx, dy, 0);
const point2 = handleROI.computeDisplayToWorld(renderer, dx, dy, 0)
Right now the cursor needs to be inside the renderwindow for the widget to appear. My goal is to make the widget appear when user add the corners through a text box outside the renderwindow.