Skip to content

Commit

Permalink
fix(build/3d): use canonical tab names to avoid cluttering the tab tray
Browse files Browse the repository at this point in the history
  • Loading branch information
mwfarb committed Apr 27, 2023
1 parent bcd2c59 commit a7ab807
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ window.addEventListener('onauth', async function (e) {
// load namespace from defaults or local storage, if they exist; prefer url parameter, if given
let url = new URL(window.location.href);
let sceneParam = url.searchParams.get('scene');
let focusObjectId = url.searchParams.get('object_id');
let focusObjectId = url.searchParams.get('objectId');
let ns, s;
if (sceneParam) {
let sn = sceneParam.split('/');
Expand Down
8 changes: 4 additions & 4 deletions build/persist-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ export async function populateObjectList(
li.appendChild(editspan3d);

editspan3d.onclick = function() {
if (sceneObjs[i].type == 'scene-options'){
window.location.href = `/${scene}?build3d=1&object_id=env`;
}else{
window.location.href = `/${scene}?build3d=1&object_id=${sceneObjs[i].object_id}`;
if (sceneObjs[i].type == 'scene-options') {
window.open(`/${scene}?build3d=1&objectId=env`, 'Arena3dEditor');
} else {
window.open(`/${scene}?build3d=1&objectId=${sceneObjs[i].object_id}`, 'Arena3dEditor');
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/arena.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class Arena {
*/
loadArenaInspector() {
const sceneEl = document.querySelector('a-scene');
const object_id = ARENAUtils.getUrlParam('object_id', '');
const object_id = ARENAUtils.getUrlParam('objectId', '');
let el;
if (object_id) {
el = document.getElementById(object_id); // requested id
Expand All @@ -386,7 +386,7 @@ export class Arena {
// remove the build3d a-frame inspector
let url = new URL(window.location.href);
url.searchParams.delete('build3d');
url.searchParams.delete('object_id');
url.searchParams.delete('objectId');
window.parent.window.history.pushState({
path: url.href
}, '', decodeURIComponent(url.href));
Expand Down
2 changes: 1 addition & 1 deletion src/components/build-watch-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ AFRAME.registerComponent('build-watch-object', {
}
// quick setting for user to edit in the build page
if (this.data.openJsonEditor) {
window.open(`/build/?scene=${ARENA.namespacedScene}&object_id=${this.el.id}`, '_blank');
window.open(`/build/?scene=${ARENA.namespacedScene}&objectId=${this.el.id}`, 'ArenaJsonEditor');
this.data.openJsonEditor = false; // restore
}
},
Expand Down
5 changes: 3 additions & 2 deletions src/ui/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ AFRAME.registerComponent('arena-side-menu-ui', {
formDiv.appendChild(pagesDiv);

const edit = document.createElement('a');

edit.href = `/build/?scene=${ARENA.namespacedScene}`;
edit.target = '_blank';
edit.target = 'ArenaJsonEditor';
edit.rel = 'noopener noreferrer';
edit.innerHTML = 'Json Editor';
edit.title = 'Open the JSON Scene Editor for this scene in a new page';
Expand All @@ -266,7 +267,7 @@ AFRAME.registerComponent('arena-side-menu-ui', {
if (ARENA.isUserSceneWriter()) { // add permissions link
const edit3d = document.createElement('a');
edit3d.href = `/${ARENA.namespacedScene}?build3d=1`;
edit3d.target = '_blank';
edit3d.target = 'Arena3dEditor';
edit3d.rel = 'noopener noreferrer';
edit3d.innerHTML = '3D Editor';
edit3d.title = 'Open the 3D Scene Editor for this scene in a new page (editors only)';
Expand Down

1 comment on commit a7ab807

@mwfarb
Copy link
Contributor Author

@mwfarb mwfarb commented on a7ab807 Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hi-liang! Works great!

Please sign in to comment.