Skip to content

Commit ec84e63

Browse files
loading animation
1 parent b3a8b98 commit ec84e63

File tree

5 files changed

+88
-1
lines changed

5 files changed

+88
-1
lines changed

web/css/extras.css

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.spinner {
2+
position: absolute;
3+
left: 50%;
4+
top: 50%;
5+
display: inline-block;
6+
width: 0;
7+
height: 0;
8+
z-index: 1;
9+
10+
-webkit-animation: spin 1s linear infinite;
11+
-moz-animation: spin 1s linear infinite;
12+
-o-animation: spin 1s linear infinite;
13+
animation: spin 1s linear infinite;
14+
}
15+
16+
.spinner:after {
17+
content: "";
18+
position: absolute;
19+
left: -20px;
20+
top: -20px;
21+
width: 40px;
22+
height: 22px;
23+
border-radius: 20px 20px 0 0;
24+
background: black;
25+
z-index: 0;
26+
}
27+
28+
.spinner:before {
29+
content: "";
30+
position: absolute;
31+
left: -15px;
32+
top: -15px;
33+
width: 30px;
34+
height: 30px;
35+
border-radius: 15px;
36+
background: white;
37+
box-shadow: 0 0 5px white;
38+
z-index: 1;
39+
}
40+
41+
@-webkit-keyframes spin {
42+
100% {
43+
-webkit-transform: rotate(360deg);
44+
}
45+
}
46+
47+
@-moz-keyframes spin {
48+
100% {
49+
-moz-transform: rotate(360deg);
50+
}
51+
}
52+
53+
@-o-keyframes spin {
54+
100% {
55+
-o-transform: rotate(360deg);
56+
}
57+
}
58+
59+
@keyframes spin {
60+
100% {
61+
transform: rotate(360deg);
62+
}
63+
}

web/css/treeView.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#treeView {
2+
position: relative;
23
display: block;
34
font-size: 16px;
4-
margin: 5px;
5+
min-height: 100%;
56
}
67

78
.tv-package-name.minimized + .tv-package-content {

web/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>Caché UML explorer</title>
66
<link rel="stylesheet" href="css/interface.css"/>
77
<link rel="stylesheet" href="css/treeView.css"/>
8+
<link rel="stylesheet" href="css/extras.css"/>
89
<script type="text/javascript" src="js/Lib.js"></script>
910
<script type="text/javascript" src="js/CacheUMLExplorer.js"></script>
1011
<script type="text/javascript" src="js/ClassTree.js"></script>

web/js/CacheUMLExplorer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CacheUMLExplorer.prototype.init = function () {
1818

1919
var self = this;
2020

21+
this.classTree.showLoader();
2122
this.source.getClassTree(function (err, data) {
2223
if (!err) self.classTree.updateTree(data);
2324
});

web/js/ClassTree.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@
66
var ClassTree = function (treeViewContainer) {
77

88
this.container = treeViewContainer;
9+
this.loader = null;
10+
11+
};
12+
13+
ClassTree.prototype.showLoader = function () {
14+
15+
if (this.loader) return;
16+
17+
this.loader = document.createElement("div");
18+
this.loader.className = "spinner";
19+
this.container.appendChild(this.loader);
20+
21+
};
22+
23+
ClassTree.prototype.removeLoader = function () {
24+
25+
if (!this.loader) return;
26+
this.loader.parentNode.removeChild(this.loader);
27+
this.loader = null;
928

1029
};
1130

@@ -72,4 +91,6 @@ ClassTree.prototype.updateTree = function (treeObject) {
7291

7392
build(this.container, treeObject);
7493

94+
this.removeLoader();
95+
7596
};

0 commit comments

Comments
 (0)