Skip to content

Commit

Permalink
Enhanced Tree Options appearance, esp at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
VashJuan committed Oct 2, 2024
1 parent 802a3d2 commit f8fe651
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion themes/eoconline/layouts/OrgChart/arc-tree.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ body {
#fontSizeValue {
width: 2em;
display: inline-block;
background-color: rgb(255, 255, 255);
background-color: #eee;
border: #000 1px solid;
padding: 2px;
}

Expand Down
5 changes: 2 additions & 3 deletions themes/eoconline/layouts/OrgChart/arc-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@

<div>
<label title="Font size in em's" id="fontSizeLabel">
Font size: <span id="fontSizeValue">2</span> &nbsp;
Font size: <span id="fontSizeValue"></span> &nbsp;

<input type="range" value="2.5" step="0.5" min="0.5" max="5" id="fontSize" list="steplist" oninput="document.querySelector('#fontSizeValue').textContent = this.value" />
<input type="range" step="0.5" min="0.5" value="1.5" max="5" id="fontSize" list="steplist" onchange="setFontSize(this)" />
<datalist id="steplist">
<option>0.5</option>
<option>1.0</option>
<option>2.0</option>
<option>3.0</option>
Expand Down
19 changes: 13 additions & 6 deletions themes/eoconline/layouts/OrgChart/arc-tree.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
let fontSize = document.querySelector(".tree").style.fontSize;
setFontSize(fontSize);
let uniqueID = 0;


document.querySelector("#fontSize").addEventListener("input", (e) => { setFontSize(e.target); });
document.querySelector("#fontSize").addEventListener('keyup', (event) => {
Expand All @@ -14,13 +12,22 @@ document.querySelector("#fontSize").addEventListener('keyup', (event) => {
}
});

//document.querySelector("#fontSize").value = 3.5;

document.addEventListener("DOMContentLoaded", function () {
//console.log("Document loaded");
setFontSize(document.querySelector("#fontSize"));
});

function setFontSize(el) {
fontSize = el.value;
if (!isNumber(fontSize) || fontSize < 0.5) {
//console.log("Setting font size to: " + el.value);
let fontSize = el.value;
if (!isNumber(fontSize) || fontSize < 0.5 || fontSize > 5) {
fontSize = 1;
}
document.querySelector(".tree").style.fontSize = fontSize + 'em';
document.querySelector("#fontSizeValue").innerHTML = fontSize;
document.querySelector("#fontSize").value = fontSize;
}

function isNumber(n) {
Expand Down Expand Up @@ -66,7 +73,7 @@ jsonObj =
]
};

traverse(jsonObj);
//traverse(jsonObj);
buildTree(jsonObj, document.getElementById('unorderedList'));
var listItemHTML = "";
var listLog = "";
Expand Down

0 comments on commit f8fe651

Please sign in to comment.