Skip to content

Commit ea01283

Browse files
authored
Merge pull request #30 from CEGRcode/dev
Merge from dev branch
2 parents f087bdc + 0cc651e commit ea01283

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
<div class="row" style="padding-top:5px;">
2121
<div class="col-4">
2222
<div class="row">
23-
<div class="col">
24-
<input type="button" id="json-button" value="Import JSON">
23+
<div class="col-8">
24+
<input type="button" id="json-button" value="Import JSON session">
2525
<input type="file" id="json-loader" style="display:none;">
2626
<script src="js/events/import_json_button.js"></script>
27-
<input type="button" id="json-download" value="Export JSON">
27+
<input type="button" id="json-download" value="Export session as JSON">
2828
<script src="js/events/export_json_button.js"></script>
29-
<input type="button" id="tsv-download" value="Export TSV">
29+
<input type="button" id="tsv-download" value="Export metadata as TSV">
3030
<script src="js/events/export_tsv_button.js"></script>
3131
</div>
32-
<div class="col text-right">
33-
<input type="button" id="load-composite-button" value="Load composite file">
32+
<div class="col-4 text-right">
33+
<input type="button" id="load-composite-button" value="Load multi-composite">
3434
<input type="file" id="composite-loader" style="display:none;">
3535
<script src="js/events/load_composite_button.js"></script>
3636
</div>

js/widgets/main_plot.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ $(function() {
804804
},
805805

806806
import: function(data) {
807+
// Import data from JSON object
807808
if ("combined" in data) {
808809
this.toggle_combined(data.combined, false);
809810
$("#axes-input").axes_input("toggle_combined", data.combined);
@@ -853,6 +854,7 @@ $(function() {
853854
},
854855

855856
reset: function() {
857+
// Reset plot to default settings
856858
this.combined = false;
857859
this.locked = false;
858860
this.title = "Composite Plot";
@@ -868,6 +870,7 @@ $(function() {
868870
.property("disabled", false);
869871
$("#settings-dropdown").settings_dropdown("set_value", "none");
870872

873+
// Clear plot
871874
this._elements.main_plot.selectAll("*").remove();
872875
this._elements.composites = [];
873876
this._elements.legend_items = [];
@@ -889,6 +892,7 @@ $(function() {
889892
},
890893

891894
_create: function() {
895+
// Create text label
892896
let label_group = d3.select(this.element.context);
893897
this.text_label = label_group.append("text")
894898
.attr("x", this.options.x)
@@ -905,6 +909,7 @@ $(function() {
905909

906910
toggle_input: function(ev) {
907911
let label_group = d3.select(this.element.context);
912+
// Hide text label and create input box
908913
this.text_label.style("display", "none");
909914
this.foreign_object = label_group.append("foreignObject")
910915
.attr("x", this.options.x - 200)
@@ -931,12 +936,17 @@ $(function() {
931936
},
932937

933938
enter_input: function(ev) {
939+
// ev.keyCode === 13 is the enter/return key
934940
if (ev.keyCode === 13) {
941+
// Remove input box
935942
this.foreign_object.remove();
936943

944+
// TODO: User can still submit a whitespace string, making the label uneditable
937945
if (ev.target.value.trim().length !== 0) {
946+
// Change the text label if the input field is not empty
938947
this.change_label(ev.target.value)
939948
} else {
949+
// Otherwise, reset the text label to the original text
940950
this.text_label.style("display", null)
941951
};
942952

@@ -946,8 +956,10 @@ $(function() {
946956

947957
change_label: function(new_label) {
948958
this.options.text = new_label;
959+
// Show text label and change text
949960
this.text_label
950961
.style("display", null)
962+
// If the label is the y-axis label, add the y-axis suffix
951963
.html(new_label + (this.options.label === "ylabel" ? $("#main-plot").main_plot("instance")._elements.ylabel_suffix : ""));
952964

953965
$("#main-plot").main_plot("change_label", this.options.label, new_label)

0 commit comments

Comments
 (0)