aframe-babia-components 1.2.0 → 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 +4 -5
- 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 +62 -37
- 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 +291 -279
- package/components/visualizers/babia-bubbles.js +9 -26
- package/components/visualizers/babia-city.js +19 -9
- 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 +6785 -5626
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -0
- package/docs/APIs/CHARTS.md +11 -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 +44 -23
- package/docs/Tutorials/multiuser.md +47 -2
- package/docs/Tutorials/temporal_evol_with_boats.md +4 -4
- 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/boats/boats_new_element/data1.json +18 -18
- package/examples/boats/boats_new_element/data2.json +19 -19
- package/examples/boats/boats_new_element/index.html +1 -1
- 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/easyrtc.js +11984 -0
- package/examples/multi_boats/index_multi_boats.html +223 -0
- package/examples/multi_boats/jetuml.html +256 -0
- package/examples/multi_boats/jetuml_code_data.json +1 -0
- 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 +255 -0
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml.html +74 -0
- package/examples/selector_boats/jetuml_evol_data.json +1 -0
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/selector_boats/jetumltest.html +80 -0
- package/examples/ui/link/index.html +12 -11
- 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 +73 -2
- package/index.js +12 -1
- package/package.json +6 -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 +10 -1
- package/webpack.devnossl.js +16 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/* global AFRAME */
|
|
2
|
+
if (typeof AFRAME === 'undefined') {
|
|
3
|
+
throw new Error('Component attempted to register before AFRAME was available.');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
AFRAME.registerComponent('babia-camera', {
|
|
8
|
+
schema: {
|
|
9
|
+
raycasterMouse: { type: 'string', default: '.babiaxraycasterclass'},
|
|
10
|
+
raycasterHand: {type: 'string', default: '.babiaxraycasterclass'},
|
|
11
|
+
tipsOpened: { type: 'boolean', default: true},
|
|
12
|
+
gripRLabel: {type: 'string', default: 'Open/Close \nTips'},
|
|
13
|
+
gripLLabel: {type: 'string', default: 'Stop Audio'},
|
|
14
|
+
triggerRLabel: {type: 'string', default: 'Click'},
|
|
15
|
+
triggerLLabel: {type: 'string', default: 'Teleport' },
|
|
16
|
+
teleportCollisions: {type: 'string', default: '.environmentGround'}
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set if component needs multiple instancing.
|
|
21
|
+
*/
|
|
22
|
+
multiple: false,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Initial creation and setting of the mesh.
|
|
26
|
+
*/
|
|
27
|
+
init: function () {},
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Called when component is attached and when component data changes.
|
|
31
|
+
* Generally modifies the entity based on the data.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
update: function (oldData) {
|
|
35
|
+
if(this.data != this.oldData){
|
|
36
|
+
// Add camera
|
|
37
|
+
this.el.setAttribute('camera', '');
|
|
38
|
+
// Add mouse
|
|
39
|
+
this.addCursor();
|
|
40
|
+
// OCULUS CASE
|
|
41
|
+
this.setOculusConnected();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
addCursor: function(){
|
|
46
|
+
this.cursor = document.createElement('a-entity');
|
|
47
|
+
this.cursor.id = 'cursor';
|
|
48
|
+
this.cursor.setAttribute('cursor', {rayOrigin: 'mouse'});
|
|
49
|
+
this.cursor.setAttribute('raycaster', {
|
|
50
|
+
objects: this.data.raycasterMouse,
|
|
51
|
+
})
|
|
52
|
+
this.el.parentElement.append(this.cursor);
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
createTip: function(id, config, position){
|
|
56
|
+
let entity = document.createElement('a-entity');
|
|
57
|
+
entity.id = id;
|
|
58
|
+
entity.classList.add('tips');
|
|
59
|
+
entity.setAttribute('tooltip', config);
|
|
60
|
+
entity.setAttribute('position', position);
|
|
61
|
+
return entity ;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
setOculusConnected: function(){
|
|
65
|
+
let self = this;
|
|
66
|
+
self.tooltips = [];
|
|
67
|
+
/**
|
|
68
|
+
* You need create and add controllers before listener otherwise
|
|
69
|
+
* it will not listen the event controllerconnected.
|
|
70
|
+
*/
|
|
71
|
+
self.leftHand = document.createElement('a-entity');
|
|
72
|
+
self.leftHand.id = 'babia-leftHand';
|
|
73
|
+
self.leftHand.setAttribute('oculus-touch-controls', {hand: 'left'});
|
|
74
|
+
self.el.parentElement.append(self.leftHand);
|
|
75
|
+
self.rightHand = document.createElement('a-entity');
|
|
76
|
+
self.rightHand.id = 'babia-rightHand';
|
|
77
|
+
self.rightHand.setAttribute('oculus-touch-controls', {hand: 'right'});
|
|
78
|
+
self.el.parentElement.append(self.rightHand);
|
|
79
|
+
|
|
80
|
+
document.addEventListener('controllerconnected', (event) => {
|
|
81
|
+
// Update height of the view
|
|
82
|
+
let parentPos = self.el.parentElement.object3D.position;
|
|
83
|
+
self.el.parentElement.setAttribute('position', {x: parentPos.x, y: 0, z: parentPos.z});
|
|
84
|
+
|
|
85
|
+
// Add hand controllers
|
|
86
|
+
/** LEFT HAND (with teleport) */
|
|
87
|
+
if(event.target.id === 'babia-leftHand'){
|
|
88
|
+
self.leftHand.setAttribute('teleport-controls', {
|
|
89
|
+
cameraRig: `#${self.el.parentElement.id}`,
|
|
90
|
+
teleportOrigin: `#${self.el.id}`,
|
|
91
|
+
collisionEntities: self.data.teleportCollisions,
|
|
92
|
+
hitCylinderColor: '#ff3468',
|
|
93
|
+
curveHitColor: '#ff3468',
|
|
94
|
+
curveMissColor: '#333333',
|
|
95
|
+
curveLineWidth: 0.01,
|
|
96
|
+
button: 'trigger'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/** TIP TRIGGER L */
|
|
100
|
+
tipTriggerLconfig = {
|
|
101
|
+
text: self.data.triggerLLabel,
|
|
102
|
+
width: 0.07,
|
|
103
|
+
height: 0.03,
|
|
104
|
+
targetPosition: '0.002 -0.02 -0.014',
|
|
105
|
+
lineHorizontalAlign: 'right',
|
|
106
|
+
rotation: '-90 0 0',
|
|
107
|
+
src: tooltip.default,
|
|
108
|
+
};
|
|
109
|
+
tipTriggerLpos = {x: -0.09, y: -0.04, z: -0.08};
|
|
110
|
+
self.tipTriggerL = this.createTip('babia-tooltip_trigger_L', tipTriggerLconfig, tipTriggerLpos);
|
|
111
|
+
self.leftHand.append(self.tipTriggerL);
|
|
112
|
+
self.tooltips.push(self.tipTriggerL);
|
|
113
|
+
/** TIP GRIP L */
|
|
114
|
+
tipGripLconfig = {
|
|
115
|
+
text: self.data.gripLLabel,
|
|
116
|
+
width: 0.08,
|
|
117
|
+
height: 0.04,
|
|
118
|
+
targetPosition: '0.006 -0.008 0.033',
|
|
119
|
+
rotation: '-90 0 0',
|
|
120
|
+
src: tooltip.default,
|
|
121
|
+
};
|
|
122
|
+
tipGripLpos = {x: 0.085, y: -0.01, z: 0.07};
|
|
123
|
+
self.tipGripL = this.createTip('babia-tooltip_grip_L', tipGripLconfig, tipGripLpos);
|
|
124
|
+
self.leftHand.append(self.tipGripL);
|
|
125
|
+
self.tooltips.push(self.tipGripL);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** RIGHT HAND (with laser raycaster) */
|
|
129
|
+
if(event.target.id === 'babia-rightHand'){
|
|
130
|
+
self.rightHand.setAttribute('laser-controls', {hand: 'right'});
|
|
131
|
+
self.rightHand.setAttribute('raycaster', {
|
|
132
|
+
objects: this.data.raycasterHand,
|
|
133
|
+
});
|
|
134
|
+
/** TIP TRIGGER R */
|
|
135
|
+
tipTriggerRconfig = {
|
|
136
|
+
text: self.data.triggerRLabel,
|
|
137
|
+
width: 0.07,
|
|
138
|
+
height: 0.03,
|
|
139
|
+
targetPosition: '0.005 -0.02 -0.014',
|
|
140
|
+
lineHorizontalAlign: 'left',
|
|
141
|
+
rotation: '-90 0 0',
|
|
142
|
+
src: tooltip.default,
|
|
143
|
+
};
|
|
144
|
+
tipTriggerRpos = {x: -0.09, y: -0.04, z: -0.08};
|
|
145
|
+
self.tipTriggerR = this.createTip('babia-tooltip_trigger_R', tipTriggerRconfig, tipTriggerRpos);
|
|
146
|
+
self.rightHand.append(self.tipTriggerR);
|
|
147
|
+
self.tooltips.push(self.tipTriggerR);
|
|
148
|
+
/** TIP GRIP L */
|
|
149
|
+
tipGripRconfig = {
|
|
150
|
+
text: self.data.gripRLabel,
|
|
151
|
+
width: 0.08,
|
|
152
|
+
height: 0.04,
|
|
153
|
+
targetPosition: '0.006 -0.008 0.033',
|
|
154
|
+
lineHorizontalAlign: 'right',
|
|
155
|
+
rotation: '-90 0 0',
|
|
156
|
+
src: tooltip.default,
|
|
157
|
+
};
|
|
158
|
+
tipGripRpos = {x: -0.085, y: -0.01, z: 0.07};
|
|
159
|
+
self.tipGripR = this.createTip('babia-tooltip_grip_R', tipGripRconfig, tipGripRpos);
|
|
160
|
+
self.rightHand.append(self.tipGripR);
|
|
161
|
+
self.tooltips.push(self.tipGripR);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
this.tipsController();
|
|
165
|
+
if (this.data.networkedAudio){
|
|
166
|
+
this.setAudioController();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
tipsController: function (){
|
|
172
|
+
let self = this;
|
|
173
|
+
this.tipsOpened = self.data.tipsOpened;
|
|
174
|
+
if (!self.tipsOpened){
|
|
175
|
+
self.tooltips.forEach(tip => {
|
|
176
|
+
tip.setAttribute('visible', false);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
self.rightHand.addEventListener('gripdown', () => {
|
|
181
|
+
if (self.tipsOpened) {
|
|
182
|
+
self.tipsOpened = false;
|
|
183
|
+
self.tooltips.forEach(tip => {
|
|
184
|
+
tip.setAttribute('visible', false);
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
self.tipsOpened = true;
|
|
188
|
+
self.tooltips.forEach(tip => {
|
|
189
|
+
tip.setAttribute('visible', true);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
})
|
|
@@ -4,7 +4,12 @@ if (typeof AFRAME === 'undefined') {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
AFRAME.registerComponent('babia-controls', {
|
|
7
|
-
schema: {
|
|
7
|
+
schema: {
|
|
8
|
+
// Current direction
|
|
9
|
+
direction: { type: 'string', default: ''},
|
|
10
|
+
// Current state
|
|
11
|
+
state: { type: 'string', default: ''},
|
|
12
|
+
},
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Set if component needs multiple instancing.
|
|
@@ -24,6 +29,43 @@ AFRAME.registerComponent('babia-controls', {
|
|
|
24
29
|
*/
|
|
25
30
|
|
|
26
31
|
update: function (oldData) {
|
|
32
|
+
let data = this.data;
|
|
33
|
+
if ((data.state) && (data.state != oldData.state)) {
|
|
34
|
+
let pause = document.getElementsByClassName('babiaPause')[0];
|
|
35
|
+
let play = document.getElementsByClassName('babiaPlay')[0];
|
|
36
|
+
if (data.state === 'pause') {
|
|
37
|
+
if (pause){
|
|
38
|
+
this.el.children[0].removeChild(pause)
|
|
39
|
+
}
|
|
40
|
+
if (!play){
|
|
41
|
+
this.createButton('play', 'white')
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (play){
|
|
45
|
+
this.el.children[0].removeChild(play)
|
|
46
|
+
}
|
|
47
|
+
if (!pause){
|
|
48
|
+
this.createButton('pause', 'white')
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.el.parentEl.setAttribute('babia-navigator', 'state', data.state)
|
|
52
|
+
}
|
|
53
|
+
if ((data.direction) && (data.direction != oldData.direction)) {
|
|
54
|
+
let rewind = document.getElementsByClassName('babiaRewind')[0];
|
|
55
|
+
let forward = document.getElementsByClassName('babiaForward')[0];
|
|
56
|
+
if (data.direction === 'rewind'){
|
|
57
|
+
forward.color = 'white'
|
|
58
|
+
rewind.color = 'grey'
|
|
59
|
+
changeMaterial(forward, 'white')
|
|
60
|
+
changeMaterial(rewind, 'grey')
|
|
61
|
+
} else {
|
|
62
|
+
forward.color = 'grey'
|
|
63
|
+
rewind.color = 'white'
|
|
64
|
+
changeMaterial(forward, 'grey')
|
|
65
|
+
changeMaterial(rewind, 'white')
|
|
66
|
+
}
|
|
67
|
+
this.el.parentEl.setAttribute('babia-navigator', 'direction', data.direction)
|
|
68
|
+
}
|
|
27
69
|
},
|
|
28
70
|
|
|
29
71
|
player: undefined,
|
|
@@ -46,40 +88,33 @@ AFRAME.registerComponent('babia-controls', {
|
|
|
46
88
|
let url
|
|
47
89
|
let pos_x
|
|
48
90
|
let class_name
|
|
49
|
-
let event
|
|
50
91
|
let inverse = false
|
|
51
92
|
|
|
52
93
|
if (type === 'play'){
|
|
53
|
-
url =
|
|
94
|
+
url = playButton.default
|
|
54
95
|
pos_x = 0.2
|
|
55
96
|
class_name = 'babiaPlay'
|
|
56
|
-
event = 'babiaContinue'
|
|
57
97
|
} else if (type === 'pause') {
|
|
58
|
-
url =
|
|
98
|
+
url = pauseButton.default
|
|
59
99
|
pos_x = 0
|
|
60
100
|
class_name = 'babiaPause'
|
|
61
|
-
event = 'babiaStop'
|
|
62
101
|
} else if (type === 'skipNext') {
|
|
63
|
-
url =
|
|
102
|
+
url = skipButton.default
|
|
64
103
|
pos_x = 3
|
|
65
104
|
class_name = 'babiaSkipNext'
|
|
66
|
-
event = class_name
|
|
67
105
|
inverse = true
|
|
68
106
|
} else if (type === "skipPrev") {
|
|
69
|
-
url =
|
|
107
|
+
url = skipButton.default
|
|
70
108
|
pos_x = -3
|
|
71
109
|
class_name = 'babiaSkipPrev'
|
|
72
|
-
event = class_name
|
|
73
110
|
} else if (type === "rewind") {
|
|
74
|
-
url =
|
|
111
|
+
url = rewindButton.default
|
|
75
112
|
pos_x = -6
|
|
76
113
|
class_name = 'babiaRewind'
|
|
77
|
-
event = 'babiaToPast'
|
|
78
114
|
} else if ( type === "forward"){
|
|
79
|
-
url =
|
|
115
|
+
url = rewindButton.default
|
|
80
116
|
pos_x = 6
|
|
81
117
|
class_name = 'babiaForward'
|
|
82
|
-
event = 'babiaToPresent'
|
|
83
118
|
inverse = true
|
|
84
119
|
} else {
|
|
85
120
|
throw new Error("That button type doesn't exist.");
|
|
@@ -99,8 +134,8 @@ AFRAME.registerComponent('babia-controls', {
|
|
|
99
134
|
this.player.appendChild(button)
|
|
100
135
|
|
|
101
136
|
// Events
|
|
102
|
-
this.emitEvents(button, event)
|
|
103
137
|
this.mouseOver(button)
|
|
138
|
+
this.processEvents(button)
|
|
104
139
|
},
|
|
105
140
|
|
|
106
141
|
mouseOver: function(element){
|
|
@@ -113,37 +148,27 @@ AFRAME.registerComponent('babia-controls', {
|
|
|
113
148
|
})
|
|
114
149
|
},
|
|
115
150
|
|
|
116
|
-
|
|
151
|
+
processEvents: function(element){
|
|
117
152
|
let self = this
|
|
118
153
|
element.addEventListener('click', function () {
|
|
119
154
|
if (element.classList.contains('babiaPlay')){
|
|
120
|
-
this.parentEl.
|
|
121
|
-
self.createButton('pause', 'white')
|
|
155
|
+
this.parentEl.parentEl.setAttribute('babia-controls','state', 'play');
|
|
122
156
|
} else if (element.classList.contains('babiaPause')){
|
|
123
|
-
this.parentEl.
|
|
124
|
-
self.createButton('play', 'white')
|
|
157
|
+
this.parentEl.parentEl.setAttribute('babia-controls','state', 'pause');
|
|
125
158
|
} else if ((element.classList.contains('babiaSkipNext')) || (element.classList.contains('babiaSkipPrev'))){
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
if (self.data.state != 'pause') {
|
|
160
|
+
this.parentEl.parentEl.setAttribute('babia-controls','state', 'pause')
|
|
161
|
+
}
|
|
162
|
+
let class_name = 'skipPrev';
|
|
163
|
+
if (element.classList.contains('babiaSkipNext')) {
|
|
164
|
+
class_name = 'skipNext';
|
|
130
165
|
}
|
|
166
|
+
self.el.parentEl.components['babia-navigator'].controlNavigator(class_name);
|
|
131
167
|
} else if (element.classList.contains('babiaForward')){
|
|
132
|
-
this.
|
|
133
|
-
changeMaterial(this, this.color)
|
|
134
|
-
let rewind = document.getElementsByClassName('babiaRewind')[0]
|
|
135
|
-
rewind.color = 'white'
|
|
136
|
-
changeMaterial(rewind, rewind.color)
|
|
168
|
+
this.parentEl.parentEl.setAttribute('babia-controls','direction', 'forward');
|
|
137
169
|
} else if (element.classList.contains('babiaRewind')){
|
|
138
|
-
this.
|
|
139
|
-
changeMaterial(this, this.color)
|
|
140
|
-
let forward = document.getElementsByClassName('babiaForward')[0]
|
|
141
|
-
forward.color = 'white'
|
|
142
|
-
changeMaterial(forward, forward.color)
|
|
170
|
+
this.parentEl.parentEl.setAttribute('babia-controls','direction', 'rewind');
|
|
143
171
|
}
|
|
144
|
-
//console.log('Emit... ' + event)
|
|
145
|
-
//self.el.parentEl.emit(event)
|
|
146
|
-
self.el.parentEl.components['babia-navigator'].controlNavigator(event)
|
|
147
172
|
});
|
|
148
173
|
}
|
|
149
174
|
|
|
@@ -7,24 +7,24 @@ const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
AFRAME.registerComponent('babia-navigator', {
|
|
10
|
-
schema: {
|
|
10
|
+
schema: {
|
|
11
|
+
// Current direction
|
|
12
|
+
direction: { type: 'string', default: ''},
|
|
13
|
+
// Current state
|
|
14
|
+
state: { type: 'string', default: ''},
|
|
15
|
+
},
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Set if component needs multiple instancing.
|
|
14
19
|
*/
|
|
15
20
|
multiple: false,
|
|
16
|
-
isPaused: undefined,
|
|
17
21
|
sliderEl: undefined,
|
|
18
|
-
toPresent: undefined,
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Initial creation and setting of the mesh.
|
|
22
25
|
*/
|
|
23
26
|
init: function () {
|
|
24
27
|
this.notiBuffer = new NotiBuffer(this.registerBack.bind(this), this.unregisterBack.bind(this));
|
|
25
|
-
|
|
26
|
-
this.toPresent = true
|
|
27
|
-
this.isPaused = false
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -32,7 +32,15 @@ AFRAME.registerComponent('babia-navigator', {
|
|
|
32
32
|
* Generally modifies the entity based on the data.
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
update: function (oldData) {
|
|
35
|
+
update: function (oldData) {
|
|
36
|
+
let data = this.data;
|
|
37
|
+
if ((data.state) && (data.state != oldData.state)) {
|
|
38
|
+
this.controlNavigator(data.state)
|
|
39
|
+
}
|
|
40
|
+
if ((data.direction) && (data.direction != oldData.direction)) {
|
|
41
|
+
this.controlNavigator(data.direction)
|
|
42
|
+
}
|
|
43
|
+
},
|
|
36
44
|
|
|
37
45
|
initializeControls: function(){
|
|
38
46
|
// Initialize Slider
|
|
@@ -77,19 +85,19 @@ AFRAME.registerComponent('babia-navigator', {
|
|
|
77
85
|
|
|
78
86
|
updateSlider: function(evt){
|
|
79
87
|
let value = this.sliderEl.getAttribute('babia-slider').value
|
|
80
|
-
if (evt ==='
|
|
88
|
+
if (evt ==='skipNext'){
|
|
81
89
|
value++
|
|
82
|
-
} else if (evt === '
|
|
90
|
+
} else if (evt === 'skipPrev'){
|
|
83
91
|
value--
|
|
84
92
|
}
|
|
85
93
|
// Out of range
|
|
86
|
-
if ((value >= 0) && (value <= this.sliderEl.max)){
|
|
87
|
-
this.
|
|
88
|
-
this.notiBuffer.set('babiaSetPosition' +
|
|
94
|
+
if (((evt === 'skipPrev') && (value >= 0)) || ((evt === 'skipNext') && (value <= this.sliderEl.max))){
|
|
95
|
+
this.current = value
|
|
96
|
+
this.notiBuffer.set('babiaSetPosition' + this.current)
|
|
89
97
|
} else {
|
|
90
98
|
if (this.controlsEl.querySelector('.babiaPause')){
|
|
91
|
-
this.
|
|
92
|
-
|
|
99
|
+
this.current = value
|
|
100
|
+
processData('pause')
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
103
|
|
|
@@ -109,25 +117,39 @@ AFRAME.registerComponent('babia-navigator', {
|
|
|
109
117
|
},
|
|
110
118
|
|
|
111
119
|
processData: function(data){
|
|
112
|
-
if (data == '
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
if (data == 'pause'){
|
|
121
|
+
this.controlsEl.setAttribute('babia-controls', 'state', 'pause')
|
|
122
|
+
} else if (data == 'rewind'){
|
|
123
|
+
this.el.setAttribute('babia-navigator', 'direction', 'rewind')
|
|
124
|
+
} else if (data == 'forward'){
|
|
125
|
+
this.el.setAttribute('babia-navigator', 'direction', 'forward')
|
|
126
|
+
} else if (data.type){
|
|
127
|
+
if (data.type === 'position'){
|
|
128
|
+
if (!this.sliderEl){
|
|
129
|
+
this.initializeControls()
|
|
130
|
+
}
|
|
131
|
+
if (this.data.direction != 'rewind'){
|
|
132
|
+
this.current = data.value - 1
|
|
133
|
+
} else {
|
|
134
|
+
this.current = data.value + 1
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if ((this.current >= this.sliderEl.min) && (this.current <= this.sliderEl.max)){
|
|
138
|
+
if (data.label){
|
|
139
|
+
this.sliderEl.setAttribute('babia-slider', {
|
|
140
|
+
label: data.label,
|
|
141
|
+
value: this.current
|
|
142
|
+
})
|
|
143
|
+
} else {
|
|
144
|
+
this.sliderEl.setAttribute('babia-slider', 'value', this.current)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} else if (data.type === 'step'){
|
|
148
|
+
this.stepControllerEl.setAttribute('babia-step-controller', 'value', data.value)
|
|
149
|
+
} else if (data.type === 'speed'){
|
|
150
|
+
this.speedControllerEl.setAttribute('babia-speed-controller', 'value', data.value)
|
|
129
151
|
}
|
|
130
|
-
}
|
|
152
|
+
}
|
|
131
153
|
},
|
|
132
154
|
|
|
133
155
|
/**
|
|
@@ -149,26 +171,10 @@ AFRAME.registerComponent('babia-navigator', {
|
|
|
149
171
|
speedComp: undefined,
|
|
150
172
|
|
|
151
173
|
controlNavigator: function (evt, value) {
|
|
152
|
-
|
|
153
|
-
if (evt == 'babiaSkipNext' || evt == 'babiaSkipPrev') {
|
|
154
|
-
// Update Slider
|
|
155
|
-
this.isPaused = true
|
|
174
|
+
if (evt == 'skipNext' || evt == 'skipPrev') {
|
|
156
175
|
this.updateSlider(evt)
|
|
157
176
|
} else {
|
|
158
177
|
this.notiBuffer.set(evt + value)
|
|
159
|
-
if(evt === 'babiaContinue'){
|
|
160
|
-
this.isPaused = false
|
|
161
|
-
} else if (evt === 'babiaStop'){
|
|
162
|
-
this.isPaused = true
|
|
163
|
-
if (this.controlsEl.querySelector('.babiaPause')){
|
|
164
|
-
this.controlsEl.querySelector('.babiaPause').emit('click')
|
|
165
|
-
}
|
|
166
|
-
} else if (evt === 'babiaToPresent'){
|
|
167
|
-
this.toPresent = true
|
|
168
|
-
} else if (evt === 'babiaToPast'){
|
|
169
|
-
this.toPresent = false
|
|
170
|
-
}
|
|
171
178
|
}
|
|
172
179
|
},
|
|
173
|
-
|
|
174
180
|
})
|