Skip to content

Commit

Permalink
Merge pull request #85 from elraccoone/feature/optional-unity-loader
Browse files Browse the repository at this point in the history
Feature/optional unity loader
  • Loading branch information
Jeffrey Lanters authored Jan 20, 2020
2 parents b6790c3 + 82d0de5 commit 7174b9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-unity-webgl",
"version": "7.1.9",
"version": "7.1.10",
"description": "React Unity WebGL provides an easy solution for embedding Unity WebGL builds in your React application, with two-way communication between your React and Unity application with advanced API's.",
"main": "./distribution/Exports.js",
"scripts": {
Expand Down
14 changes: 6 additions & 8 deletions source/components/Unity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,14 @@ export default class Unity extends React.Component<IUnityProps, IUnityState> {
* @private
*/
private adjustCanvasToContainer(): void {
const _width = this.htmlElement!.offsetWidth;
const _height = this.htmlElement!.offsetHeight;
const _canvas = this.htmlElement!.getElementsByTagName("canvas")[0];
if (_canvas != null) {
if (_canvas.height !== _height) {
if (typeof this.htmlElement !== "undefined") {
const _width = this.htmlElement.offsetWidth;
const _height = this.htmlElement.offsetHeight;
const _canvas = this.htmlElement.getElementsByTagName("canvas")[0];
if (typeof _canvas !== "undefined" && _canvas.height !== _height)
_canvas.height = _height;
}
if (_canvas.width !== _width) {
if (typeof _canvas !== "undefined" && _canvas.width !== _width)
_canvas.width = _width;
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions source/declarations/UnityVersion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
export type UnityVersion =
| "undefined"
| "2019.2.18"
| "2019.2.17"
| "2019.2.16"
| "2019.2.15"
| "2019.2.14"
| "2019.2.13"
| "2019.2.12"
| "2019.2.11"
| "2019.2.10"
| "2019.2.9"
Expand Down

0 comments on commit 7174b9e

Please sign in to comment.