Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't re-add a user-specified Canvas to DOM #3723
This PR fixes a bug.
While it was possible to pass an existing canvas element into the Game constructor, the AddToDom() method was moving the element onto document.body regardless of whether it already had a parent. This was causing my canvas to be repositioned unexpectedly, defeating the purpose of passing my own in (custom positioning of the canvas among other HTML elements).
Now, if GameConfig.parent is undefined but the canvas already has one, it won't be moved.