Add close button
This commit is contained in:
parent
eed292b707
commit
0a7063a478
6
front/dist/index.html
vendored
6
front/dist/index.html
vendored
@ -72,7 +72,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="cowebsite" class="cowebsite hidden"></div>
|
<div id="cowebsite" class="cowebsite hidden">
|
||||||
|
<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="audio-playing">
|
<div class="audio-playing">
|
||||||
<img src="/resources/logos/megaphone.svg"/>
|
<img src="/resources/logos/megaphone.svg"/>
|
||||||
</div>
|
</div>
|
||||||
|
17
front/dist/resources/style/style.css
vendored
17
front/dist/resources/style/style.css
vendored
@ -274,6 +274,23 @@ body {
|
|||||||
#cowebsite.hidden {
|
#cowebsite.hidden {
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#cowebsite .close-btn{
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: -100px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
animation: right .2s ease;
|
||||||
|
}
|
||||||
|
#cowebsite .close-btn img{
|
||||||
|
height: 15px;
|
||||||
|
right: 15px;
|
||||||
|
}
|
||||||
|
#cowebsite:hover .close-btn{
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (max-aspect-ratio: 1/1) {
|
@media (max-aspect-ratio: 1/1) {
|
||||||
.game-overlay {
|
.game-overlay {
|
||||||
|
@ -1196,12 +1196,19 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
jitsiFactory.start(roomName, gameManager.getPlayerName(), jwt);
|
jitsiFactory.start(roomName, gameManager.getPlayerName(), jwt);
|
||||||
this.connection.setSilent(true);
|
this.connection.setSilent(true);
|
||||||
mediaManager.hideGameOverlay();
|
mediaManager.hideGameOverlay();
|
||||||
|
|
||||||
|
//permit to stop jitsi when user close iframe
|
||||||
|
mediaManager.addTriggerCloseJitsiFrameButton('close-jisi',() => {
|
||||||
|
this.stopJitsi();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public stopJitsi(): void {
|
public stopJitsi(): void {
|
||||||
this.connection.setSilent(false);
|
this.connection.setSilent(false);
|
||||||
jitsiFactory.stop();
|
jitsiFactory.stop();
|
||||||
mediaManager.showGameOverlay();
|
mediaManager.showGameOverlay();
|
||||||
|
|
||||||
|
mediaManager.removeTriggerCloseJitsiFrameButton('close-jisi');
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadSpritesheet(name: string, url: string): Promise<void> {
|
private loadSpritesheet(name: string, url: string): Promise<void> {
|
||||||
|
@ -44,7 +44,9 @@ class CoWebsiteManager {
|
|||||||
|
|
||||||
public loadCoWebsite(url: string): void {
|
public loadCoWebsite(url: string): void {
|
||||||
this.load();
|
this.load();
|
||||||
this.cowebsiteDiv.innerHTML = '';
|
this.cowebsiteDiv.innerHTML = `<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg">
|
||||||
|
</button>`;
|
||||||
|
|
||||||
const iframe = document.createElement('iframe');
|
const iframe = document.createElement('iframe');
|
||||||
iframe.id = 'cowebsite-iframe';
|
iframe.id = 'cowebsite-iframe';
|
||||||
@ -83,7 +85,9 @@ class CoWebsiteManager {
|
|||||||
this.close();
|
this.close();
|
||||||
this.fire();
|
this.fire();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.cowebsiteDiv.innerHTML = '';
|
this.cowebsiteDiv.innerHTML = `<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg">
|
||||||
|
</button>`;
|
||||||
resolve();
|
resolve();
|
||||||
}, animationTime)
|
}, animationTime)
|
||||||
}));
|
}));
|
||||||
|
@ -40,6 +40,8 @@ export class MediaManager {
|
|||||||
|
|
||||||
private hasCamera = true;
|
private hasCamera = true;
|
||||||
|
|
||||||
|
private triggerCloseJistiFrame : Map<String, Function> = new Map<String, Function>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
this.myCamVideo = this.getElementByIdOrFail<HTMLVideoElement>('myCamVideo');
|
this.myCamVideo = this.getElementByIdOrFail<HTMLVideoElement>('myCamVideo');
|
||||||
@ -130,11 +132,23 @@ export class MediaManager {
|
|||||||
public showGameOverlay(){
|
public showGameOverlay(){
|
||||||
const gameOverlay = this.getElementByIdOrFail('game-overlay');
|
const gameOverlay = this.getElementByIdOrFail('game-overlay');
|
||||||
gameOverlay.classList.add('active');
|
gameOverlay.classList.add('active');
|
||||||
|
|
||||||
|
const buttonCloseFrame = HtmlUtils.getElementByIdOrFail('cowebsite-close');
|
||||||
|
const functionTrigger = () => {
|
||||||
|
this.triggerCloseJitsiFrameButton();
|
||||||
|
}
|
||||||
|
buttonCloseFrame.removeEventListener('click', functionTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public hideGameOverlay(){
|
public hideGameOverlay(){
|
||||||
const gameOverlay = this.getElementByIdOrFail('game-overlay');
|
const gameOverlay = this.getElementByIdOrFail('game-overlay');
|
||||||
gameOverlay.classList.remove('active');
|
gameOverlay.classList.remove('active');
|
||||||
|
|
||||||
|
const buttonCloseFrame = HtmlUtils.getElementByIdOrFail('cowebsite-close');
|
||||||
|
const functionTrigger = () => {
|
||||||
|
this.triggerCloseJitsiFrameButton();
|
||||||
|
}
|
||||||
|
buttonCloseFrame.addEventListener('click', functionTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enableCamera() {
|
public enableCamera() {
|
||||||
@ -582,6 +596,19 @@ export class MediaManager {
|
|||||||
mainContainer.appendChild(divReport);
|
mainContainer.appendChild(divReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
||||||
|
this.triggerCloseJistiFrame.set(id, Function);
|
||||||
|
}
|
||||||
|
|
||||||
|
public removeTriggerCloseJitsiFrameButton(id: String){
|
||||||
|
this.triggerCloseJistiFrame.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private triggerCloseJitsiFrameButton(): void {
|
||||||
|
for (const callback of this.triggerCloseJistiFrame.values()) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user