Hi all. I hope someone can help me out. In my Scenes “create()” I add a DOMElement and try to put it in the center of game Scene. This is my code:
this.add.dom(this.cameras.main.width / 2, this.cameras.main.height / 2).createFromCache("nameform");
When loading the page intially, the wrapping div is mispositioned and cut off. However after refreshing the page(F5), the div is positioned in the center as intended.
I compared the mispositoined and correctly positioned div in the browsers DOM-inspector. The only difference I could find was:
mispositioned:
transform: matrix(1, 0, 0, 1, 392.5, 326);
positioned correctly:
transform: matrix(1, 0, 0, 1, 307.5, 123);
The wrapping div and its styles are generated by Phaser. Does anyone know how to fix this?
Kind regards, Chris.