Another fix for black screen in Chrome on init.

This commit is contained in:
kovacsv 2019-05-13 07:25:58 +02:00
parent 2dafac08c6
commit cb71983eff

View File

@ -69,6 +69,9 @@ ImporterApp.prototype.Init = function ()
var match = window.matchMedia ('(max-device-width : 600px)'); var match = window.matchMedia ('(max-device-width : 600px)');
this.isMobile = match.matches; this.isMobile = match.matches;
window.addEventListener ('resize', this.Resize.bind (this), false);
this.Resize ();
var canvasName = 'modelcanvas'; var canvasName = 'modelcanvas';
this.canvas = $('#' + canvasName); this.canvas = $('#' + canvasName);
this.RegisterCanvasClick (); this.RegisterCanvasClick ();
@ -81,9 +84,6 @@ ImporterApp.prototype.Init = function ()
var fileInput = document.getElementById ('file'); var fileInput = document.getElementById ('file');
fileInput.addEventListener ('change', this.FileSelected.bind (this), false); fileInput.addEventListener ('change', this.FileSelected.bind (this), false);
window.addEventListener ('resize', this.Resize.bind (this), false);
this.Resize ();
window.onhashchange = this.LoadFilesFromHash.bind (this); window.onhashchange = this.LoadFilesFromHash.bind (this);
var hasHashModel = this.LoadFilesFromHash (); var hasHashModel = this.LoadFilesFromHash ();
if (!hasHashModel && !this.isMobile) { if (!hasHashModel && !this.isMobile) {
@ -165,17 +165,12 @@ ImporterApp.prototype.Resize = function ()
var canvas = document.getElementById ('modelcanvas'); var canvas = document.getElementById ('modelcanvas');
var height = document.body.clientHeight - top.offsetHeight; var height = document.body.clientHeight - top.offsetHeight;
SetHeight (canvas, 0);
SetWidth (canvas, 0);
SetHeight (left, height); SetHeight (left, height);
SetHeight (canvas, height); SetHeight (canvas, height);
SetWidth (canvas, document.body.clientWidth - left.offsetWidth); SetWidth (canvas, document.body.clientWidth - left.offsetWidth);
this.introControl.Resize (); this.introControl.Resize ();
this.floatingDialog.Resize (); this.floatingDialog.Resize ();
this.viewer.Draw ();
}; };
ImporterApp.prototype.JsonLoaded = function (progressBar) ImporterApp.prototype.JsonLoaded = function (progressBar)