I am currently developing a meme-editor using React and incorporating KonvaJS to create a Canvas-like functionality. My challenge lies in centering the items within the canvas stage, as there seems to be a property overriding my styling attempts. Here is a snippet of the return statement in my React component:
<div className="mycanvas">
<Stage width={500} height={500} className="stage">
<Layer>
<Image image={image} className="meme" />
{textFields.map((text) => (
<Text
text={text}
draggable
fontFamily="Impact"
fontSize="30"
stroke="white"
/>
))}
</Layer>
</Stage>
</div>
And this is how the final output appears.
https://i.sstatic.net/XVHf1.png
To illustrate where the image should be centered, I have set the background of the wrapper to blue.
I have experimented with applying CSS to classes such as "mycanvas," "stage," and "meme," as well as "konvajs-content" (which appeared in my inspector). Despite trying properties like align-items: center and margin: auto, conventional CSS methods don't seem to work effectively in this scenario. It appears to be an issue related to the overall styling of KonvaJS components, but unfortunately, I haven't been able to find a solution on platforms like Stack Overflow or in the Konva documentation.