Window dragging fully implemented.
This commit is contained in:
parent
0b0fb1f13f
commit
92d098c8ca
5
7.css
5
7.css
@ -1647,7 +1647,8 @@ a:hover {
|
||||
|
||||
.window,
|
||||
.window:before {
|
||||
border-radius: var(--w7-w-bdr)
|
||||
border-radius: var(--w7-w-bdr);
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.window:before {
|
||||
@ -1668,7 +1669,7 @@ a:hover {
|
||||
border: 1px solid var(--w7-w-bd);
|
||||
box-shadow: 0 0 0 1px #fff9;
|
||||
margin: var(--w7-w-space);
|
||||
margin-top: 0
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.window-body.has-space {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<li>A Notepad</li>
|
||||
<li>Or even a File Explorer!</li>
|
||||
</ul>
|
||||
<div class="filler" style="height:100px;"></div>
|
||||
<div class="filler" style="min-height:100px;"></div>
|
||||
</div>
|
||||
<div class="status-bar">
|
||||
<p class="status-bar-field">Press F1 for help</p>
|
||||
@ -34,7 +34,7 @@
|
||||
<li>A Notepad</li>
|
||||
<li>Or even a File Explorer!</li>
|
||||
</ul>
|
||||
<div class="filler" style="height:100px;"></div>
|
||||
<div class="filler" style="min-height:100px;"></div>
|
||||
</div>
|
||||
<div class="status-bar">
|
||||
<p class="status-bar-field">Press F1 for help</p>
|
||||
@ -53,7 +53,7 @@
|
||||
<li>A Notepad</li>
|
||||
<li>Or even a File Explorer!</li>
|
||||
</ul>
|
||||
<div class="filler" style="height:100px;"></div>
|
||||
<div class="filler" style="min-height:100px;"></div>
|
||||
</div>
|
||||
<div class="status-bar">
|
||||
<p class="status-bar-field">Press F1 for help</p>
|
||||
|
||||
13
windows.js
13
windows.js
@ -41,6 +41,7 @@ function OpenWindow(windowName){
|
||||
newWindow.style.minWidth=256;
|
||||
newWindow.style.width=newWindow.style.minWidth;
|
||||
newWindow.style.zIndex=windowDepth++
|
||||
newWindow.style.minHeight=newWindow.getBoundingClientRect().height;
|
||||
}
|
||||
|
||||
function addListeners(){
|
||||
@ -93,6 +94,7 @@ function mouseDown(e){
|
||||
offY= e.clientY-parseInt(div.offsetTop);
|
||||
offX= e.clientX-parseInt(div.offsetLeft);
|
||||
rightSideX=parseInt(div.offsetLeft)+parseInt(div.style.width);
|
||||
bottomSideY=parseInt(div.offsetTop)+parseInt(div.style.height);
|
||||
window.addEventListener('mousemove', divMove, true);
|
||||
window.targetWindow=div;
|
||||
div.classList.add("active")
|
||||
@ -111,5 +113,16 @@ function divMove(e){
|
||||
div.style.left=(e.clientX-offX)+'px';
|
||||
div.style.width=rightSideX-parseInt(div.style.left);
|
||||
}
|
||||
if(side&Side.BOTTOM){
|
||||
div.style.height=e.clientY-parseInt(div.offsetTop);
|
||||
}
|
||||
if(side&Side.TOP){
|
||||
div.style.top=(e.clientY-offY)+'px';
|
||||
div.style.height=bottomSideY-parseInt(div.style.top);
|
||||
}
|
||||
for(let filler of div.getElementsByClassName("filler")){
|
||||
console.log(filler)
|
||||
filler.style.height=parseInt(div.style.height)-parseInt(div.style.minHeight)+parseInt(filler.style.minHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user