forked from KleeGroup-BaseCamp/appviz-map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.js
33 lines (31 loc) · 787 Bytes
/
map.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
class Map {
constructor(state, config, notebook) {
this.layers = initLayers(); // For testing purposes only
// Use (state, config, notebook) to get layers
let level = 0;
for (let layer of this.layers) {
layer.level = level;
layer.initStyle();
level += 1;
}
}
render() {
background(3, 4, 94);
for (let layer of this.layers) {
layer.renderGrid(); // Drawing grid for testing purposes only
}
let level = 0;
for (let layer of this.layers) {
layer.level = level;
layer.render();
level += 1;
}
}
selectElement (x, y) {
for (let layer of this.layers.slice().reverse()) {
let element = layer.selectElement(x, y );
if (element != null) return element;
}
return null;
}
}