aframe-babia-components 1.2.6 → 1.2.7
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/common/noti-buffer.js +4 -1
- package/components/filters/babia-treebuilder.js +14 -4
- package/components/others/babia-slider.js +296 -296
- package/components/visualizers/babia-boats.js +91 -43
- package/cypress.json +1 -1
- package/dist/aframe-babia-components.js +41609 -46060
- package/dist/aframe-babia-components.min.js +2 -7
- package/dist/aframe-babia-components.min.js.LICENSE.txt +12 -0
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/Tutorials/get_started.md +2 -2
- package/docs/Tutorials/temporal_evol_with_boats.md +3 -3
- package/examples/ar/multichart/index.html +75 -0
- package/examples/assets/fonts/regular.json +1 -0
- package/examples/async/index.html +3 -3
- package/examples/async/index_filter.html +3 -3
- package/examples/async/index_noti_buffer.html +3 -3
- package/examples/async/index_noti_buffer_filter.html +3 -3
- package/examples/boats/boats/index.html +3 -3
- package/examples/boats/boats2/index.html +4 -4
- package/examples/boats/boats_city/index.html +4 -4
- package/examples/boats/boats_city_plan_view/index.html +4 -4
- package/examples/boats/boats_dependency/experiment.html +8 -7
- package/examples/boats/boats_dependency/index.html +1 -1
- package/examples/boats/boats_dependency/index_gradient.html +1 -1
- package/examples/boats/boats_dependency/index_normalcity.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_01.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_02.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_03.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_querystring.html +1 -1
- package/examples/boats/boats_dependency/index_tree.html +1 -1
- package/examples/boats/boats_dependency/index_tree_gradient.html +1 -1
- package/examples/boats/boats_dependency/index_tree_wireframe.html +1 -1
- package/examples/boats/boats_new_element/index.html +3 -3
- package/examples/boats/boats_new_quarter/index.html +3 -3
- package/examples/boats/boats_plan_view/index.html +3 -3
- package/examples/boats/boats_plan_view2/index.html +4 -4
- package/examples/boats/boats_quarter_resize/index.html +3 -3
- package/examples/boats/boats_quarter_resize2/index.html +3 -3
- package/examples/boats/boats_resize/index.html +3 -3
- package/examples/boats/boats_temporal/index.html +3 -3
- package/examples/boats/boats_treegenerator/index.html +3 -3
- package/examples/boats/jetuml_evol/ar.html +333 -0
- package/examples/boats/jetuml_evol/data.json +62382 -0
- package/examples/boats/jetuml_evol/index.html +381 -0
- package/examples/charts/bars/bars_change.html +2 -2
- package/examples/charts/bars/bars_json.html +2 -2
- package/examples/charts/bars/index.html +3 -3
- package/examples/charts/barsmap/index.html +3 -3
- package/examples/charts/bubbles/index.html +3 -3
- package/examples/charts/cyls/index.html +3 -3
- package/examples/charts/cyls/primitive.html +3 -3
- package/examples/charts/cylsmap/index.html +3 -3
- package/examples/charts/doughnut/index.html +3 -3
- package/examples/charts/multichart/index.html +3 -3
- package/examples/charts/network_chart/network_chart.html +1 -1
- package/examples/charts/network_chart/network_large_chart.html +3 -3
- package/examples/charts/network_chart/network_nodes_links_chart.html +3 -3
- package/examples/charts/network_chart/network_nodes_links_directed_chart.html +2 -2
- package/examples/charts/network_chart/network_random_chart.html +2 -2
- package/examples/charts/pie/index.html +2 -2
- package/examples/charts_querier/bars_querier/bars_axis_name.html +3 -3
- package/examples/charts_querier/bars_querier/index.html +3 -3
- package/examples/charts_querier/bars_querier/index_csv.html +3 -3
- package/examples/charts_querier/barsmap_querier/barsmap_axis_name.html +3 -3
- package/examples/charts_querier/barsmap_querier/index.html +3 -3
- package/examples/charts_querier/bubbles_querier/index.html +3 -3
- package/examples/charts_querier/cyls_querier/index.html +3 -3
- package/examples/charts_querier/cylsmap_querier/index.html +3 -3
- package/examples/charts_querier/doughnut_querier/index.html +3 -3
- package/examples/charts_querier/multichart_querier/index.html +3 -3
- package/examples/charts_querier/multichart_querier/manual_colors.html +3 -3
- package/examples/charts_querier/pie_querier/index.html +3 -3
- package/examples/codecityjs/argouml/index.html +4 -4
- package/examples/codecityjs/basic/index.html +2 -2
- package/examples/codecityjs/basic_treegenerator/index.html +2 -2
- package/examples/codecityjs/perceval/index.html +2 -2
- package/examples/codecityjs/perceval2021/index.html +4 -4
- package/examples/codecityjs/projects_analysis/argouml_landscape.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_numfuns.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_table.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_tokens.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_task5.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_2021.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_task5.html +2 -2
- package/examples/codecityjs/projects_analysis/perceval_landscape.html +2 -2
- package/examples/codecityjs/projects_analysis/perceval_table.html +2 -2
- package/examples/codecityjs/sortinghat/index.html +2 -2
- package/examples/codecityjs/sortinghat/indexcolor.html +2 -2
- package/examples/codecityjs/time_evolution_angular/index.html +2 -2
- package/examples/dashboard/chaoss-dashboards.html +1 -1
- package/examples/dashboard/chaoss-issues.html +1 -1
- package/examples/dashboard/chaoss-pr.html +1 -1
- package/examples/dashboard/index.html +1 -1
- package/examples/dashboard/range.html +3 -3
- package/examples/dashboard/template.html +1 -1
- package/examples/demos/1.0.11/index.html +4 -4
- package/examples/demos/1.0.11/index_multiuser.html +3 -3
- package/examples/demos/1.0.11/index_multiuser_ui.html +3 -3
- package/examples/demos/1.0.7/index.html +3 -3
- package/examples/elevation/elevation basic/index.html +2 -2
- package/examples/elevation/elevation filled/index.html +2 -2
- package/{example-template.html → examples/example-template.html} +3 -3
- package/examples/experiment/city.html +2 -2
- package/examples/experiment/index.html +1 -1
- package/examples/experiment/pie.html +2 -2
- package/examples/experiment/third_party.html +92 -0
- package/examples/img/codecitytree.png +0 -0
- package/examples/img/codecityvs.png +0 -0
- package/examples/img/dashboard.png +0 -0
- package/examples/img/elevatedcity.png +0 -0
- package/examples/img/experiment.png +0 -0
- package/examples/img/time.png +0 -0
- package/examples/img/uinetwork.png +0 -0
- package/examples/img/uinetwork_json.png +0 -0
- package/examples/multi_bars/index.html +3 -3
- package/examples/multi_bars/index1.html +3 -3
- package/examples/multi_bars/index2.html +3 -3
- package/examples/multi_bars/index3.html +3 -3
- package/examples/multi_boats/index_multi_boats.html +3 -3
- package/examples/multi_boats/jetuml.html +3 -3
- package/examples/multi_boats/jetuml_evolution_experiment.html +3 -3
- package/examples/multi_boats/only_queryjson.html +3 -3
- package/examples/multi_boats/only_queryjson2.html +3 -3
- package/examples/multi_boats/only_queryjson3.html +3 -3
- package/examples/multi_boats/queryjson_treebuilder.html +3 -3
- package/examples/multi_boats/with_selector.html +3 -3
- package/examples/multiuser/choose_avatar/desert_demo.html +3 -3
- package/examples/multiuser/demo_esLibre_audio.html +3 -3
- package/examples/multiuser/demo_esLibre_no_audio.html +3 -3
- package/examples/multiuser/demo_no_share_ui.html +3 -3
- package/examples/multiuser/meaningful.html +3 -3
- package/examples/multiuser/new_demo.html +3 -3
- package/examples/multiuser/no_persistence.html +3 -3
- package/examples/multiuser/persistence.html +3 -3
- package/examples/multiuser/simple_scene.html +3 -3
- package/examples/performance/500bars_100anime/index.html +3 -3
- package/examples/performance/500bars_anime/index.html +3 -3
- package/examples/performance/500simplebars_100anime/index.html +3 -3
- package/examples/publications/codecityvs/aframe-lounge-component.min.js +1 -0
- package/examples/publications/codecityvs/index.html +533 -0
- package/examples/publications/codecityvs/jetuml_code_data.json +1 -0
- package/examples/publications/dashboard/index.html +763 -0
- package/examples/publications/dashboard/staticdata/80-percent-open-time-issues2.json +1 -0
- package/examples/publications/dashboard/staticdata/80-percent-open-time-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/issues-by-organization.json +1 -0
- package/examples/publications/dashboard/staticdata/issues.json +1 -0
- package/examples/publications/dashboard/staticdata/median-open-time-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/median-open-time-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/organizations-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/organizations-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/projects-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/projects-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/pull-requests-by-organization.json +1 -0
- package/examples/publications/dashboard/staticdata/pull-requests.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-asignees.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-count.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-submitters.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-asignees.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-count.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-submitters.json +1 -0
- package/examples/publications/dashboard/staticdata/status-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/status-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-count.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-repo.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-count.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-repo.json +1 -0
- package/examples/publications/dashboard/staticdata/submitters-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/submitters-pr.json +1 -0
- package/examples/publications/elevated/dependencieslist_ghdesktop.json +127660 -0
- package/examples/publications/elevated/dependencieslist_pm2.json +13726 -0
- package/examples/publications/elevated/dependencieslist_portainer.json +41818 -0
- package/examples/publications/elevated/dependencieslist_sh.json +5194 -0
- package/examples/publications/elevated/index.html +277 -0
- package/examples/selector/index.html +2 -2
- package/examples/selector_boats/index.html +3 -3
- package/examples/selector_boats/index2.html +3 -3
- package/examples/selector_boats/jetuml.html +3 -3
- package/examples/selector_boats/jetumltest.html +3 -3
- package/examples/temporal_evol/bars/index.html +3 -3
- package/examples/temporal_evol/barsmap/index.html +3 -3
- package/examples/timeline/index.html +3 -3
- package/examples/timeline/index2.html +3 -3
- package/examples/timeline/index3.html +3 -3
- package/examples/ui/bars/index.html +3 -3
- package/examples/ui/barsmap/index.html +3 -3
- package/examples/ui/boats_treegenerator/index.html +3 -3
- package/examples/ui/city_treegenerator/index.html +3 -3
- package/examples/ui/cylsmap/index.html +3 -3
- package/examples/ui/link/index.html +3 -3
- package/examples/ui/network/network.html +3 -3
- package/examples/ui/network/network_nodes_links.html +2 -2
- package/examples/ui/oculus/index.html +3 -3
- package/examples/ui/pie/index.html +3 -3
- package/examples/ui/ui_treegenerator/index.html +3 -3
- package/examples/watcher/querier_watcher/index.html +2 -2
- package/index.html +186 -168
- package/index.js +5 -1
- package/package.json +15 -14
- package/tests/index.html +2 -2
- package/tests/treebuilder.js +69 -0
- package/webpack.dev.js +12 -7
- package/webpack.devall.js +12 -7
- package/webpack.devnossl.js +5 -4
- package/webpack.prod.js +1 -1
|
@@ -1,300 +1,300 @@
|
|
|
1
1
|
/* global AFRAME */
|
|
2
2
|
if (typeof AFRAME === 'undefined') {
|
|
3
|
-
|
|
3
|
+
throw new Error('Component attempted to register before AFRAME was available.');
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
AFRAME.registerComponent('babia-slider', {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
multiple: true,
|
|
20
|
-
|
|
21
|
-
init: function () {
|
|
22
|
-
this.loader = new THREE.FontLoader();
|
|
23
|
-
|
|
24
|
-
let material = new THREE.MeshBasicMaterial({color: this.data.color });
|
|
25
|
-
this.material = material
|
|
26
|
-
let lever= new THREE.Mesh(new THREE.BoxGeometry( 0.05, 0.15, 0.05 ), material);
|
|
27
|
-
let track = new THREE.Mesh(new THREE.CylinderGeometry(0.015,0.015, this.data.size, 12), material);
|
|
28
|
-
track.rotateZ(Math.PI / 2);
|
|
29
|
-
let chassis = new THREE.Group();
|
|
30
|
-
|
|
31
|
-
this.lever = lever;
|
|
32
|
-
chassis.add(track);
|
|
33
|
-
chassis.add(lever);
|
|
34
|
-
|
|
35
|
-
if (this.data.vertical){
|
|
36
|
-
chassis.rotateZ(Math.PI / 2)
|
|
37
|
-
}
|
|
7
|
+
schema: {
|
|
8
|
+
color: { type: 'color', default: '#fff' },
|
|
9
|
+
size: { type: 'number', default: 0.5 },
|
|
10
|
+
min: { type: 'number', default: -6 },
|
|
11
|
+
max: { type: 'number', default: -4 },
|
|
12
|
+
value: { type: 'number', default: -5 },
|
|
13
|
+
innerSize: { type: 'number', default: 0.8 },
|
|
14
|
+
precision: { type: 'number', default: 2 },
|
|
15
|
+
vertical: { type: 'boolean', default: false },
|
|
16
|
+
label: { type: 'string' }
|
|
17
|
+
},
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
this.el.classList.add("babiaxraycasterclass");
|
|
41
|
-
|
|
42
|
-
this.controllers = Array.prototype.slice.call(document.querySelectorAll('a-entity[hand-controls]'));
|
|
43
|
-
|
|
44
|
-
this.fontURL = 'https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json'
|
|
45
|
-
this.loader.load(this.fontURL, (font) => {
|
|
46
|
-
this.font = font
|
|
47
|
-
let minText = this.createTextGeometry(this.data.min, -this.data.size / 2 - .15, -.025)
|
|
48
|
-
let maxText = this.createTextGeometry(this.data.max, this.data.size / 2 + .08, -.025)
|
|
49
|
-
chassis.add(minText)
|
|
50
|
-
chassis.add(maxText)
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
createTextGeometry: function(text, x, y) {
|
|
55
|
-
let textGeometry = new THREE.TextGeometry(text.toString(), {
|
|
56
|
-
font: this.font,
|
|
57
|
-
size: .07,
|
|
58
|
-
height: .01,
|
|
59
|
-
curveSegments: 12,
|
|
60
|
-
bevelEnabled: false,
|
|
61
|
-
});
|
|
62
|
-
let textMesh = new THREE.Mesh(textGeometry, this.material)
|
|
63
|
-
textMesh.position.x = x
|
|
64
|
-
textMesh.position.y = y
|
|
65
|
-
if (this.data.vertical){
|
|
66
|
-
textMesh.rotation.z = - Math.PI / 2
|
|
67
|
-
textMesh.position.y += .05
|
|
68
|
-
}
|
|
69
|
-
return textMesh
|
|
70
|
-
},
|
|
19
|
+
multiple: true,
|
|
71
20
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
21
|
+
init: function () {
|
|
22
|
+
this.loader = new FontLoader.FontLoader();
|
|
23
|
+
|
|
24
|
+
let material = new THREE.MeshBasicMaterial({ color: this.data.color });
|
|
25
|
+
this.material = material
|
|
26
|
+
let lever = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.15, 0.05), material);
|
|
27
|
+
let track = new THREE.Mesh(new THREE.CylinderGeometry(0.015, 0.015, this.data.size, 12), material);
|
|
28
|
+
track.rotateZ(Math.PI / 2);
|
|
29
|
+
let chassis = new THREE.Group();
|
|
30
|
+
|
|
31
|
+
this.lever = lever;
|
|
32
|
+
chassis.add(track);
|
|
33
|
+
chassis.add(lever);
|
|
34
|
+
|
|
35
|
+
if (this.data.vertical) {
|
|
36
|
+
chassis.rotateZ(Math.PI / 2)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.el.setObject3D('mesh', chassis);
|
|
40
|
+
this.el.classList.add("babiaxraycasterclass");
|
|
41
|
+
|
|
42
|
+
this.controllers = Array.prototype.slice.call(document.querySelectorAll('a-entity[hand-controls]'));
|
|
43
|
+
|
|
44
|
+
this.fontURL = 'https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json'
|
|
45
|
+
this.loader.load(this.fontURL, (font) => {
|
|
46
|
+
this.font = font
|
|
47
|
+
let minText = this.createTextGeometry(this.data.min, -this.data.size / 2 - .15, -.025)
|
|
48
|
+
let maxText = this.createTextGeometry(this.data.max, this.data.size / 2 + .08, -.025)
|
|
49
|
+
chassis.add(minText)
|
|
50
|
+
chassis.add(maxText)
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
createTextGeometry: function (text, x, y) {
|
|
55
|
+
let textGeometry = new TextGeometry.TextGeometry(text.toString(), {
|
|
56
|
+
font: this.font,
|
|
57
|
+
size: .07,
|
|
58
|
+
height: .01,
|
|
59
|
+
curveSegments: 12,
|
|
60
|
+
bevelEnabled: false,
|
|
61
|
+
});
|
|
62
|
+
let textMesh = new THREE.Mesh(textGeometry, this.material)
|
|
63
|
+
textMesh.position.x = x
|
|
64
|
+
textMesh.position.y = y
|
|
65
|
+
if (this.data.vertical) {
|
|
66
|
+
textMesh.rotation.z = - Math.PI / 2
|
|
67
|
+
textMesh.position.y += .05
|
|
68
|
+
}
|
|
69
|
+
return textMesh
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
setTextGeometry: function (text) {
|
|
73
|
+
if (this.textmesh) {
|
|
74
|
+
this.lever.children = []
|
|
75
|
+
}
|
|
76
|
+
this.loader.load(this.fontURL, (font) => {
|
|
77
|
+
this.font = font
|
|
78
|
+
if (!this.data.vertical) {
|
|
79
|
+
this.textmesh = this.createTextGeometry(text, -.025, .15)
|
|
80
|
+
} else {
|
|
81
|
+
this.textmesh = this.createTextGeometry(text, -.025, -.2)
|
|
82
|
+
}
|
|
83
|
+
this.lever.add(this.textmesh)
|
|
84
|
+
})
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
play: function () {
|
|
88
|
+
this.grabbed = false;
|
|
89
|
+
this.el.addEventListener('rangeout', this.onTriggerUp.bind(this));
|
|
90
|
+
this.controllers.forEach(function (controller) {
|
|
91
|
+
controller.addEventListener('triggerdown', this.onTriggerDown.bind(this));
|
|
92
|
+
controller.addEventListener('triggerup', this.onTriggerUp.bind(this));
|
|
93
|
+
}.bind(this));
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
pause: function () {
|
|
97
|
+
this.el.removeEventListener('rangeout', this.onTriggerUp.bind(this));
|
|
98
|
+
this.controllers.forEach(function (controller) {
|
|
99
|
+
controller.removeEventListener('triggerdown', this.onTriggerDown.bind(this));
|
|
100
|
+
controller.removeEventListener('triggerup', this.onTriggerUp.bind(this));
|
|
101
|
+
}.bind(this));
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
onTriggerDown: function (e) {
|
|
105
|
+
var hand = e.target.object3D;
|
|
106
|
+
var lever = this.lever;
|
|
107
|
+
|
|
108
|
+
var handBB = new THREE.Box3().setFromObject(hand);
|
|
109
|
+
var leverBB = new THREE.Box3().setFromObject(lever);
|
|
110
|
+
var collision = handBB.intersectsBox(leverBB);
|
|
111
|
+
|
|
112
|
+
if (collision) {
|
|
113
|
+
let handWorld = new THREE.Vector3();
|
|
114
|
+
hand.getWorldPosition(handWorld);
|
|
115
|
+
let knobWorld = new THREE.Vector3();;
|
|
116
|
+
lever.getWorldPosition(knobWorld);
|
|
117
|
+
let distance = handWorld.distanceTo(knobWorld);
|
|
118
|
+
if (distance < 0.1) {
|
|
119
|
+
this.grabbed = hand;
|
|
120
|
+
this.grabbed.visible = false;
|
|
121
|
+
this.knob.material = this.knobGrabbedMaterial;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
onTriggerUp: function () {
|
|
127
|
+
if (this.grabbed) {
|
|
128
|
+
this.grabbed.visible = true;
|
|
129
|
+
this.grabbed = false;
|
|
130
|
+
this.knob.material = this.knobMaterial;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
setValue: function (value) {
|
|
135
|
+
var lever = this.lever;
|
|
136
|
+
if (value < this.data.min) {
|
|
137
|
+
value = this.data.min;
|
|
138
|
+
} else if (value > this.data.max) {
|
|
139
|
+
value = this.data.max;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.value = value;
|
|
143
|
+
|
|
144
|
+
lever.position.x = this.valueToLeverPosition(value);
|
|
145
|
+
if (!this.data.label) {
|
|
146
|
+
this.setTextGeometry(value)
|
|
147
|
+
} else {
|
|
148
|
+
this.setTextGeometry(this.data.label)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
valueToLeverPosition: function (value) {
|
|
154
|
+
var sliderRange = this.data.size * this.data.innerSize;
|
|
155
|
+
var valueRange = Math.abs(this.data.max - this.data.min);
|
|
156
|
+
|
|
157
|
+
let sliderMin = -1 * sliderRange / 2;
|
|
158
|
+
|
|
159
|
+
return (((value - this.data.min) * sliderRange) / valueRange) + sliderMin
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
leverPositionToValue: function (position) {
|
|
163
|
+
var sliderRange = this.data.size * this.data.innerSize;
|
|
164
|
+
var valueRange = Math.abs(this.data.max - this.data.min);
|
|
165
|
+
|
|
166
|
+
let sliderMin = -1 * sliderRange / 2;
|
|
167
|
+
|
|
168
|
+
return (((position - sliderMin) * valueRange) / sliderRange) + this.data.min
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
tick: function () {
|
|
172
|
+
if (this.grabbed) {
|
|
173
|
+
var hand = this.grabbed;
|
|
174
|
+
var lever = this.lever;
|
|
175
|
+
var sliderSize = this.data.size;
|
|
176
|
+
var sliderRange = (sliderSize * this.data.innerSize);
|
|
177
|
+
|
|
178
|
+
var handWorld = new THREE.Vector3().setFromMatrixPosition(hand.matrixWorld);
|
|
179
|
+
lever.parent.worldToLocal(handWorld);
|
|
180
|
+
|
|
181
|
+
if (Math.abs(handWorld.x) > sliderRange / 2) {
|
|
182
|
+
lever.position.x = sliderRange / 2 * Math.sign(lever.position.x);
|
|
183
|
+
} else {
|
|
184
|
+
lever.position.x = handWorld.x;
|
|
185
|
+
}
|
|
186
|
+
var value = this.leverPositionToValue(lever.position.x);
|
|
187
|
+
|
|
188
|
+
if (Math.abs(this.value - value) >= Math.pow(10, -this.data.precision)) {
|
|
189
|
+
value = Math.round(value)
|
|
142
190
|
this.value = value;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
this.
|
|
147
|
-
} else {
|
|
148
|
-
this.
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
valueToLeverPosition: function(value) {
|
|
154
|
-
var sliderRange = this.data.size * this.data.innerSize;
|
|
155
|
-
var valueRange = Math.abs(this.data.max - this.data.min);
|
|
156
|
-
|
|
157
|
-
let sliderMin = -1 * sliderRange / 2;
|
|
158
|
-
|
|
159
|
-
return (((value - this.data.min) * sliderRange) / valueRange) + sliderMin
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
leverPositionToValue: function(position) {
|
|
163
|
-
var sliderRange = this.data.size * this.data.innerSize;
|
|
164
|
-
var valueRange = Math.abs(this.data.max - this.data.min);
|
|
165
|
-
|
|
166
|
-
let sliderMin = -1 * sliderRange / 2;
|
|
167
|
-
|
|
168
|
-
return (((position - sliderMin) * valueRange) / sliderRange) + this.data.min
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
tick: function() {
|
|
172
|
-
if (this.grabbed) {
|
|
173
|
-
var hand = this.grabbed;
|
|
174
|
-
var lever = this.lever;
|
|
175
|
-
var sliderSize = this.data.size;
|
|
176
|
-
var sliderRange = (sliderSize * this.data.innerSize);
|
|
177
|
-
|
|
178
|
-
var handWorld = new THREE.Vector3().setFromMatrixPosition(hand.matrixWorld);
|
|
179
|
-
lever.parent.worldToLocal(handWorld);
|
|
180
|
-
|
|
181
|
-
if (Math.abs(handWorld.x) > sliderRange / 2) {
|
|
182
|
-
lever.position.x = sliderRange / 2 * Math.sign(lever.position.x);
|
|
183
|
-
} else {
|
|
184
|
-
lever.position.x = handWorld.x;
|
|
185
|
-
}
|
|
186
|
-
var value = this.leverPositionToValue(lever.position.x);
|
|
187
|
-
|
|
188
|
-
if (Math.abs(this.value - value) >= Math.pow(10, -this.data.precision)) {
|
|
189
|
-
value = Math.round(value)
|
|
190
|
-
this.value = value;
|
|
191
|
-
this.setTextGeometry(value)
|
|
192
|
-
// this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', this.value)
|
|
193
|
-
if (this.el.parentEl.components['babia-navigator']){
|
|
194
|
-
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', Math.round(value))
|
|
195
|
-
} else if (this.el.parentEl.components['babia-step-controller']){
|
|
196
|
-
this.el.parentEl.components['babia-step-controller'].controlStep(Math.round(value))
|
|
197
|
-
} else if (this.el.parentEl.components['babia-speed-controller']){
|
|
198
|
-
this.el.parentEl.components['babia-speed-controller'].controlSpeed(Math.round(value))
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
mousexPositionToValue: function(x){
|
|
205
|
-
let sliderCenter = this.el.object3D.getWorldPosition().x
|
|
206
|
-
let sliderWidth = this.data.size * this.data.innerSize * this.el.object3D.getWorldScale().x
|
|
207
|
-
let sliderRange = Math.abs(this.data.max - this.data.min)
|
|
208
|
-
let sliderMin = sliderCenter - (sliderWidth / 2)
|
|
209
|
-
|
|
210
|
-
let value = (((x - sliderMin) * sliderRange) / sliderWidth) + this.data.min
|
|
211
|
-
if (value < this.data.min){
|
|
212
|
-
return this.data.min
|
|
213
|
-
} else if (value > this.data.max){
|
|
214
|
-
return this.data.max
|
|
215
|
-
} else {
|
|
216
|
-
return value
|
|
191
|
+
this.setTextGeometry(value)
|
|
192
|
+
// this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', this.value)
|
|
193
|
+
if (this.el.parentEl.components['babia-navigator']) {
|
|
194
|
+
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', Math.round(value))
|
|
195
|
+
} else if (this.el.parentEl.components['babia-step-controller']) {
|
|
196
|
+
this.el.parentEl.components['babia-step-controller'].controlStep(Math.round(value))
|
|
197
|
+
} else if (this.el.parentEl.components['babia-speed-controller']) {
|
|
198
|
+
this.el.parentEl.components['babia-speed-controller'].controlSpeed(Math.round(value))
|
|
217
199
|
}
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
mouseyPositionToValue: function(y){
|
|
221
|
-
let sliderCenter = this.el.object3D.getWorldPosition().y
|
|
222
|
-
let sliderWidth = this.data.size * this.data.innerSize * this.el.object3D.getWorldScale().y
|
|
223
|
-
let sliderRange = Math.abs(this.data.max - this.data.min)
|
|
224
|
-
let sliderMin = sliderCenter - (sliderWidth / 2)
|
|
225
|
-
|
|
226
|
-
let value = (((y - sliderMin) * sliderRange) / sliderWidth) + this.data.min
|
|
227
|
-
if (value < this.data.min){
|
|
228
|
-
return this.data.min
|
|
229
|
-
} else if (value > this.data.max){
|
|
230
|
-
return this.data.max
|
|
231
|
-
} else {
|
|
232
|
-
return value
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
update: function(old) {
|
|
237
|
-
if(this.data.value !== old.value) {
|
|
238
|
-
this.setValue(this.data.value);
|
|
239
|
-
}
|
|
240
|
-
this.el.addEventListener('click', _listener = (e) => {
|
|
241
|
-
let mouse = e.detail.intersection.point
|
|
242
|
-
let value
|
|
243
|
-
if (!this.data.vertical){
|
|
244
|
-
value = this.mousexPositionToValue(mouse.x);
|
|
245
|
-
} else {
|
|
246
|
-
value = this.mouseyPositionToValue(mouse.y);
|
|
247
|
-
}
|
|
248
|
-
//this.setValue(Math.round(value));
|
|
249
|
-
|
|
250
|
-
if (this.el.parentEl.components['babia-navigator']){
|
|
251
|
-
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', Math.round(value))
|
|
252
|
-
} else if (this.el.parentEl.components['babia-step-controller']){
|
|
253
|
-
this.el.parentEl.components['babia-step-controller'].controlStep(Math.round(value))
|
|
254
|
-
} else if (this.el.parentEl.components['babia-speed-controller']){
|
|
255
|
-
this.el.parentEl.components['babia-speed-controller'].controlSpeed(Math.round(value))
|
|
256
|
-
}
|
|
257
|
-
})
|
|
258
200
|
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
mousexPositionToValue: function (x) {
|
|
205
|
+
let sliderCenter = this.el.object3D.getWorldPosition().x
|
|
206
|
+
let sliderWidth = this.data.size * this.data.innerSize * this.el.object3D.getWorldScale().x
|
|
207
|
+
let sliderRange = Math.abs(this.data.max - this.data.min)
|
|
208
|
+
let sliderMin = sliderCenter - (sliderWidth / 2)
|
|
209
|
+
|
|
210
|
+
let value = (((x - sliderMin) * sliderRange) / sliderWidth) + this.data.min
|
|
211
|
+
if (value < this.data.min) {
|
|
212
|
+
return this.data.min
|
|
213
|
+
} else if (value > this.data.max) {
|
|
214
|
+
return this.data.max
|
|
215
|
+
} else {
|
|
216
|
+
return value
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
mouseyPositionToValue: function (y) {
|
|
221
|
+
let sliderCenter = this.el.object3D.getWorldPosition().y
|
|
222
|
+
let sliderWidth = this.data.size * this.data.innerSize * this.el.object3D.getWorldScale().y
|
|
223
|
+
let sliderRange = Math.abs(this.data.max - this.data.min)
|
|
224
|
+
let sliderMin = sliderCenter - (sliderWidth / 2)
|
|
225
|
+
|
|
226
|
+
let value = (((y - sliderMin) * sliderRange) / sliderWidth) + this.data.min
|
|
227
|
+
if (value < this.data.min) {
|
|
228
|
+
return this.data.min
|
|
229
|
+
} else if (value > this.data.max) {
|
|
230
|
+
return this.data.max
|
|
231
|
+
} else {
|
|
232
|
+
return value
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
update: function (old) {
|
|
237
|
+
if (this.data.value !== old.value) {
|
|
238
|
+
this.setValue(this.data.value);
|
|
239
|
+
}
|
|
240
|
+
this.el.addEventListener('click', _listener = (e) => {
|
|
241
|
+
let mouse = e.detail.intersection.point
|
|
242
|
+
let value
|
|
243
|
+
if (!this.data.vertical) {
|
|
244
|
+
value = this.mousexPositionToValue(mouse.x);
|
|
245
|
+
} else {
|
|
246
|
+
value = this.mouseyPositionToValue(mouse.y);
|
|
247
|
+
}
|
|
248
|
+
//this.setValue(Math.round(value));
|
|
249
|
+
|
|
250
|
+
if (this.el.parentEl.components['babia-navigator']) {
|
|
251
|
+
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetPosition', Math.round(value))
|
|
252
|
+
} else if (this.el.parentEl.components['babia-step-controller']) {
|
|
253
|
+
this.el.parentEl.components['babia-step-controller'].controlStep(Math.round(value))
|
|
254
|
+
} else if (this.el.parentEl.components['babia-speed-controller']) {
|
|
255
|
+
this.el.parentEl.components['babia-speed-controller'].controlSpeed(Math.round(value))
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
259
|
})
|
|
260
260
|
|
|
261
261
|
AFRAME.registerComponent('babia-step-controller', {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
262
|
+
schema: {
|
|
263
|
+
value: { type: 'number', default: -5 },
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
multiple: true,
|
|
267
|
+
|
|
268
|
+
sliderEl: undefined,
|
|
269
|
+
step: undefined,
|
|
270
|
+
|
|
271
|
+
init: function () {
|
|
272
|
+
this.createSlider()
|
|
273
|
+
},
|
|
274
|
+
update: function (old) {
|
|
275
|
+
if (this.data.value !== old.value) {
|
|
276
|
+
this.sliderEl.setAttribute('babia-slider', 'value', this.data.value);
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
createSlider: function () {
|
|
281
|
+
this.sliderEl = document.createElement('a-entity');
|
|
282
|
+
this.sliderEl.setAttribute('babia-slider', {
|
|
283
|
+
size: 1,
|
|
284
|
+
min: 1,
|
|
285
|
+
max: 10,
|
|
286
|
+
value: 1,
|
|
287
|
+
vertical: true
|
|
288
|
+
}); // When implement with selector, add the attributes
|
|
289
|
+
this.sliderEl.classList.add("babiaxraycasterclass");
|
|
290
|
+
this.sliderEl.id = "step-controller"
|
|
291
|
+
this.el.appendChild(this.sliderEl);
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
controlStep: function (value) {
|
|
295
|
+
this.step = value
|
|
296
|
+
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetStep', this.step)
|
|
297
|
+
}
|
|
298
298
|
})
|
|
299
299
|
|
|
300
300
|
|
|
@@ -311,28 +311,28 @@ AFRAME.registerComponent('babia-speed-controller', {
|
|
|
311
311
|
init: function () {
|
|
312
312
|
this.createSlider()
|
|
313
313
|
},
|
|
314
|
-
|
|
315
|
-
update: function(old) {
|
|
316
|
-
if(this.data.value !== old.value) {
|
|
317
|
-
this.sliderEl.setAttribute('babia-slider','value', this.data.value);
|
|
314
|
+
|
|
315
|
+
update: function (old) {
|
|
316
|
+
if (this.data.value !== old.value) {
|
|
317
|
+
this.sliderEl.setAttribute('babia-slider', 'value', this.data.value);
|
|
318
318
|
}
|
|
319
319
|
},
|
|
320
320
|
|
|
321
|
-
createSlider: function(){
|
|
321
|
+
createSlider: function () {
|
|
322
322
|
this.sliderEl = document.createElement('a-entity');
|
|
323
323
|
this.sliderEl.setAttribute('babia-slider', {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
size: 1,
|
|
325
|
+
min: 1,
|
|
326
|
+
max: 3,
|
|
327
|
+
value: 1,
|
|
328
|
+
vertical: true
|
|
329
329
|
}); // When implement with selector, add the attributes
|
|
330
330
|
this.sliderEl.classList.add("babiaxraycasterclass");
|
|
331
331
|
this.sliderEl.id = "speed-controller"
|
|
332
332
|
this.el.appendChild(this.sliderEl);
|
|
333
333
|
},
|
|
334
|
-
|
|
335
|
-
controlSpeed: function(value){
|
|
334
|
+
|
|
335
|
+
controlSpeed: function (value) {
|
|
336
336
|
this.speed = value
|
|
337
337
|
this.el.parentEl.components['babia-navigator'].controlNavigator('babiaSetSpeed', this.speed)
|
|
338
338
|
}
|