Cannot rezise main cowebsite when fullscreen is enable
This commit is contained in:
parent
5e11cccdf9
commit
812485f863
@ -15,6 +15,7 @@ const cowebsiteContainerDomId = "cowebsite-container"; // the id of the whole co
|
|||||||
const cowebsiteMainDomId = "cowebsite-slot-0"; // the id of the parent div of the iframe.
|
const cowebsiteMainDomId = "cowebsite-slot-0"; // the id of the parent div of the iframe.
|
||||||
const cowebsiteBufferDomId = "cowebsite-buffer"; // the id of the container who contains cowebsite iframes.
|
const cowebsiteBufferDomId = "cowebsite-buffer"; // the id of the container who contains cowebsite iframes.
|
||||||
const cowebsiteAsideDomId = "cowebsite-aside"; // the id of the parent div of the iframe.
|
const cowebsiteAsideDomId = "cowebsite-aside"; // the id of the parent div of the iframe.
|
||||||
|
const cowebsiteAsideHolderDomId = "cowebsite-aside-holder";
|
||||||
const cowebsiteSubIconsDomId = "cowebsite-sub-icons";
|
const cowebsiteSubIconsDomId = "cowebsite-sub-icons";
|
||||||
export const cowebsiteCloseButtonId = "cowebsite-close";
|
export const cowebsiteCloseButtonId = "cowebsite-close";
|
||||||
const cowebsiteFullScreenButtonId = "cowebsite-fullscreen";
|
const cowebsiteFullScreenButtonId = "cowebsite-fullscreen";
|
||||||
@ -54,6 +55,7 @@ class CoWebsiteManager {
|
|||||||
private cowebsiteMainDom: HTMLDivElement;
|
private cowebsiteMainDom: HTMLDivElement;
|
||||||
private cowebsiteBufferDom: HTMLDivElement;
|
private cowebsiteBufferDom: HTMLDivElement;
|
||||||
private cowebsiteAsideDom: HTMLDivElement;
|
private cowebsiteAsideDom: HTMLDivElement;
|
||||||
|
private cowebsiteAsideHolderDom: HTMLDivElement;
|
||||||
private cowebsiteSubIconsDom: HTMLDivElement;
|
private cowebsiteSubIconsDom: HTMLDivElement;
|
||||||
private previousTouchMoveCoordinates: TouchMoveCoordinates | null = null; //only use on touchscreens to track touch movement
|
private previousTouchMoveCoordinates: TouchMoveCoordinates | null = null; //only use on touchscreens to track touch movement
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ class CoWebsiteManager {
|
|||||||
this.cowebsiteMainDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteMainDomId);
|
this.cowebsiteMainDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteMainDomId);
|
||||||
this.cowebsiteBufferDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteBufferDomId);
|
this.cowebsiteBufferDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteBufferDomId);
|
||||||
this.cowebsiteAsideDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideDomId);
|
this.cowebsiteAsideDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideDomId);
|
||||||
|
this.cowebsiteAsideHolderDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideHolderDomId);
|
||||||
this.cowebsiteSubIconsDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteSubIconsDomId);
|
this.cowebsiteSubIconsDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteSubIconsDomId);
|
||||||
this.initResizeListeners();
|
this.initResizeListeners();
|
||||||
|
|
||||||
@ -188,21 +191,23 @@ class CoWebsiteManager {
|
|||||||
this.fire();
|
this.fire();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cowebsiteAsideDom.addEventListener("mousedown", (event) => {
|
this.cowebsiteAsideHolderDom.addEventListener("mousedown", (event) => {
|
||||||
|
if (this.isFullScreen) return;
|
||||||
this.cowebsiteMainDom.style.display = "none";
|
this.cowebsiteMainDom.style.display = "none";
|
||||||
this.resizing = true;
|
this.resizing = true;
|
||||||
document.addEventListener("mousemove", movecallback);
|
document.addEventListener("mousemove", movecallback);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("mouseup", (event) => {
|
document.addEventListener("mouseup", (event) => {
|
||||||
if (!this.resizing) return;
|
if (!this.resizing || this.isFullScreen) return;
|
||||||
document.removeEventListener("mousemove", movecallback);
|
document.removeEventListener("mousemove", movecallback);
|
||||||
this.cowebsiteMainDom.style.display = "block";
|
this.cowebsiteMainDom.style.display = "block";
|
||||||
this.resizing = false;
|
this.resizing = false;
|
||||||
this.cowebsiteMainDom.style.display = "flex";
|
this.cowebsiteMainDom.style.display = "flex";
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cowebsiteAsideDom.addEventListener("touchstart", (event) => {
|
this.cowebsiteAsideHolderDom.addEventListener("touchstart", (event) => {
|
||||||
|
if (this.isFullScreen) return;
|
||||||
this.cowebsiteMainDom.style.display = "none";
|
this.cowebsiteMainDom.style.display = "none";
|
||||||
this.resizing = true;
|
this.resizing = true;
|
||||||
const touchEvent = event.touches[0];
|
const touchEvent = event.touches[0];
|
||||||
@ -211,7 +216,7 @@ class CoWebsiteManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("touchend", (event) => {
|
document.addEventListener("touchend", (event) => {
|
||||||
if (!this.resizing) return;
|
if (!this.resizing || this.isFullScreen) return;
|
||||||
this.previousTouchMoveCoordinates = null;
|
this.previousTouchMoveCoordinates = null;
|
||||||
document.removeEventListener("touchmove", movecallback);
|
document.removeEventListener("touchmove", movecallback);
|
||||||
this.cowebsiteMainDom.style.display = "block";
|
this.cowebsiteMainDom.style.display = "block";
|
||||||
@ -640,17 +645,22 @@ class CoWebsiteManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fullscreen(): void {
|
private fullscreen(): void {
|
||||||
|
const openFullscreenImage = HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId);
|
||||||
|
const closeFullScreenImage = HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId);
|
||||||
|
|
||||||
if (this.isFullScreen) {
|
if (this.isFullScreen) {
|
||||||
this.resetStyleMain();
|
this.resetStyleMain();
|
||||||
this.fire();
|
this.fire();
|
||||||
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId).style.display = "inline";
|
this.cowebsiteAsideHolderDom.style.visibility = "visible";
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId).style.display = "none";
|
openFullscreenImage.style.display = "inline";
|
||||||
|
closeFullScreenImage.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
this.verticalMode ? (this.height = window.innerHeight) : (this.width = window.innerWidth);
|
this.verticalMode ? (this.height = window.innerHeight) : (this.width = window.innerWidth);
|
||||||
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId).style.display = "none";
|
this.cowebsiteAsideHolderDom.style.visibility = "hidden";
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId).style.display = "inline";
|
openFullscreenImage.style.display = "none";
|
||||||
|
closeFullScreenImage.style.display = "inline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
#cowebsite-aside-holder {
|
#cowebsite-aside-holder {
|
||||||
pointer-events: none;
|
background: gray;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
img {
|
img {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,12 +207,14 @@
|
|||||||
|
|
||||||
aside {
|
aside {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
cursor: ew-resize;
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
cursor: ew-resize;
|
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-aside-holder {
|
||||||
|
cursor: ew-resize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user