Skip to content

Commit 0f4091d

Browse files
committed
swap colormode for highlight leaves toggle
1 parent 3693658 commit 0f4091d

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

app/index.html

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,10 @@ <h5 class="mb-0">
386386
data-parent="#accordion"
387387
>
388388
<div class="card-body">
389-
<div class="form-group">
389+
<!-- <div class="form-group">
390390
<label for="colorMode">Color Mode</label>
391391
<select id="colorMode" class="form-control form-control-sm skip"></select>
392-
</div>
392+
</div> -->
393393
<div class="form-group">
394394
<label>Default Color</label>
395395
<input
@@ -408,6 +408,13 @@ <h5 class="mb-0">
408408
value="#feb640"
409409
>
410410
</div>
411+
<div class="form-group">
412+
<div class="switch">
413+
<label>
414+
<input id="highlightLeaves" type="checkbox" class="skip"> Highlight Leaves
415+
</label>
416+
</div>
417+
</div>
411418
</div>
412419
</div>
413420
</div>
@@ -676,7 +683,7 @@ <h5 class="modal-title" id="exportModalLabel">Export</h5>
676683
type: d3.select("#type").node().value,
677684
colorOptions:
678685
{
679-
colorMode: d3.select("#colorMode").node().value,
686+
colorMode: "none",
680687
defaultColor: d3.select("#defaultColor").node().value,
681688
highlightColor: d3.select("#highlightColor").node().value,
682689
},
@@ -725,7 +732,7 @@ <h5 class="modal-title" id="exportModalLabel">Export</h5>
725732
tree.setAnimation(cached);
726733
});
727734

728-
d3.select("#colorMode").on("input", function() {
735+
/* d3.select("#colorMode").on("input", function() {
729736
// this could prove annoying, but ill leave it for now
730737
if (this.value === "list") {
731738
d3.select("#defaultColor").node().value = "#243127";
@@ -739,22 +746,41 @@ <h5 class="modal-title" id="exportModalLabel">Export</h5>
739746
highlightColor: d3.select("#highlightColor").node().value
740747
});
741748
});
742-
749+
*/
743750
d3.select("#defaultColor").on("input", function() {
744751
tree.setColorOptions({
745-
colorMode: d3.select("#colorMode").node().value,
752+
colorMode: d3.select("#highlightLeaves").node().value ? "list" : "none",
746753
defaultColor: this.value,
747-
highlightColor: d3.select("#highlightColor").node().value
754+
highlightColor: d3.select("#highlightColor").node().value,
755+
nodeList: []
748756
});
749757
});
750758

751759
d3.select("#highlightColor").on("input", function() {
752760
tree.setColorOptions({
753-
colorMode: d3.select("#colorMode").node().value,
761+
colorMode: d3.select("#highlightLeaves").node().value ? "list" : "none",
754762
defaultColor: d3.select("#defaultColor").node().value,
755-
highlightColor: this.value
763+
highlightColor: this.value,
764+
nodeList: []
756765
});
757766
});
767+
768+
d3.select("#highlightLeaves").on("input", function() {
769+
if (this.value) {
770+
tree.setColorOptions({
771+
colorMode: "list",
772+
defaultColor: d3.select("#defaultColor").node().value,
773+
highlightColor: d3.select("#highlightColor").node().value,
774+
nodeList: []
775+
})
776+
} else {
777+
tree.setColorOptions({
778+
colorMode: "none",
779+
defaultColor: d3.select("#defaultColor").node().value,
780+
highlightColor: d3.select("#highlightColor").node().value
781+
})
782+
}
783+
});
758784

759785
d3.select("#branchNodeSize").on("input", function() {
760786
tree.eachBranchNode((node, data) => {

0 commit comments

Comments
 (0)