When trying to extract the size of a GWT element with a specific CssClass using standard methods, I am faced with the issue that it returns 0;
Canvas canvas = Canvas.createIfSupported();
if(canvas == null){
/*alert code*/
}
Element e = canvas.getElement();
canvas.getElement().setClassName(canvasElement);
Context2d context = canvas.getContext2d();
int clientWidth = e.getClientWidth();
/*draw logic there*/
The value of clientWidth is 0.
Here is the defined CSS class:
.canvasElement{
position: absolute;
left:10px;
top:10px;
width:40px;
height:30px;
}
At what point in time will the element size be calculated? How can I capture that moment?