File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ <h2>Optimize</h2>
129129 id ="optimize-topology-button-container "
130130 >
131131 < button class ="navbar-button " id ="optimize-topology-button ">
132- < i class ="bi-bounding-box-circles "> </ i >
132+ < i class ="bi-bounding-box-circles " id =" optimize-topology-icon " > </ i >
133133 < p > Topology</ p >
134134 </ button >
135135 </ div >
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {
3737import { isLocalStorageEnabled } from "../util/ioService.js" ;
3838import { getSimplifiedBlockValue } from "../model/elements/block.js" ;
3939import { displayTf } from "../util/prettyPrintingService.js" ;
40+ import { sleep } from "../util/commons.js" ;
4041
4142const navbar = document . getElementById ( "navbar" ) ;
4243
@@ -193,10 +194,16 @@ nextButton.addEventListener("click", function () {
193194const optimizeTopologyButton = document . getElementById (
194195 "optimize-topology-button"
195196) ;
197+ const optimizeTopologyIcon = document . getElementById ( "optimize-topology-icon" ) ;
196198
197199optimizeTopologyButton . addEventListener ( "click" , async function ( e ) {
198200 e . stopPropagation ( ) ;
201+ optimizeTopologyIcon . classList . remove ( "bi-bounding-box-circles" ) ;
202+ optimizeTopologyIcon . classList . add ( "loading-spinner" ) ;
203+ await sleep ( 0 ) ; //needed for rendering the updated CSS before the computation below
199204 await optimizeTopology ( ) ;
205+ optimizeTopologyIcon . classList . remove ( "loading-spinner" ) ;
206+ optimizeTopologyIcon . classList . add ( "bi-bounding-box-circles" ) ;
200207} ) ;
201208
202209//
Original file line number Diff line number Diff line change @@ -156,3 +156,23 @@ body,
156156 justify-content : center;
157157 align-items : center;
158158}
159+
160+ /* Loading spinner */
161+
162+ .loading-spinner {
163+ width : 14px ;
164+ height : 14px ;
165+ border : 1px solid var (--color-grey-200 );
166+ border-top-color : # 000 ;
167+ border-radius : 50% ;
168+ animation : rotate-loading-spinner 1s linear infinite;
169+ }
170+
171+ @keyframes rotate-loading-spinner {
172+ 0% {
173+ transform : rotate (0deg );
174+ }
175+ 100% {
176+ transform : rotate (360deg );
177+ }
178+ }
You can’t perform that action at this time.
0 commit comments