Skip to content

Commit 2b7e94d

Browse files
author
vagrant
committed
update
1 parent 3c6ca2b commit 2b7e94d

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

source/_static/js/viz.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ $(document).ready(function() {
155155
return M;
156156
}
157157

158-
function start() {
158+
function start(callback) {
159159
const container = document.getElementById('viz-canvas');
160160

161161
var renderer = new THREE.WebGLRenderer();
@@ -199,8 +199,12 @@ $(document).ready(function() {
199199

200200
const sMeshes = getSMeshes(font, matLite, width);
201201
sMeshes.forEach(m => scene.add(m));
202-
202+
203203
console.log('done');
204+
if (callback) {
205+
callback();
206+
}
207+
204208
});
205209

206210
function animate() {
@@ -219,7 +223,21 @@ $(document).ready(function() {
219223

220224
const canvas = $('#viz-canvas');
221225
if (canvas.length > 0) {
222-
console.log('starting viz now');
223-
start();
226+
const btn = $('#viz-btn');
227+
const msg = $('#viz-msg');
228+
229+
btn.click(() => {
230+
console.log('starting viz now');
231+
msg.css('visibility', 'visible');
232+
233+
start(() => {
234+
console.log('callback');
235+
btn.toggle();
236+
msg.toggle();
237+
});
238+
});
224239
}
240+
241+
242+
225243
});

source/viz.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Visualization
22
=============
33

4-
Here's a 3D visualization of the CVT space. Hold the ``shift`` key while pressing the ``left`` mouse key to pan. Use the mouse ``scroll wheel`` to zoom in and out. It takes a while to render this page, please be patient.
4+
Here's a 3D visualization of the CVT space. Hold the ``shift`` key while pressing the ``left`` mouse key to pan. Use the mouse ``scroll wheel`` to zoom in and out. It takes a while to render this page, please be patient. To start loading the visualization, press the ``Load`` button.dfsd
55

66
.. raw:: html
77

8-
<div id="viz-canvas">
9-
</div>
8+
<div>
9+
<button id="viz-btn">Load</button>
10+
<span id="viz-msg" style="color:red;visibility:hidden;">loading...</span>
11+
</div>
12+
13+
<div id="viz-canvas"></div>

0 commit comments

Comments
 (0)