Reset progress dialog to the original one.

This commit is contained in:
kovacsv 2022-07-10 19:02:29 +02:00
parent 36957d3fbe
commit 1b82ef4320
4 changed files with 4 additions and 60 deletions

View File

@ -1,5 +1,4 @@
import { AddDiv, CreateDiv } from '../engine/viewer/domutils.js';
import { FeatureSet } from './featureset.js';
import { AddSvgIconElement, CreateInlineColorCircle, IsHoverEnabled } from './utils.js';
let currentDialog = null;
@ -136,45 +135,22 @@ export class ProgressDialog extends Dialog
super ();
this.SetCloseable (false);
this.textDiv = null;
this.progressDiv = null;
}
Init (text)
{
let contentDiv = this.GetContentDiv ();
contentDiv.classList.add ('ov_progress');
let innerContentDiv = AddDiv (contentDiv, 'ov_progress_inner');
let imgDiv = AddDiv (innerContentDiv, 'ov_progress_img', '<svg><use href="assets/images/3dviewer_net_logo.svg#logo"></use></svg>');
if (!FeatureSet.DownloadProgress) {
imgDiv.classList.add ('animated');
}
this.textDiv = AddDiv (innerContentDiv, 'ov_progress_text');
AddDiv (contentDiv, 'ov_progress_img', '<svg><use href="assets/images/3dviewer_net_logo.svg#logo"></use></svg>');
this.textDiv = AddDiv (contentDiv, 'ov_progress_text');
this.SetText (text);
this.progressDiv = AddDiv (contentDiv, 'ov_progress_bar');
}
SetText (text)
{
this.textDiv.innerHTML = text;
}
ResetProgress ()
{
this.progressDiv.style.width = '0px';
}
SetProgress (ratio)
{
let progressWidth = 0;
if (ratio !== null) {
let contentDiv = this.GetContentDiv ();
let fullWidth = contentDiv.offsetWidth;
progressWidth = ratio * fullWidth;
}
this.progressDiv.style.width = progressWidth.toString () + 'px';
}
}
export class ButtonDialog extends Dialog

View File

@ -1,4 +1,4 @@
export const FeatureSet =
{
DownloadProgress : true
};

View File

@ -4,7 +4,6 @@ import { ShowMessageDialog } from './dialogs.js';
import { ButtonDialog, ProgressDialog } from './dialog.js';
import { AddSvgIconElement } from './utils.js';
import { ImportErrorCode } from '../engine/import/importer.js';
import { FeatureSet } from './featureset.js';
export class ThreeModelLoaderUI
{
@ -30,24 +29,10 @@ export class ThreeModelLoaderUI
progressDialog.Open ();
},
onFileListProgress : (current, total) => {
progressDialog.SetProgress (null);
if (FeatureSet.DownloadProgress) {
if (total > 1) {
progressDialog.SetText ('Loading File ' + (current + 1).toString () + '/' + total.toString ());
}
}
},
onFileLoadProgress : (current, total) => {
if (FeatureSet.DownloadProgress) {
if (total > 0) {
progressDialog.SetProgress (current / total);
} else {
progressDialog.SetProgress (null);
}
}
},
onSelectMainFile : (fileNames, selectFile) => {
progressDialog.SetProgress (null);
progressDialog.Close ();
this.modalDialog = this.ShowFileSelectorDialog (fileNames, (index) => {
progressDialog.Open ();
@ -55,11 +40,9 @@ export class ThreeModelLoaderUI
});
},
onImportStart : () => {
progressDialog.SetProgress (null);
progressDialog.SetText ('Importing Model');
},
onVisualizationStart : () => {
progressDialog.SetProgress (null);
progressDialog.SetText ('Visualizing Model');
},
onModelFinished : (importResult, threeObject) => {

View File

@ -219,17 +219,13 @@ div.ov_progress
{
color: var(--ov_dialog_foreground_color);
background: var(--ov_dialog_background_color);
padding: 20px;
text-align: center;
width: 400px;
box-shadow: var(--ov_shadow);
border-radius: 5px;
}
div.ov_progress_inner
{
padding: 20px;
}
@keyframes ov_progress_img_kf {
0% {
transform: rotate(0deg);
@ -246,10 +242,6 @@ div.ov_progress div.ov_progress_img svg
margin-top: 5px;
margin-bottom: 15px;
display: inline-block;
}
div.ov_progress div.ov_progress_img.animated svg
{
animation: ov_progress_img_kf 5.0s linear infinite;
}
@ -259,13 +251,6 @@ div.ov_progress div.ov_progress_text
text-align: center;
}
div.ov_progress div.ov_progress_bar
{
background: var(--ov_button_color);
width: 0px;
height: 3px;
}
div.ov_snapshot_dialog_left
{
width: 190px;