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 { AddDiv, CreateDiv } from '../engine/viewer/domutils.js';
import { FeatureSet } from './featureset.js';
import { AddSvgIconElement, CreateInlineColorCircle, IsHoverEnabled } from './utils.js'; import { AddSvgIconElement, CreateInlineColorCircle, IsHoverEnabled } from './utils.js';
let currentDialog = null; let currentDialog = null;
@ -136,45 +135,22 @@ export class ProgressDialog extends Dialog
super (); super ();
this.SetCloseable (false); this.SetCloseable (false);
this.textDiv = null; this.textDiv = null;
this.progressDiv = null;
} }
Init (text) Init (text)
{ {
let contentDiv = this.GetContentDiv (); let contentDiv = this.GetContentDiv ();
contentDiv.classList.add ('ov_progress'); 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>'); AddDiv (contentDiv, 'ov_progress_img', '<svg><use href="assets/images/3dviewer_net_logo.svg#logo"></use></svg>');
if (!FeatureSet.DownloadProgress) { this.textDiv = AddDiv (contentDiv, 'ov_progress_text');
imgDiv.classList.add ('animated');
}
this.textDiv = AddDiv (innerContentDiv, 'ov_progress_text');
this.SetText (text); this.SetText (text);
this.progressDiv = AddDiv (contentDiv, 'ov_progress_bar');
} }
SetText (text) SetText (text)
{ {
this.textDiv.innerHTML = 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 export class ButtonDialog extends Dialog

View File

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

View File

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

View File

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