I'm trying to draw a rectangle on an image with React Konva, and get the coordinate of its 4 corners. I have calculated and return the coordinate of 4 corners quite accurately but the problem is I still couldn't implement the dragBoundFunc (to bound the rectangle in the canvas when dragging) and the boundBoxFunc (to bound the rectangle in the canvas when transform (rotate, scale)).
One solution I can think of is get the min and max X,Y coordinate of 4 corners, then if the min < 0 and the max > dimension of the canvas then return false. However I still have not managed to do it, you can checkout my sandbox here. Thanks for your help.