Commit e6efc242 authored by amandaghassaei's avatar amandaghassaei

fixes with dropdown behavior

parent 8c742ab0
......@@ -546,6 +546,7 @@ function createCheckbox() {
if (isOption) {
labelInteraction.events.on('onPressed', function (p) {
selectedLabel.setString(labelText);
selectedLabel.setString("");//todo there's a better way to do this
var propertyChanged = false;
......@@ -702,6 +703,8 @@ function createCheckbox() {
return group;
};
group.collapseOptions = collapseOptions;
return group;
}
......@@ -1635,7 +1638,6 @@ var GUIVR = function DATGUIVR() {
}
if (isObject(arg3) || isArray(arg3)) {
console.log("here");
return addDropdown(object, propertyName, arg3);
}
......@@ -1735,6 +1737,7 @@ var GUIVR = function DATGUIVR() {
function update() {
requestAnimationFrame(update);
if (!mouseEnabled && inputObjects.length == 0) return;
var hitscanObjects = getVisibleHitscanObjects();
......@@ -1767,6 +1770,13 @@ var GUIVR = function DATGUIVR() {
// laser.geometry.vertices[ 1 ].copy( tPosition ).add( tDirection.multiplyScalar( 1 ) );
var intersections = raycast.intersectObjects(hitscanObjects, false);
if (intersections.length == 0){
for (var i=0;i<controllers.length;i++){
if (controllers[i].visible) {
if (controllers[i].collapseOptions) controllers[i].collapseOptions();
}
}
}
parseIntersections(intersections, laser, cursor);
inputObjects[index].intersections = intersections;
......@@ -1835,6 +1845,13 @@ var GUIVR = function DATGUIVR() {
if (mouseCamera) {
intersections = performMouseIntersection(raycast, mouse, mouseCamera);
if (intersections.length == 0){
for (var i=0;i<controllers.length;i++){
if (controllers[i].visible) {
if (controllers[i].collapseOptions) controllers[i].collapseOptions();
}
}
}
parseIntersections(intersections, laser, cursor);
cursor.visible = true;
laser.visible = true;
......
......@@ -10,7 +10,8 @@ function initViveInterface(globals){
if ( WEBVR.isAvailable() === false ) {
$status.html("WebVR not supported by this browser<br/>see <a href='https://webvr.info/' target='_blank'>webvr.info</a> for more information.");
$("#VRoptions").hide();
return;
// return;
// todo put this back!!
}
$status.html("No device connected.");
......@@ -99,7 +100,8 @@ function initViveInterface(globals){
examplesMenu.position.set(1.1, 2.3, -0.1);
examplesMenu.rotation.set(0, -Math.PI / 2, 0);
scene.add( examplesMenu );
examplesMenu.visible = false;
// examplesMenu.visible = false;
dat.GUIVR.enableMouse(camera);
var examples = {
Origami: {
......@@ -165,11 +167,8 @@ function initViveInterface(globals){
}
};
_.each(examples, function(object, key){
examplesMenu.add(examples, key, _.values(object)).onChange(function(val){
var dropdown = examplesMenu.add(examples, key, _.values(object)).onChange(function(val){
var index = _.values(object).indexOf(val);
if (index<0) {
console.warn("pattern not found: " + val);
......@@ -393,8 +392,8 @@ function initViveInterface(globals){
}
} else {
console.warn("bad controller ");
console.log(controllers[i]);
console.warn("bad controller");
// console.log(controllers[i]);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment