-
Notifications
You must be signed in to change notification settings - Fork 1
/
domekit_demo.js
49 lines (43 loc) · 1.45 KB
/
domekit_demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
goog.provide('domekit.Demo');
goog.require('goog.events');
goog.require('goog.ui.Slider');
/** @constructor */
domekit.Demo = function() {
var domeOpts = {
width: 600,
height: 350,
scaleMin: 0.7,
scaleMax: 1.0,
radiusMin: 1,
radiusMax: 500
};
var domekitController = new domekit.Controller(domeOpts);
var goesHere = document.getElementById('canvas-goes-here');
// begin drawing dome canvas component
domekitController.render(goesHere);
// scale slider
var radiusSlider = new goog.ui.Slider();
radiusSlider.render(
document.getElementById('radius-slider-goes-here')
);
radiusSlider.setMaximum(domeOpts.radiusMax);
radiusSlider.setMinimum(domeOpts.radiusMin);
radiusSlider.addEventListener(goog.ui.Component.EventType.CHANGE, function() {
var height = radiusSlider.getValue();
domekitController.setRadius(height);
goog.dom.setTextContent(document.getElementById('radius-slider-value'), '' + height)
});
//default
radiusSlider.setValue(6); // HUMAN SIZED
// dome mode button
var domeButton = goog.dom.getElement('choose-a-dome');
goog.events.listen(domeButton, goog.events.EventType.CLICK, function() {
domekitController.setDomeMode();
});
// sphere mode button
var sphereButton = goog.dom.getElement('choose-a-sphere');
goog.events.listen(sphereButton, goog.events.EventType.CLICK, function() {
domekitController.setSphereMode();
});
};
goog.exportSymbol('domekit.Demo', domekit.Demo);