Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust popup cube to enclosure #160

Merged
merged 1 commit into from
Nov 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions examples/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
altspace.utilities.sync.connect(config).then(function(connection) {
sceneSync = altspace.utilities.behaviors.SceneSync(connection.instance, {
instantiators: {
'cube': createCube,
'sphere': createSphere,
'torus': createTorus
'cube': createCube,
'sphere': createSphere,
'torus': createTorus
},
ready: ready
});
Expand All @@ -30,12 +30,12 @@
icon: getFullUrl('favicon.png'),
hidden: true
}).then(function (_popup) {
// Save a reference to the popup so that we can open it when a user clicks
// Save a reference to the popup so that we can open it when a user clicks
// on any shape via the ShowPopup behavior.
popup = _popup;
});

// This example uses Firebase to communicate between the popup and the main app.
// This example uses Firebase to communicate between the popup and the main app.
// The form in the popup adds shapes to Firebase. When that happens, we instantiate the corresponding shape here.
connection.instance.child('things').on('child_added', function (snapshot) {
var thing = snapshot.val();
Expand All @@ -46,9 +46,11 @@

function ready(firstInstance) {
if (firstInstance) {
var popupShowCube = sceneSync.instantiate('cube', {
color: 'white',
position: {x: 0, y: -512, z: 0}
altspace.getEnclosure().then(function (enclosure) {
sceneSync.instantiate('cube', {
color: 'white',
position: {x: 0, y: -enclosure.innerHeight / 2, z: 0}
});
});
}
}
Expand All @@ -60,7 +62,7 @@
});
}
return { awake: awake };
};
}

function getFullUrl(path) {
var currPath = location.pathname;
Expand Down Expand Up @@ -95,7 +97,7 @@
altspace.utilities.behaviors.Object3DSync(),
ShowPopup()
);
if (options.user) {
if (options.user) {
var label = new THREE.Mesh(
new THREE.PlaneGeometry(100, 50),
new THREE.MeshBasicMaterial({
Expand Down