aframe-babia-components 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-cyl.js +180 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +208 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +60 -73
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +203 -132
- package/components/visualizers/babia-bars.js +4 -35
- package/components/visualizers/babia-barsmap.js +2 -30
- package/components/visualizers/babia-boats.js +92 -100
- package/components/visualizers/babia-bubbles.js +9 -26
- package/components/visualizers/babia-cyls.js +197 -201
- package/components/visualizers/babia-cylsmap.js +171 -241
- package/components/visualizers/babia-doughnut.js +2 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +2 -30
- package/dist/aframe-babia-components.js +21678 -19529
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +10 -4
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +27 -0
- package/docs/APIs/QUERIERS.md +16 -0
- package/docs/RELEASE_NOTES.md +32 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -7,7 +7,7 @@ class Selectable {
|
|
|
7
7
|
* @param list {array} List of items to select from
|
|
8
8
|
* @param field {string} Field name used to select (present in all items)
|
|
9
9
|
*/
|
|
10
|
-
constructor(list, field) {
|
|
10
|
+
constructor(list, field, current, step, speed, state, direction) {
|
|
11
11
|
this.data = {};
|
|
12
12
|
for (let item of list) {
|
|
13
13
|
let selector = item[field];
|
|
@@ -19,8 +19,31 @@ class Selectable {
|
|
|
19
19
|
}
|
|
20
20
|
this.selectors = Object.keys(this.data).sort();
|
|
21
21
|
this.length = this.selectors.length;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (!step){
|
|
23
|
+
this.step = 1
|
|
24
|
+
} else {
|
|
25
|
+
this.step = step;
|
|
26
|
+
}
|
|
27
|
+
if (!speed){
|
|
28
|
+
this.speed = 1
|
|
29
|
+
} else {
|
|
30
|
+
this.speed = speed;
|
|
31
|
+
}
|
|
32
|
+
if (current == -2){
|
|
33
|
+
this.current = 0
|
|
34
|
+
} else {
|
|
35
|
+
this.current = current;
|
|
36
|
+
}
|
|
37
|
+
if (!state) {
|
|
38
|
+
this.state = 'play';
|
|
39
|
+
} else {
|
|
40
|
+
this.state = state;
|
|
41
|
+
}
|
|
42
|
+
if (!direction){
|
|
43
|
+
this.direction = 'forward'
|
|
44
|
+
} else {
|
|
45
|
+
this.direction = direction;
|
|
46
|
+
}
|
|
24
47
|
}
|
|
25
48
|
|
|
26
49
|
next() {
|
|
@@ -32,25 +55,38 @@ class Selectable {
|
|
|
32
55
|
} else {
|
|
33
56
|
this.current = this.length
|
|
34
57
|
}
|
|
35
|
-
console.log("next: ", this.data)
|
|
36
58
|
return(selected);
|
|
37
59
|
}
|
|
38
60
|
|
|
39
61
|
prev() {
|
|
40
62
|
let selected = this.data[this.selectors[this.current]];
|
|
41
|
-
if (this.current
|
|
63
|
+
if (this.current - this.step >= 0){
|
|
42
64
|
this.current -= this.step;
|
|
43
65
|
} else {
|
|
44
|
-
this.current =
|
|
66
|
+
this.current = -1
|
|
45
67
|
}
|
|
46
|
-
console.log("prev: ", this.data)
|
|
47
68
|
return(selected);
|
|
48
69
|
}
|
|
49
70
|
|
|
50
71
|
setValue(value) {
|
|
51
72
|
let selected = this.data[this.selectors[value]];
|
|
52
|
-
this.
|
|
53
|
-
|
|
73
|
+
if (this.direction != 'rewind'){
|
|
74
|
+
if (value > this.length) {
|
|
75
|
+
this.current = this.length
|
|
76
|
+
} else if (value < 1) {
|
|
77
|
+
this.current = 1
|
|
78
|
+
} else {
|
|
79
|
+
this.current = value + 1
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
if (value > this.length - 2) {
|
|
83
|
+
this.current = this.length - 2
|
|
84
|
+
} else if (value < -1) {
|
|
85
|
+
this.current = -1
|
|
86
|
+
} else {
|
|
87
|
+
this.current = value - 1
|
|
88
|
+
}
|
|
89
|
+
}
|
|
54
90
|
return(selected);
|
|
55
91
|
}
|
|
56
92
|
};
|
|
@@ -76,14 +112,20 @@ AFRAME.registerComponent('babia-selector', {
|
|
|
76
112
|
// Timeout for moving to the next selection
|
|
77
113
|
timeout: { type: 'number', default: 6000 },
|
|
78
114
|
// data, for debugging, highest priority
|
|
79
|
-
data: { type: 'string' }
|
|
115
|
+
data: { type: 'string' },
|
|
116
|
+
// Current value of timeline
|
|
117
|
+
current_value: { type: 'number', default: -2},
|
|
118
|
+
// Current speed
|
|
119
|
+
speed: { type: 'number', default: 0},
|
|
120
|
+
// Current step
|
|
121
|
+
step: { type: 'number', default: 0},
|
|
122
|
+
// Current direction
|
|
123
|
+
direction: { type: 'string', default: ''},
|
|
124
|
+
// Current state
|
|
125
|
+
state: { type: 'string', default: ''},
|
|
80
126
|
},
|
|
81
127
|
|
|
82
128
|
multiple: false,
|
|
83
|
-
|
|
84
|
-
isPaused: undefined,
|
|
85
|
-
toPresent: undefined,
|
|
86
|
-
speed: undefined,
|
|
87
129
|
interval: undefined,
|
|
88
130
|
|
|
89
131
|
/**
|
|
@@ -92,10 +134,6 @@ AFRAME.registerComponent('babia-selector', {
|
|
|
92
134
|
init: function () {
|
|
93
135
|
this.notiBuffer = new NotiBuffer();
|
|
94
136
|
this.navNotiBuffer = new NotiBuffer();
|
|
95
|
-
|
|
96
|
-
this.isPaused = false
|
|
97
|
-
this.toPresent = true
|
|
98
|
-
this.speed = 1
|
|
99
137
|
},
|
|
100
138
|
|
|
101
139
|
/**
|
|
@@ -129,31 +167,105 @@ AFRAME.registerComponent('babia-selector', {
|
|
|
129
167
|
}
|
|
130
168
|
|
|
131
169
|
// find controller
|
|
132
|
-
if (data.controller){
|
|
170
|
+
if (data.controller != oldData.controller){
|
|
133
171
|
this.selectorController = document.querySelector('#' + data.controller)
|
|
134
172
|
// Unregister for old navigator
|
|
135
173
|
if (this.navComponent) {
|
|
136
174
|
this.navComponent.notiBuffer.unregister(this.navNotiBufferId, this)
|
|
175
|
+
if (el.components.networked){
|
|
176
|
+
this.removeOldNavListener(this.navComponent.el)
|
|
177
|
+
}
|
|
137
178
|
};
|
|
138
179
|
// Register for the new one
|
|
139
180
|
this.navComponent = findNavComponent(data, el)
|
|
140
181
|
if (this.navComponent.notiBuffer){
|
|
141
182
|
this.navNotiBufferId = this.navComponent.notiBuffer.register(this.processEvent.bind(this), this)
|
|
142
183
|
}
|
|
184
|
+
if (el.components.networked){
|
|
185
|
+
this.addMultiuserMode(this.navComponent.el)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if ((data.direction) && (data.direction != oldData.direction)) {
|
|
190
|
+
if (data.direction != 'rewind') {
|
|
191
|
+
if (this.selectable.current != this.selectable.length){
|
|
192
|
+
this.selectable.current += 2
|
|
193
|
+
}
|
|
194
|
+
if (this.navNotiBuffer){
|
|
195
|
+
this.navNotiBuffer.set('forward')
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
if (this.selectable.current < 1){
|
|
199
|
+
this.selectable.current = 0
|
|
200
|
+
} else {
|
|
201
|
+
this.selectable.current -= 2
|
|
202
|
+
}
|
|
203
|
+
if (this.navNotiBuffer){
|
|
204
|
+
this.navNotiBuffer.set('rewind')
|
|
205
|
+
}
|
|
206
|
+
}
|
|
143
207
|
}
|
|
144
208
|
|
|
145
|
-
|
|
209
|
+
if (data.step && (data.step != this.selectable.step)) {
|
|
210
|
+
this.selectable.step = data.step
|
|
211
|
+
this.navNotiBuffer.set({type: 'step', value: data.step})
|
|
212
|
+
if (this.data.direction != 'rewind') {
|
|
213
|
+
if (this.selectable.current + data.step > this.selectable.length){
|
|
214
|
+
this.selectable.current = this.selectable.length
|
|
215
|
+
} else {
|
|
216
|
+
this.selectable.current += data.step - 1
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
if (this.selectable.current - data.step <= 0){
|
|
220
|
+
this.selectable.current = -1
|
|
221
|
+
} else {
|
|
222
|
+
this.selectable.current -= data.step + 1
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (data.speed && (data.speed != this.selectable.speed)){
|
|
227
|
+
this.selectable.speed = data.speed
|
|
228
|
+
let timeout = this.data.timeout / data.speed
|
|
229
|
+
this.navNotiBuffer.set({type: 'speed', value: data.speed})
|
|
230
|
+
let self = this
|
|
231
|
+
clearInterval(this.interval);
|
|
232
|
+
this.interval = window.setInterval(function () {
|
|
233
|
+
self.loop()
|
|
234
|
+
}, timeout);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Only in multiuser
|
|
238
|
+
if (el.components.networked){
|
|
239
|
+
// You are not the owner and you are not alone in the scene
|
|
240
|
+
if ((el.components.networked.data.owner != NAF.clientId) && (el.components.networked.data.owner != 'scene')){
|
|
241
|
+
if ((data.current_value != -2) && (data.current_value != oldData.current_value)) {
|
|
242
|
+
// Initialize with the proper value
|
|
243
|
+
if (data.direction != 'rewind'){
|
|
244
|
+
this.navNotiBuffer.set({type: 'position', value: data.current_value - 1, label: this.selectable.selectors[data.current_value - 1]})
|
|
245
|
+
this.setSelect(data.current_value - 1)
|
|
246
|
+
} else {
|
|
247
|
+
this.navNotiBuffer.set({type: 'position', value: data.current_value + 1, label: this.selectable.selectors[data.current_value + 1]})
|
|
248
|
+
this.setSelect(data.current_value + 1)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if ((data.state == 'pause') && (data.state != oldData.state)) {
|
|
252
|
+
this.navNotiBuffer.set('pause')
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
146
256
|
},
|
|
147
257
|
|
|
148
258
|
nextSelect: function() {
|
|
149
259
|
if (this.selectable.current > this.selectable.length - 1){
|
|
150
|
-
this.selectable.current = this.selectable.length
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
260
|
+
this.selectable.current = this.selectable.length
|
|
261
|
+
this.selectable.state = 'pause'
|
|
262
|
+
this.el.setAttribute('babia-selector','state', 'pause');
|
|
263
|
+
this.navNotiBuffer.set('pause')
|
|
153
264
|
} else {
|
|
154
265
|
this.newData = this.selectable.next();
|
|
266
|
+
this.el.setAttribute('babia-selector','current_value', this.selectable.current);
|
|
155
267
|
this.notiBuffer.set(this.newData);
|
|
156
|
-
this.navNotiBuffer.set(this.selectable.current)
|
|
268
|
+
this.navNotiBuffer.set({type: 'position', value: this.selectable.current, label: this.selectable.selectors[this.selectable.current-1]})
|
|
157
269
|
this.babiaMetadata = { id: this.selectable.current};
|
|
158
270
|
}
|
|
159
271
|
},
|
|
@@ -161,33 +273,38 @@ AFRAME.registerComponent('babia-selector', {
|
|
|
161
273
|
prevSelect: function() {
|
|
162
274
|
if (this.selectable.current >= 0){
|
|
163
275
|
this.newData = this.selectable.prev();
|
|
276
|
+
this.el.setAttribute('babia-selector','current_value', this.selectable.current);
|
|
164
277
|
this.notiBuffer.set(this.newData);
|
|
165
|
-
this.navNotiBuffer.set(this.selectable.current)
|
|
278
|
+
this.navNotiBuffer.set({type: 'position', value: this.selectable.current, label: this.selectable.selectors[this.selectable.current+1]})
|
|
166
279
|
this.babiaMetadata = { id: this.selectable.current };
|
|
167
280
|
} else {
|
|
168
|
-
this.selectable.current =
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
281
|
+
this.selectable.current = - 1
|
|
282
|
+
this.selectable.state = 'pause'
|
|
283
|
+
this.el.setAttribute('babia-selector','state', 'pause');
|
|
284
|
+
this.navNotiBuffer.set('pause')
|
|
171
285
|
}
|
|
172
286
|
},
|
|
173
287
|
|
|
174
288
|
setSelect: function(value) {
|
|
175
|
-
if (((value != this.selectable.current - 1) && this.
|
|
289
|
+
if (((value != this.selectable.current - 1) && (this.data.direction != 'rewind')) || ((value != this.selectable.current + 1) && (this.data.direction === 'rewind'))) {
|
|
290
|
+
let label;
|
|
176
291
|
this.newData = this.selectable.setValue(value);
|
|
177
|
-
if (this.
|
|
292
|
+
if (this.data.direction != 'rewind') {
|
|
178
293
|
this.babiaMetadata = { id: value++ };
|
|
294
|
+
label = this.selectable.selectors[value-1]
|
|
179
295
|
} else {
|
|
180
296
|
this.babiaMetadata = { id: value-- };
|
|
181
297
|
this.selectable.current -=2
|
|
298
|
+
label = this.selectable.selectors[value+1]
|
|
182
299
|
}
|
|
183
300
|
this.notiBuffer.set(this.newData);
|
|
184
|
-
this.navNotiBuffer.set(value);
|
|
301
|
+
this.navNotiBuffer.set({type: 'position', value: value, label: label});
|
|
185
302
|
}
|
|
186
303
|
},
|
|
187
304
|
|
|
188
305
|
loop: function() {
|
|
189
|
-
if (
|
|
190
|
-
if(this.
|
|
306
|
+
if (this.data.state != 'pause') {
|
|
307
|
+
if (this.data.direction != 'rewind') {
|
|
191
308
|
this.nextSelect();
|
|
192
309
|
} else {
|
|
193
310
|
this.prevSelect();
|
|
@@ -222,63 +339,123 @@ AFRAME.registerComponent('babia-selector', {
|
|
|
222
339
|
|
|
223
340
|
processData: function (_data) {
|
|
224
341
|
// Create a Selectable object, and set the updating interval
|
|
225
|
-
|
|
226
|
-
|
|
342
|
+
if (!this.selectable){
|
|
343
|
+
this.selectable = new Selectable(_data, this.data.select, this.data.current_value, this.data.step, this.data.speed);
|
|
344
|
+
}
|
|
345
|
+
this.navNotiBuffer.set({type: 'position', value: this.selectable.current, label: this.selectable.selectors[this.selectable.current-1]})
|
|
227
346
|
let self = this;
|
|
228
347
|
this.nextSelect();
|
|
229
348
|
this.interval = window.setInterval(function () {
|
|
230
349
|
self.loop()
|
|
231
|
-
}, self.data.timeout * self.speed);
|
|
350
|
+
}, self.data.timeout * self.selectable.speed);
|
|
232
351
|
},
|
|
233
352
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (
|
|
242
|
-
this.selectable.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
} else if (event.includes('babiaSetStep')) {
|
|
256
|
-
this.selectable.step = parseInt(event.substring(12), 10)
|
|
257
|
-
if (this.toPresent){
|
|
258
|
-
if (this.current + this.selectable.step > this.selectable.length){
|
|
259
|
-
this.current = this.selectable.length - 1
|
|
353
|
+
processEvent: function(event){
|
|
354
|
+
if(event.includes('pause')) {
|
|
355
|
+
this.selectable.state = 'pause'
|
|
356
|
+
this.el.setAttribute('babia-selector','state', 'pause');
|
|
357
|
+
} else if (event.includes('play')) {
|
|
358
|
+
this.selectable.state = 'play'
|
|
359
|
+
this.el.setAttribute('babia-selector','state', 'play');
|
|
360
|
+
} else if (event.includes('forward')) {
|
|
361
|
+
this.selectable.direction = 'forward'
|
|
362
|
+
this.el.setAttribute('babia-selector','direction', 'forward');
|
|
363
|
+
} else if (event.includes('rewind')) {
|
|
364
|
+
this.selectable.direction = 'rewind'
|
|
365
|
+
this.el.setAttribute('babia-selector','direction', 'rewind');
|
|
366
|
+
} else if (event.includes('babiaSetPosition')) {
|
|
367
|
+
this.selectable.state = 'pause'
|
|
368
|
+
let value = parseInt(event.substring(16), 10)
|
|
369
|
+
if (this.data.direction != 'rewind') {
|
|
370
|
+
this.el.setAttribute('babia-selector',{
|
|
371
|
+
'state': 'pause',
|
|
372
|
+
'current_value': value + 1
|
|
373
|
+
});
|
|
260
374
|
} else {
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.current = 0
|
|
266
|
-
} else {
|
|
267
|
-
this.current -= this.selectable.step + 1
|
|
375
|
+
this.el.setAttribute('babia-selector',{
|
|
376
|
+
'state': 'pause',
|
|
377
|
+
'current_value': value - 1
|
|
378
|
+
});
|
|
268
379
|
}
|
|
269
380
|
|
|
381
|
+
this.setSelect(value)
|
|
382
|
+
this.navNotiBuffer.set('pause')
|
|
383
|
+
} else if (event.includes('babiaSetStep')) {
|
|
384
|
+
this.el.setAttribute('babia-selector', 'step', parseInt(event.substring(12), 10))
|
|
385
|
+
} else if (event.includes('babiaSetSpeed')) {
|
|
386
|
+
this.el.setAttribute('babia-selector', 'speed', parseInt(event.substring(13), 10))
|
|
270
387
|
}
|
|
271
|
-
|
|
388
|
+
},
|
|
272
389
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
390
|
+
removeOldNavListener: function(nav){
|
|
391
|
+
nav.removeEventListener('click', function () {
|
|
392
|
+
if (!NAF.utils.isMine(selector) && selector.components.networked.data.owner != 'scene'){
|
|
393
|
+
if (Object.keys(NAF.connection.connectedClients).length > 0){
|
|
394
|
+
NAF.utils.takeOwnership(selector)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
addMultiuserMode: function(nav){
|
|
401
|
+
let selector = this.el
|
|
402
|
+
document.body.addEventListener('clientConnected', function (event) {
|
|
403
|
+
let clientId = event.detail.clientId;
|
|
404
|
+
console.log('clientConnected event. clientId =', clientId);
|
|
405
|
+
console.log("Selector owner: ", selector.components.networked.data.owner);
|
|
406
|
+
let imFirst = true
|
|
407
|
+
if (selector.components.networked.data.owner == 'scene'){
|
|
408
|
+
for (let client in NAF.connection.getConnectedClients()){
|
|
409
|
+
let otherTime = NAF.connection.getConnectedClients()[client].roomJoinTime
|
|
410
|
+
let myTime = NAF.connection.adapter._myRoomJoinTime
|
|
411
|
+
console.log("Other: ", otherTime)
|
|
412
|
+
console.log("Mine: ", myTime)
|
|
413
|
+
if (myTime > otherTime){
|
|
414
|
+
imFirst = false;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (imFirst) {
|
|
418
|
+
NAF.utils.takeOwnership(selector)
|
|
419
|
+
} else {
|
|
420
|
+
console.log("I'm not first")
|
|
421
|
+
makeInvisible()
|
|
422
|
+
}
|
|
423
|
+
} else if (selector.components.networked.data.owner != NAF.clientId){
|
|
424
|
+
makeInvisible();
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
nav.addEventListener('click', function () {
|
|
429
|
+
if (!NAF.utils.isMine(selector) && selector.components.networked.data.owner != 'scene'){
|
|
430
|
+
if (Object.keys(NAF.connection.connectedClients).length > 0){
|
|
431
|
+
NAF.utils.takeOwnership(selector)
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
selector.addEventListener('ownership-gained', e => {
|
|
437
|
+
console.log("Selector ownership gained");
|
|
438
|
+
makeVisible();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
selector.addEventListener('ownership-lost', e => {
|
|
443
|
+
console.log("Selector ownership lost");
|
|
444
|
+
makeInvisible();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
function makeInvisible(){
|
|
448
|
+
nav.children[1].setAttribute('visible', false)
|
|
449
|
+
nav.children[2].setAttribute('visible', false)
|
|
450
|
+
nav.children[3].setAttribute('visible', false)
|
|
281
451
|
}
|
|
282
|
-
|
|
452
|
+
|
|
453
|
+
function makeVisible(){
|
|
454
|
+
nav.children[1].setAttribute('visible', true)
|
|
455
|
+
nav.children[2].setAttribute('visible', true)
|
|
456
|
+
nav.children[3].setAttribute('visible', true)
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
283
460
|
});
|
|
284
461
|
|
|
@@ -88,11 +88,10 @@ AFRAME.registerComponent('babia-treebuilder', {
|
|
|
88
88
|
let newPart = {}
|
|
89
89
|
if (j === path.length - 1) {
|
|
90
90
|
newPart = paths[i]
|
|
91
|
-
newPart['uid'] = part
|
|
92
91
|
} else {
|
|
93
92
|
newPart['children'] = []
|
|
94
|
-
newPart['uid'] = paths[i][data.field].split(part)[0] + part
|
|
95
93
|
}
|
|
94
|
+
newPart['uid'] = paths[i][data.field].split(part)[0] + part
|
|
96
95
|
newPart['name'] = part
|
|
97
96
|
currentLevel.push(newPart);
|
|
98
97
|
currentLevel = newPart.children;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
const colors = require('../others/common').colors;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* BabiaXR Cyl component
|
|
5
|
+
*
|
|
6
|
+
* Builds a cylinder (usually for the cyls chart)
|
|
7
|
+
*/
|
|
8
|
+
AFRAME.registerComponent('babia-cyl', {
|
|
9
|
+
schema: {
|
|
10
|
+
// Height of the cylinder
|
|
11
|
+
height: { type: 'number' },
|
|
12
|
+
// Width of the cylinder
|
|
13
|
+
radius: { type: 'number' },
|
|
14
|
+
// Color for axis and labels
|
|
15
|
+
color: { type: 'color', default: '#000' },
|
|
16
|
+
// Should this be animated
|
|
17
|
+
animation: { type: 'boolean', default: true},
|
|
18
|
+
// Duration of animations
|
|
19
|
+
dur: { type: 'number', default: 2000},
|
|
20
|
+
// Label for the cylinder ('', 'fixed', 'events')
|
|
21
|
+
label: { type: 'string', default: ''},
|
|
22
|
+
// Label text (valid if label is not empty)
|
|
23
|
+
labelText: { type: 'string', default: ''}
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
init: function() {
|
|
27
|
+
console.log("Starting cyl:", this.data.height, this.data.color);
|
|
28
|
+
let data = this.data;
|
|
29
|
+
this.cylinder = document.createElement('a-entity');
|
|
30
|
+
this.cylinder.classList.add("babiaxraycasterclass");
|
|
31
|
+
this.el.appendChild(this.cylinder);
|
|
32
|
+
let props = {}
|
|
33
|
+
if (data.animation) {
|
|
34
|
+
props = {'height': 0, 'radius': data.radius};
|
|
35
|
+
} else {
|
|
36
|
+
props = {'height': data.height,
|
|
37
|
+
'radius': data.radius};
|
|
38
|
+
}
|
|
39
|
+
this.cylinder.setAttribute('geometry', {
|
|
40
|
+
'primitive': 'cylinder',
|
|
41
|
+
'height': props.height,
|
|
42
|
+
'radius': props.radius
|
|
43
|
+
});
|
|
44
|
+
this.cylinder.setAttribute('material', {
|
|
45
|
+
'color': data.color
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
update: function (oldData) {
|
|
50
|
+
let data = this.data;
|
|
51
|
+
let cylinder = this.cylinder;
|
|
52
|
+
|
|
53
|
+
this.updateProperty(cylinder, 'geometry', 'height', data.animation,
|
|
54
|
+
data['height'], oldData.height);
|
|
55
|
+
// Update height
|
|
56
|
+
if (data.height != oldData.height) {
|
|
57
|
+
// If there is change in height, update position
|
|
58
|
+
if (data.animation) {
|
|
59
|
+
cylinder.setAttribute('animation__pos', {
|
|
60
|
+
'property': 'position',
|
|
61
|
+
'to': { x: 0, y: data.height/2, z:0 },
|
|
62
|
+
'dur': data.dur
|
|
63
|
+
});
|
|
64
|
+
if (data.height <= 0 && oldData.height > 0){
|
|
65
|
+
cylinder.setAttribute('animation__opacity', {
|
|
66
|
+
'property': 'material.opacity',
|
|
67
|
+
'to': 0,
|
|
68
|
+
'dur': data.dur
|
|
69
|
+
});
|
|
70
|
+
} else if (oldData.height <= 0 && data.height > 0){
|
|
71
|
+
cylinder.setAttribute('animation__opacity', {
|
|
72
|
+
'property': 'material.opacity',
|
|
73
|
+
'to': 100,
|
|
74
|
+
'dur': data.dur
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
cylinder.setAttribute('position', { x: 0, y: data.height/2, z: 0 });
|
|
79
|
+
if (data.height <= 0 && oldData.height > 0){
|
|
80
|
+
cylinder.setAttribute('material', 'opacity', 0);
|
|
81
|
+
} else if (oldData.height <= 0 && data.height > 0){
|
|
82
|
+
cylinder.setAttribute('material', 'opacity', 100);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
this.updateProperty(cylinder, 'geometry', 'radius', data.animation,
|
|
87
|
+
data.radius, oldData.radius);
|
|
88
|
+
this.updateProperty(cylinder, 'material', 'color', data.animation,
|
|
89
|
+
data.color, oldData.color);
|
|
90
|
+
if (this.data.label === 'events') {
|
|
91
|
+
cylinder.addEventListener('mouseenter', this.showLabel.bind(this));
|
|
92
|
+
cylinder.addEventListener('mouseleave', this.hideLabel.bind(this));
|
|
93
|
+
} else if (this.data.label === 'fixed') {
|
|
94
|
+
this.showLabel(oldData);
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* Update a property in an element, having animation into account
|
|
100
|
+
*
|
|
101
|
+
* @param el Element
|
|
102
|
+
* @param component Component in which to update property
|
|
103
|
+
* @param property Property to update in element
|
|
104
|
+
* @param name: Property name in data, oldData
|
|
105
|
+
* @param oldValue: Old value
|
|
106
|
+
*/
|
|
107
|
+
updateProperty: function (el, component, property, anim, newValue, oldValue) {
|
|
108
|
+
let data = this.data;
|
|
109
|
+
|
|
110
|
+
if (newValue !== oldValue) {
|
|
111
|
+
if (anim) {
|
|
112
|
+
let prop = component;
|
|
113
|
+
if (property) { prop = prop + '.' + property };
|
|
114
|
+
el.setAttribute('animation__'+component+'_'+property, {
|
|
115
|
+
'property': prop,
|
|
116
|
+
'to': newValue,
|
|
117
|
+
'dur': data.dur
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
if (property) {
|
|
121
|
+
el.setAttribute(component, { [property]: newValue });
|
|
122
|
+
} else {
|
|
123
|
+
el.setAttribute(component, newValue);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
showLabel: function (oldData) {
|
|
130
|
+
let data = this.data;
|
|
131
|
+
|
|
132
|
+
if (data.label === 'events') {
|
|
133
|
+
this.el.setAttribute('scale', { x: 1.1, y: 1.1, z: 1.1 });
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
text = data.labelText;
|
|
137
|
+
let width = 2;
|
|
138
|
+
if (text.length > 16) { width = text.length / 8 };
|
|
139
|
+
let height = 1;
|
|
140
|
+
oldHeight = oldData.height || 0;
|
|
141
|
+
let oldPosition = {
|
|
142
|
+
x: 0, y: oldHeight + 0.6 * height,
|
|
143
|
+
z: 0
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!this.labelEl) {
|
|
147
|
+
this.labelEl = document.createElement('a-entity');
|
|
148
|
+
this.labelEl.setAttribute('babia-label', {
|
|
149
|
+
'width': width, 'textWidth': 6
|
|
150
|
+
});
|
|
151
|
+
if (data.animation && (data.label === 'fixed')) {
|
|
152
|
+
this.labelEl.setAttribute('position', oldPosition);
|
|
153
|
+
};
|
|
154
|
+
this.el.appendChild(this.labelEl);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
let position = {
|
|
158
|
+
x: 0, y: data.height + 0.7 * height,
|
|
159
|
+
z: 0.7 * data.radius
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
let anim = data.animation && (data.label === 'fixed');
|
|
163
|
+
this.updateProperty(this.labelEl, 'position', '', anim, position, oldPosition);
|
|
164
|
+
this.labelEl.setAttribute('rotation', {x: 0, y: 0, z: 0});
|
|
165
|
+
if (text != oldData.labelText) {
|
|
166
|
+
this.labelEl.setAttribute('babia-label', { 'text': data.labelText });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
hideLabel: function () {
|
|
172
|
+
if (this.data.label === 'events') {
|
|
173
|
+
this.el.setAttribute('scale', { x: 1, y: 1, z: 1 });
|
|
174
|
+
};
|
|
175
|
+
if (this.labelEl) {
|
|
176
|
+
this.el.removeChild(this.labelEl);
|
|
177
|
+
this.labelEl = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
Binary file
|