Skip to content

Commit

Permalink
ADD: Show warning if not all files are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
spillerrec committed Mar 19, 2014
1 parent c9247ef commit 14bbd69
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions lib/ldraw_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class LDrawWidget extends Progress{
container.style.position = 'relative';

bar = new Element.div();
bar.attributes['class'] = 'progress';
bar.style.backgroundColor = 'green';

bar_text = new Element.p();
Expand All @@ -51,9 +50,25 @@ class LDrawWidget extends Progress{
container.append( bar_text );
}

void centerElement( Element em ){
void showWarning( String message ){
Element warning = new Element.p();
warning.style.backgroundColor = 'yellow';
warning.style.textAlign = 'center';
warning.style.width = '100%';
warning.style.top = '0';
warning.style.position = 'absolute';
warning.style.lineHeight = '2em';

warning.appendText( message + " (Click to close)" );

warning.onClick.listen( (t){ warning.remove(); } );

container.append( warning );
}

void centerElement( Element em, [int top=45] ){
em.style.position = 'absolute';
em.style.top = '45%';
em.style.top = '$top%';
em.style.height = '10%';
}

Expand All @@ -70,9 +85,12 @@ class LDrawWidget extends Progress{
@override
void updated() {
update( current, total );
if( current >= total ){
if( current + failed >= total ){
canvas.load_ldraw( loader.file );
removeProgressBar();

if( failed > 0 )
showWarning( "$failed file(s) not loaded" );
}
}
}

0 comments on commit 14bbd69

Please sign in to comment.