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

Small update for ShowRoom #804

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
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
Binary file added examples/assets/img/icons/code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 84 additions & 6 deletions examples/show_room.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@

app.addURLButton('./assets/img/icons/link.png');

const infoUI = document.createElement('div');
infoUI.id = 'root_InfoUI';
app.frame3DPlanar.domElementUI.appendChild(infoUI);

// HELP HTLM
const xhrHelpMarkdown = new XMLHttpRequest();
xhrHelpMarkdown.open('GET', './assets/md/help.md');
Expand All @@ -85,11 +89,42 @@
xhrHelpMarkdown.status >= 200 &&
xhrHelpMarkdown.status < 300
) {
const docHtml = document.createElement('div');
docHtml.innerHTML = new showdown.Converter()
const modal = document.createElement('div');
modal.classList.add('modal');
modal.hidden = true;
app.frame3DPlanar.domElementUI.appendChild(modal);

const container = document.createElement('div');
container.classList.add('container');
modal.appendChild(container);

const buttonClose = document.createElement('button');
buttonClose.innerText = 'Close';
container.appendChild(buttonClose);

const docHelpHtml = document.createElement('div');
docHelpHtml.innerHTML = new showdown.Converter()
.makeHtml(xhrHelpMarkdown.responseText)
.replace(/..\/img\//g, './assets/img/');
app.addCustomHtml('./assets/svg/help.svg', docHtml, 'Help');
docHelpHtml.title = 'Help';
container.appendChild(docHelpHtml);

const buttonHelp = document.createElement('a');
buttonHelp.title = 'help';
const iconHelp = document.createElement('img');
iconHelp.src = './assets/svg/help.svg';
buttonHelp.appendChild(iconHelp);

buttonClose.onclick = () => {
modal.hidden = true;
};
modal.addEventListener('click', (event) => {
if (event.target == modal) modal.hidden = true;
});
buttonHelp.addEventListener('click', () => {
modal.hidden = false;
});
infoUI.appendChild(buttonHelp);
}
};
xhrHelpMarkdown.send();
Expand All @@ -103,15 +138,58 @@
xhrAboutMarkdown.status >= 200 &&
xhrAboutMarkdown.status < 300
) {
const docHtml = document.createElement('div');
docHtml.innerHTML = new showdown.Converter()
const modal = document.createElement('div');
modal.classList.add('modal');
modal.hidden = true;
app.frame3DPlanar.domElementUI.appendChild(modal);

const container = document.createElement('div');
container.classList.add('container');
modal.appendChild(container);

const buttonClose = document.createElement('button');
buttonClose.innerText = 'Close';
container.appendChild(buttonClose);

const docAboutHtml = document.createElement('div');
docAboutHtml.innerHTML = new showdown.Converter()
.makeHtml(xhrAboutMarkdown.responseText)
.replace(/..\/img\//g, './assets/img/');
app.addCustomHtml('./assets/svg/about.svg', docHtml, 'About');
docAboutHtml.title = 'About';
container.appendChild(docAboutHtml);

const buttonAbout = document.createElement('a');
buttonAbout.title = 'about';
const iconAbout = document.createElement('img');
iconAbout.src = './assets/svg/about.svg';
buttonAbout.appendChild(iconAbout);

buttonClose.onclick = () => {
modal.hidden = true;
};
modal.addEventListener('click', (event) => {
if (event.target == modal) modal.hidden = true;
});
buttonAbout.addEventListener('click', () => {
modal.hidden = false;
});
infoUI.appendChild(buttonAbout);
}
};
xhrAboutMarkdown.send();

// CODE
const buttonCode = document.createElement('a');
buttonCode.title = 'Access to code';
const iconCode = document.createElement('img');
iconCode.src = './assets/img/icons/code.png';
buttonCode.appendChild(iconCode);
buttonCode.href =
'https://github.com/VCityTeam/UD-Viz/blob/master/examples/show_room.html';
buttonCode.target = '_blank';
infoUI.appendChild(buttonCode);

// WIDGETS
app.addWidgetGeocoding(
configs['geocoding_server'],
'./assets/svg/geocoding.svg'
Expand Down
15 changes: 14 additions & 1 deletion packages/show_room/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export class ShowRoom {
layer: null,
};
this.frame3DPlanar.domElement.onclick = (event) => {
if (checkParentChild(event.target, this.frame3DPlanar.domElementUI)) {
return;
}
if (contextSelection.feature) {
contextSelection.feature.userData.selectedColor = null;
contextSelection.layer.updateStyle();
Expand Down Expand Up @@ -277,6 +280,8 @@ export class ShowRoom {
);
}
if (configs.baseMap) {
// Add a WMS imagery layer

this.frame3DPlanar.itownsView.addLayer(
new itowns.ColorLayer(configs.baseMap['name'], {
updateStrategy: {
Expand Down Expand Up @@ -412,7 +417,7 @@ export class ShowRoom {
// url camera matrix button
const urlCameraMatrixButton = document.createElement('img');
urlCameraMatrixButton.src = pathIcon;
urlCameraMatrixButton.title = 'Camera Position Url';
urlCameraMatrixButton.title = 'Copy Camera Position Url';
this.menuSideBar.appendChild(urlCameraMatrixButton);

urlCameraMatrixButton.onclick = () => {
Expand All @@ -437,6 +442,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget Geocoding';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand Down Expand Up @@ -581,6 +587,7 @@ export class ShowRoom {
// PLUG WITH SIDEBAR BUTTON
const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget SMDB';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand Down Expand Up @@ -629,6 +636,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget Guided Tour';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand Down Expand Up @@ -657,6 +665,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget Camera Positioner';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand All @@ -683,6 +692,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget LayerChoice';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand Down Expand Up @@ -710,6 +720,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget SlideShow';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand Down Expand Up @@ -739,6 +750,7 @@ export class ShowRoom {

const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = 'Widget Sparql';
this.menuSideBar.appendChild(sideBarButton);

sideBarButton.onclick = () => {
Expand All @@ -760,6 +772,7 @@ export class ShowRoom {
addCustomHtml(pathIcon, customHtml, label) {
const sideBarButton = document.createElement('img');
sideBarButton.src = pathIcon;
sideBarButton.title = label;
this.menuSideBar.appendChild(sideBarButton);
sideBarButton.onclick = () => {
if (customHtml.parentElement) {
Expand Down
59 changes: 59 additions & 0 deletions packages/show_room/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,65 @@
margin: 5px 10px 5px 5px;
}

/*********************************** Info UI */

#root_InfoUI {
position: fixed;
left: var(--sidebar-widget-sidebar-width);
bottom: 0px;
z-index: 3;
display: flex;
margin-left: 10px;
}

#root_InfoUI > a {
display: block;
background-color: #aebbc2;
border-radius: 20px;
width: 40px;
height: 40px;
margin: 2px;
}

#root_InfoUI > a:hover {
background-color: #000000;
cursor: pointer;
}

.container {
margin: 9rem;
max-width: 100vw;
overflow: scroll;
background: whitesmoke;
padding: 2rem;
}

.container img {
max-height: 50vh;
max-width: 100%;
display: block;
margin: 0 auto;
}

.container > button {
width: 100%;
padding: 10px;
cursor: pointer;
}

.modal {
position: fixed;
top: 0;
left: 0;
z-index: 1050;
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
outline: 0;
background-color: #83838379;
}

/*********************************** AUTHENTIFICATION */

#_sidebar_widget_profile {
Expand Down
Loading