Currently, I am using KonvaJs version 3.2.4 to work with the toImage function of the Stage Class. It seems that by default, toImage() only captures an image of the visible stage area. This is why there is a need to provide starting coordinates, height, and width in the config property to specify the area to be included in the image.
My main objective is to generate an image of the stage that encompasses all child shapes within it (for purposes like printing cover images). Is there a simple way to determine the actual area of the Stage being utilized? I envision having an outer boundary of the used space. Currently, all my shapes are contained in one view layer, and before using toImage, I ungroup them so that there are no nested children arrays beneath the view layer.
I attempted to iterate through all the children and use their x/y attributes to calculate minX, maxX, minY, maxY values. However, this method encounters problems when a shape is rotated since the x/y coordinates may not accurately represent the inner/outer limits of the shape due to the rotation. Users have the ability to rotate shapes using the standard Transformer tool.
Any advice on how to achieve this would be greatly appreciated!