diff --git a/assets/js/components/calls/callWindow.js b/assets/js/components/calls/callWindow.js index 9a0baf4e..c5016fa0 100644 --- a/assets/js/components/calls/callWindow.js +++ b/assets/js/components/calls/callWindow.js @@ -172,7 +172,13 @@ ComunicWeb.components.calls.callWindow = { } call.window.closeButton.addEventListener("click", function(){ - call.close(); + + //Check if the call is in full screen mode + if(IsFullScreen()) + RequestFullScreen(null) + else + call.close(); + }); @@ -346,6 +352,23 @@ ComunicWeb.components.calls.callWindow = { /** * Make the call window draggable */ + + function checkWindowMinPosition(){ + + if(window.innerHeight < callContainer.style.top.replace("px", "")) + callContainer.style.top = "0px"; + + if(window.innerWidth < callContainer.style.left.replace("px", "")) + callContainer.style.left = "0px"; + + if(callContainer.style.left.replace("px", "") < 0) + callContainer.style.left = "0px"; + + if(callContainer.style.top.replace("px", "") < 49) + callContainer.style.top = "50px"; + } + + //Enable dragging { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; @@ -353,6 +376,10 @@ ComunicWeb.components.calls.callWindow = { e = e || window.event; e.preventDefault(); + //Check if the window is currently in full screen mode + if(IsFullScreen()) + return; + //get the mouse cursor position at startup pos3 = e.clientX; pos4 = e.clientY; @@ -373,6 +400,8 @@ ComunicWeb.components.calls.callWindow = { //Set element new position callContainer.style.top = (callContainer.offsetTop - pos2) + "px"; callContainer.style.left = (callContainer.offsetLeft - pos1) + "px"; + + checkWindowMinPosition(); } function closeDragElement(){ @@ -383,6 +412,10 @@ ComunicWeb.components.calls.callWindow = { } } + window.addEventListener("resize", function(){ + checkWindowMinPosition(); + }); +