mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Made call window draggable
This commit is contained in:
@ -329,6 +329,50 @@ ComunicWeb.components.calls.callWindow = {
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Make the call window draggable
|
||||
*/
|
||||
{
|
||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
|
||||
call.window.title.onmousedown = function(e){
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
|
||||
//get the mouse cursor position at startup
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
document.onmouseup = closeDragElement;
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
|
||||
function elementDrag(e){
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
|
||||
//Calculate new cursor position
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
|
||||
//Set element new position
|
||||
callContainer.style.top = (callContainer.offsetTop - pos2) + "px";
|
||||
callContainer.style.left = (callContainer.offsetLeft - pos1) + "px";
|
||||
}
|
||||
|
||||
function closeDragElement(){
|
||||
|
||||
//Stop moving when mouse button is released
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Load user media
|
||||
call.setLoadingMessage("Waiting for your microphone and camera...");
|
||||
|
||||
|
Reference in New Issue
Block a user