Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making tree box extandable vertically. #188

Merged
merged 12 commits into from
May 19, 2021
Merged
22 changes: 20 additions & 2 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,25 @@ a:before {
#tree-and-controls
{
position:relative;
height: 70vh !important;
height: 70vh;
min-height: 400px;
resize: vertical !important;
}
.resizer:hover
{
background-color: grey;
}
.resizer
{
background-color: #8884;
width: 100%;
height: 5px;
position: absolute;
right: 0;
bottom: 0;
cursor: row-resize;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}

.tree-controls{
Expand All @@ -128,7 +146,7 @@ a:before {
}
.tree-controls-right-bottom{
right:0px;
bottom:1em;
bottom:2em;
}
.tree-controls-right-top{
right:0px;
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ <h1 id="pageTitle">EDAM ontology</h1>
</div>
</div>
<div class="tooltip"></div>
</div>
<div id ="handle" class="resizer"></div>
</div>
</div>
<div class="col-xs-12 col-lg-4" id="edamAccordion">
<div id="history-separator" class="panel-separator temp">
Expand Down
22 changes: 22 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,28 @@ window.onload = function() {
}else{
browser.current_branch(branch);
}
var treeElement = document.getElementById("tree-and-controls");
treeElement.style.height = localStorage.getItem("tree-and-controls-height");
var resizer = document.getElementById("handle");
resizer.addEventListener("mousedown", initDrag, false);
var startY, startHeight;
function initDrag(e) {
startY = e.clientY;
startHeight = parseInt(
document.defaultView.getComputedStyle(treeElement).height,
10
);
document.documentElement.addEventListener("mousemove", doDrag, false);
document.documentElement.addEventListener("mouseup", stopDrag, false);
}
function doDrag(e) {
treeElement.style.height = startHeight + e.clientY - startY + "px";
}
function stopDrag(e) {
document.documentElement.removeEventListener("mousemove", doDrag, false);
document.documentElement.removeEventListener("mouseup", stopDrag, false);
localStorage.setItem("tree-and-controls-height", treeElement.style.height);
}
$("input[name='show-detail']").prop("checked" , (localStorage.getItem("show-detail")||"true") == "true");
$("input[name='show-community-usage']").prop("checked" , (localStorage.getItem("show-community-usage")||"false") == "true");
};