Skip to content

Commit

Permalink
Merge pull request #150 from UMN-LATIS/Bug-Fixes-RWL-TextSize
Browse files Browse the repository at this point in the history
Bug Fixes 2/7/24
  • Loading branch information
cmcfadden authored Feb 7, 2024
2 parents b2e424e + f19e1bb commit fee4a3e
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 71 deletions.
36 changes: 27 additions & 9 deletions Leaflet.DataAccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,11 +654,12 @@ function Download(Inte) {

let name = this.constructNameRWL(Inte.treering.meta.assetName);
let year = dat.tw.x[0];
let yearStr = this.formatYearRWL(year);
let stopMarker = " -9999";

let outTWStr = name + dat.tw.x[0] + this.formatDataPointRWL(dat.tw.y[0]);
let outTWStr = name + yearStr + this.formatDataPointRWL(dat.tw.y[0]);
// If data begins on a year ending in '9', begin newline immediately.
if ((year + 1) % 10 == 0) outTWStr += "\n" + name + (year + 1);;
if ((year + 1) % 10 == 0) outTWStr += "\n" + name + this.formatYearRWL(year + 1);;

let outEWStr = "";
let outLWStr = "";
Expand All @@ -667,11 +668,14 @@ function Download(Inte) {
let yearEW = dat.ew.x[0];
let yearLW = dat.lw.x[0];

outEWStr = name + yearEW + this.formatDataPointRWL(dat.ew.y[0]);
outLWStr = name + yearLW + this.formatDataPointRWL(dat.lw.y[0]);
let yearEWStr = this.formatYearRWL(yearEW);
let yearLWStr = this.formatYearRWL(yearLW);

if ((yearEW + 1) % 10 == 0) outEWStr += "\n" + name + (yearEW + 1);;
if ((yearLW + 1) % 10 == 0) outLWStr += "\n" + name + (yearLW + 1);;
outEWStr = name + yearEWStr + this.formatDataPointRWL(dat.ew.y[0]);
outLWStr = name + yearLWStr + this.formatDataPointRWL(dat.lw.y[0]);

if ((yearEW + 1) % 10 == 0) outEWStr += "\n" + name + this.formatYearRWL(yearEW + 1);;
if ((yearLW + 1) % 10 == 0) outLWStr += "\n" + name + this.formatYearRWL(yearLW + 1);;
}

for (let i = 1; i < dat.tw.x.length; i++) {
Expand All @@ -684,11 +688,12 @@ function Download(Inte) {
}

if ((year + 1) % 10 == 0) {
outTWStr += "\n" + name + (year + 1);
yearStr = this.formatYearRWL(year + 1);
outTWStr += "\n" + name + yearStr;

if (dat?.ew) {
outEWStr += "\n" + name + (year + 1);
outLWStr += "\n" + name + (year + 1);
outEWStr += "\n" + name + yearStr;
outLWStr += "\n" + name + yearStr;
}
}
}
Expand All @@ -702,6 +707,19 @@ function Download(Inte) {
else this.zipFiles("rwl", "txt", outTWStr);
}

/**
* Converts year value into RWL format.
* @function
*
* @param {integer} year - Year value.
*/
Download.prototype.formatYearRWL = function(year) {
year = String(year);
year = " ".repeat(4 - year.length) + year;

return year;
}

/**
* Converts measurement points into RWL format.
* @function
Expand Down
16 changes: 8 additions & 8 deletions _site/leaflet-treering.js
Original file line number Diff line number Diff line change
Expand Up @@ -1905,14 +1905,14 @@ function AnnotationAsset(Lt) {
this.annotationIcon = this.markers[this.index];
};

let size = this.annotationDialogSize || [284, 265];
let size = this.annotationDialogSize || [310, 265];
let anchor = this.annotationDialogAnchor || [50, 5];

// handlebars from template.html
let content = document.getElementById("annotation-dialog-window-template").innerHTML;

this.dialogAnnotationWindow = L.control.dialog({
'minSize': [284, 265],
'minSize': [310, 265],
'maxSize': [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
'size': size,
'anchor': anchor,
Expand Down Expand Up @@ -3872,7 +3872,7 @@ function DeletePoint(Lt) {
this.desc= "To delete existing points, you must adjust the dating of earlier or later points";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [318, 230];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -3911,7 +3911,7 @@ function Cut(Lt) {
this.desc = "To delete all points between two selected points, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [320, 240];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4003,7 +4003,7 @@ function InsertPoint(Lt) {
this.desc = "To insert points along a path between two existing points, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points forward in time";
this.optB = "shift dating of earlier points back in time";
this.size = [280, 240];
this.size = [312, 242];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4108,7 +4108,7 @@ function ConvertToStartPoint(Lt) {
this.desc = "To convert existing measurement points to a start point, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [322, 242];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4180,7 +4180,7 @@ function InsertZeroGrowth(Lt) {
this.desc = "To insert a zero width year, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points forward in time";
this.optB = "shift dating of earlier points back in time";
this.size = [280, 240];
this.size = [312, 230];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4934,7 +4934,7 @@ function KeyboardShortCutDialog (Lt) {
let anchor = this.anchor || [1, 442];

this.dialog = L.control.dialog ({
'size': [310, 380],
'size': [320, 380],
'anchor': anchor,
'initOpen': true,
'position': 'topleft',
Expand Down
46 changes: 25 additions & 21 deletions _site/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@
font-size: 1.5em;
}
.icon-button{
background-color: #6200ee;
height: 30px;
width: 30px;
color: white;
justify-content: center;
position: sticky;
left: 10px;
margin-right: 20px;
margin-bottom: 11px;
border-color: #A06DEB;
vertical-align: middle;
text-align: center;
background-color: #6200ee;
height: 30px;
width: 30px;
color: white;
justify-content: center;
position: sticky;
left: 10px;
margin-right: 20px;
margin-bottom: 11px;
border-color: #A06DEB;
vertical-align: middle;
text-align: center;
}

.text-button{
Expand Down Expand Up @@ -145,6 +145,10 @@ th {
margin: 4px;
}

.MeasurementOptions-radio-btn {
font-size: 14px;
}

.preferences-button {
font-size: 16px;
text-align: center;
Expand Down Expand Up @@ -181,7 +185,7 @@ th {
#keyboardShortcutDiv span {
margin-left: 10px;
margin-bottom: 5px;
font-size: 12px;
font-size: 14px;
display: inline;
}

Expand All @@ -205,7 +209,7 @@ th {
}

#shift-container p {
font-size: 10px;
font-size: 14px;
font-weight: normal;
color: #7d7d7d;
margin: 0;
Expand All @@ -225,7 +229,7 @@ th {
}

#shift-container label {
font-size: 12px;
font-size: 14px;
font-weight: normal;
color: black;
margin: 0;
Expand Down Expand Up @@ -277,7 +281,7 @@ th {
padding: 6px 11px;
border: none;
border-top: none;
font-size: 12px;
font-size: 14px;
margin-top: 0;
width: 100%;
}
Expand Down Expand Up @@ -305,7 +309,7 @@ textarea {
}

.text-content {
font-size: 12px;
font-size: 14px;
word-wrap: break-word;
}

Expand All @@ -317,7 +321,7 @@ textarea {
}

.summaryAttributesDiv li {
font-size: 12px;
font-size: 14px;
}

.summaryLinkDiv {
Expand All @@ -329,7 +333,7 @@ textarea {
}

.editAttributesDiv p {
font-size: 12px;
font-size: 14px;
margin: 0 0 0 10px;
display: inline;
}
Expand All @@ -340,13 +344,13 @@ textarea {

.editAttributesDiv label {
font-weight: normal;
font-size: 12px;
font-size: 14px;
margin-left: 2px;
}

.attribute-label {
margin-bottom: 0;
font-size: 12px;
font-size: 14px;
}

.attribute-textbox {
Expand Down
8 changes: 4 additions & 4 deletions coreassets/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
<div><h4 style="text-align:left;margin:0;">Select Preferences for Time-Series Measurement:</h4></div>
<hr style="height:2px;border-width:0;color:gray;background-color:gray;margin-top:10px;margin-bottom:10px;">
<div><h4 style="margin:0;">Measurement Direction:</h4></div>
<div><input type="radio" name="direction" id="forward_radio"> Measure forward in time (e.g., 1257 &rArr; 1258 &rArr; 1259 ... 2020)</input>
<br><input type="radio" name="direction" id="backward_radio"> Measure backward in time (e.g., 2020 &rArr; 2019 &rArr; 2018 ... 1257)</input></div>
<div><input type="radio" name="direction" id="forward_radio"> <span class="MeasurementOptions-radio-btn">Measure forward in time (e.g., 1257 &rArr; 1258 &rArr; 1259 ... 2020)</span></input>
<br><input type="radio" name="direction" id="backward_radio"> <span class="MeasurementOptions-radio-btn">Measure backward in time (e.g., 2020 &rArr; 2019 &rArr; 2018 ... 1257)</span></input></div>
<div><h4 style="margin:0;margin-top:10px;">Measurement Interval:</h4></div>
<div><input type="radio" name="increment" id="annual_radio"> One increment per year (e.g., total-ring width)</input>
<br><input type="radio" name="increment" id="subannual_radio"> Two increments per year (e.g., earlywood- & latewood-ring width)</input></div>
<div><input type="radio" name="increment" id="annual_radio"> <span class="MeasurementOptions-radio-btn">One increment per year (e.g., total-ring width)</span></input>
<br><input type="radio" name="increment" id="subannual_radio"> <span class="MeasurementOptions-radio-btn">Two increments per year (e.g., earlywood- & latewood-ring width)</span></input></div>
<hr style="height:2px;border-width:0;color:gray;background-color:gray;margin-top:10px;margin-bottom:10px;">
<div><p style="text-align:right;font-size:20px">&#9831; &#9831; &#9831; &#9831; &#9831; &#9831; &#9831; &#9831; &#9831; &#9831;<button type="button" id="confirm-button" class="preferences-button"> Save & close </button></p></div>
<div><p style="text-align:left;font-size:12px;margin:0;">Please note: Once measurements are initiated, these preferences are set. To modify, delete all existing points for this asset and initiate a new set of measurements.</p></div>
Expand Down
16 changes: 8 additions & 8 deletions leaflet-treering.js
Original file line number Diff line number Diff line change
Expand Up @@ -1905,14 +1905,14 @@ function AnnotationAsset(Lt) {
this.annotationIcon = this.markers[this.index];
};

let size = this.annotationDialogSize || [284, 265];
let size = this.annotationDialogSize || [310, 265];
let anchor = this.annotationDialogAnchor || [50, 5];

// handlebars from template.html
let content = document.getElementById("annotation-dialog-window-template").innerHTML;

this.dialogAnnotationWindow = L.control.dialog({
'minSize': [284, 265],
'minSize': [310, 265],
'maxSize': [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
'size': size,
'anchor': anchor,
Expand Down Expand Up @@ -3872,7 +3872,7 @@ function DeletePoint(Lt) {
this.desc= "To delete existing points, you must adjust the dating of earlier or later points";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [318, 230];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -3911,7 +3911,7 @@ function Cut(Lt) {
this.desc = "To delete all points between two selected points, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [320, 240];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4003,7 +4003,7 @@ function InsertPoint(Lt) {
this.desc = "To insert points along a path between two existing points, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points forward in time";
this.optB = "shift dating of earlier points back in time";
this.size = [280, 240];
this.size = [312, 242];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4108,7 +4108,7 @@ function ConvertToStartPoint(Lt) {
this.desc = "To convert existing measurement points to a start point, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points back in time";
this.optB = "shift dating of earlier points forward in time";
this.size = [280, 240];
this.size = [322, 242];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4180,7 +4180,7 @@ function InsertZeroGrowth(Lt) {
this.desc = "To insert a zero width year, you must adjust the dating of earlier or later points.";
this.optA = "shift dating of later points forward in time";
this.optB = "shift dating of earlier points back in time";
this.size = [280, 240];
this.size = [312, 230];
this.adjustOuter = false;
this.selectedAdjustment = false;
this.maintainAdjustment = false;
Expand Down Expand Up @@ -4934,7 +4934,7 @@ function KeyboardShortCutDialog (Lt) {
let anchor = this.anchor || [1, 442];

this.dialog = L.control.dialog ({
'size': [310, 380],
'size': [320, 380],
'anchor': anchor,
'initOpen': true,
'position': 'topleft',
Expand Down
Loading

0 comments on commit fee4a3e

Please sign in to comment.