mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
not removing canvas from DOM anymore, fixes #63
This commit is contained in:
parent
9f0d173a82
commit
9ec3324c29
4 changed files with 9 additions and 14 deletions
|
|
@ -8,7 +8,7 @@ define([
|
||||||
function (Settings, Nc, Stats, Screenfull) {
|
function (Settings, Nc, Stats, Screenfull) {
|
||||||
|
|
||||||
function DomController() {
|
function DomController() {
|
||||||
this.canvas = null;
|
this.canvas = document.getElementById("canvas");
|
||||||
this.debugCanvas = null;
|
this.debugCanvas = null;
|
||||||
this.stats = null;
|
this.stats = null;
|
||||||
this.ping = null;
|
this.ping = null;
|
||||||
|
|
@ -116,15 +116,8 @@ function (Settings, Nc, Stats, Screenfull) {
|
||||||
return this.canvas;
|
return this.canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
DomController.prototype.setCanvas = function (canvas) {
|
DomController.prototype.initCanvas = function (canvas) {
|
||||||
|
Nc.trigger(Nc.ns.client.view.fullscreen.change, Screenfull.isFullscreen);
|
||||||
var container = this.getCanvasContainer();
|
|
||||||
if(this.canvas) {
|
|
||||||
container.removeChild(this.canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.canvas = canvas;
|
|
||||||
container.appendChild(canvas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DomController.prototype.getDebugCanvas = function () {
|
DomController.prototype.getDebugCanvas = function () {
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ function (DomController, Settings, Exception, Nc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractView.prototype.setCanvas = function (canvas) {
|
AbstractView.prototype.initCanvas = function (canvas) {
|
||||||
|
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
DomController.setCanvas(canvas);
|
DomController.initCanvas(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractView.prototype.loadPlayerMesh = function(player) {
|
AbstractView.prototype.loadPlayerMesh = function(player) {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ function (Parent, DomController, PIXI, Settings, Nc) {
|
||||||
this.initInfo();
|
this.initInfo();
|
||||||
this.initLoader();
|
this.initLoader();
|
||||||
|
|
||||||
this.setCanvas(this.renderer.view);
|
this.initCanvas(this.renderer.view);
|
||||||
}
|
}
|
||||||
|
|
||||||
PixiView.prototype.render = function () {
|
PixiView.prototype.render = function () {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,9 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="canvasContainer"></div>
|
<div id="canvasContainer">
|
||||||
|
<canvas id="canvas"></canvas>
|
||||||
|
</div>
|
||||||
<script data-main="client" src="require.js"></script>
|
<script data-main="client" src="require.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue