Remove test mode.
This commit is contained in:
parent
e30b5abae0
commit
f3fe89ee76
@ -21,7 +21,7 @@ ImporterApp = function ()
|
|||||||
this.extensions = [];
|
this.extensions = [];
|
||||||
this.importerButtons = null;
|
this.importerButtons = null;
|
||||||
this.extensionButtons = null;
|
this.extensionButtons = null;
|
||||||
this.dialog = null;
|
this.aboutDialog = null;
|
||||||
this.readyForTest = null;
|
this.readyForTest = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ ImporterApp.prototype.Init = function ()
|
|||||||
var myThis = this;
|
var myThis = this;
|
||||||
var top = document.getElementById ('top');
|
var top = document.getElementById ('top');
|
||||||
this.importerButtons = new ImporterButtons (top);
|
this.importerButtons = new ImporterButtons (top);
|
||||||
this.importerButtons.AddLogo ('Online 3D Viewer <span class="version">v 0.5.2</span>', function () { myThis.WelcomeDialog (); });
|
this.importerButtons.AddLogo ('Online 3D Viewer <span class="version">v 0.5.2</span>', function () { myThis.ShowAboutDialog (); });
|
||||||
this.importerButtons.AddButton ('images/openfile.png', 'Open File', function () { myThis.OpenFile (); });
|
this.importerButtons.AddButton ('images/openfile.png', 'Open File', function () { myThis.OpenFile (); });
|
||||||
this.importerButtons.AddButton ('images/fitinwindow.png', 'Fit In Window', function () { myThis.FitInWindow (); });
|
this.importerButtons.AddButton ('images/fitinwindow.png', 'Fit In Window', function () { myThis.FitInWindow (); });
|
||||||
this.importerButtons.AddToggleButton ('images/fixup.png', 'images/fixupgray.png', 'Enable/Disable Fixed Up Vector', function () { myThis.SetFixUp (); });
|
this.importerButtons.AddToggleButton ('images/fixup.png', 'images/fixupgray.png', 'Enable/Disable Fixed Up Vector', function () { myThis.SetFixUp (); });
|
||||||
@ -57,7 +57,7 @@ ImporterApp.prototype.Init = function ()
|
|||||||
this.importerButtons.AddButton ('images/right.png', 'Set Up Vector (-X)', function () { myThis.SetNamedView ('-x'); });
|
this.importerButtons.AddButton ('images/right.png', 'Set Up Vector (-X)', function () { myThis.SetNamedView ('-x'); });
|
||||||
|
|
||||||
this.extensionButtons = new ExtensionButtons (top);
|
this.extensionButtons = new ExtensionButtons (top);
|
||||||
this.dialog = new FloatingDialog ();
|
this.aboutDialog = new FloatingDialog ();
|
||||||
|
|
||||||
window.addEventListener ('resize', this.Resize.bind (this), false);
|
window.addEventListener ('resize', this.Resize.bind (this), false);
|
||||||
this.Resize ();
|
this.Resize ();
|
||||||
@ -71,14 +71,10 @@ 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);
|
||||||
|
|
||||||
var testMode = this.InitTestMode ();
|
window.onhashchange = this.LoadFilesFromHash.bind (this);
|
||||||
var hasHashModel = false;
|
var hasHashModel = this.LoadFilesFromHash ();
|
||||||
if (!testMode) {
|
|
||||||
window.onhashchange = this.LoadFilesFromHash.bind (this);
|
|
||||||
hasHashModel = this.LoadFilesFromHash ();
|
|
||||||
}
|
|
||||||
if (!hasHashModel) {
|
if (!hasHashModel) {
|
||||||
this.WelcomeDialog ();
|
this.ShowAboutDialog ();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,14 +101,14 @@ ImporterApp.prototype.AddExtension = function (extension)
|
|||||||
extension.Init (extInterface);
|
extension.Init (extInterface);
|
||||||
};
|
};
|
||||||
|
|
||||||
ImporterApp.prototype.WelcomeDialog = function ()
|
ImporterApp.prototype.ShowAboutDialog = function ()
|
||||||
{
|
{
|
||||||
var dialogText = [
|
var dialogText = [
|
||||||
'<div class="importerdialog">',
|
'<div class="importerdialog">',
|
||||||
this.GetWelcomeText (),
|
this.GetWelcomeText (),
|
||||||
'</div>',
|
'</div>',
|
||||||
].join ('');
|
].join ('');
|
||||||
this.dialog.Open ({
|
this.aboutDialog.Open ({
|
||||||
title : 'Welcome',
|
title : 'Welcome',
|
||||||
text : dialogText,
|
text : dialogText,
|
||||||
buttons : [
|
buttons : [
|
||||||
@ -165,7 +161,7 @@ ImporterApp.prototype.Resize = function ()
|
|||||||
SetHeight (canvas, height);
|
SetHeight (canvas, height);
|
||||||
SetWidth (canvas, document.body.clientWidth - left.offsetWidth);
|
SetWidth (canvas, document.body.clientWidth - left.offsetWidth);
|
||||||
|
|
||||||
this.dialog.Resize ();
|
this.aboutDialog.Resize ();
|
||||||
};
|
};
|
||||||
|
|
||||||
ImporterApp.prototype.JsonLoaded = function (progressBar)
|
ImporterApp.prototype.JsonLoaded = function (progressBar)
|
||||||
@ -329,7 +325,7 @@ ImporterApp.prototype.GenerateError = function (errorMessage)
|
|||||||
var menu = $('#menu');
|
var menu = $('#menu');
|
||||||
menu.empty ();
|
menu.empty ();
|
||||||
|
|
||||||
this.dialog.Open ({
|
this.aboutDialog.Open ({
|
||||||
title : 'Error',
|
title : 'Error',
|
||||||
text : '<div class="importerdialog">' + errorMessage + '</div>',
|
text : '<div class="importerdialog">' + errorMessage + '</div>',
|
||||||
buttons : [
|
buttons : [
|
||||||
@ -378,7 +374,7 @@ ImporterApp.prototype.Generate = function (progressBar)
|
|||||||
|
|
||||||
var myThis = this;
|
var myThis = this;
|
||||||
if (jsonData.meshes.length > 250) {
|
if (jsonData.meshes.length > 250) {
|
||||||
this.dialog.Open ({
|
this.aboutDialog.Open ({
|
||||||
title : 'Information',
|
title : 'Information',
|
||||||
text : '<div class="importerdialog">The model contains a large number of meshes. It can cause performance problems. Would you like to merge meshes?</div>',
|
text : '<div class="importerdialog">The model contains a large number of meshes. It can cause performance problems. Would you like to merge meshes?</div>',
|
||||||
buttons : [
|
buttons : [
|
||||||
@ -437,7 +433,7 @@ ImporterApp.prototype.ShowHideMesh = function (meshIndex)
|
|||||||
ImporterApp.prototype.ProcessFiles = function (fileList, isUrl)
|
ImporterApp.prototype.ProcessFiles = function (fileList, isUrl)
|
||||||
{
|
{
|
||||||
this.ClearReadyForTest ();
|
this.ClearReadyForTest ();
|
||||||
this.dialog.Close ();
|
this.aboutDialog.Close ();
|
||||||
if (this.inGenerate) {
|
if (this.inGenerate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -528,28 +524,6 @@ ImporterApp.prototype.LoadFilesFromHash = function ()
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ImporterApp.prototype.InitTestMode = function ()
|
|
||||||
{
|
|
||||||
if (window.location.hash != '#test') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentTestFile = 0;
|
|
||||||
var myThis = this;
|
|
||||||
JSM.LoadJsonFile ('testfiles_for_test/testfiles.json', function (jsonContent) {
|
|
||||||
window.addEventListener ('keydown', function (event) {
|
|
||||||
var keyCode = event.which;
|
|
||||||
if (keyCode == 84 && currentTestFile < jsonContent.files.length) {
|
|
||||||
event.preventDefault ();
|
|
||||||
myThis.dialog.Close ();
|
|
||||||
myThis.ProcessFiles (jsonContent.files[currentTestFile], true);
|
|
||||||
currentTestFile++;
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.onload = function ()
|
window.onload = function ()
|
||||||
{
|
{
|
||||||
var importerApp = new ImporterApp ();
|
var importerApp = new ImporterApp ();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user