Skip to content

Commit d0d7f35

Browse files
committed
Added getRotationLabel helper: Created a function in index.js:231 to convert rotation degrees (0, 90, 180, 270) into their corresponding labels ("North-up", "East-up", etc.).
Updated handleDistanceModalConfirm: Modified the toast message in index.js:1042 to dynamically include the selected rotation label when a 1-point calibration becomes active after setting the scale. Updated handleOneTapClick: Modified the toast message in index.js:1137 to dynamically include the selected rotation label when a 1-point calibration is active after pinning a location
1 parent 1335e37 commit d0d7f35

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ function formatLatLon(value, positive, negative) {
228228
return `${value.toFixed(6)}° ${direction}`;
229229
}
230230

231+
function getRotationLabel(degrees) {
232+
const labels = {
233+
0: 'North-up',
234+
90: 'East-up',
235+
180: 'South-up',
236+
270: 'West-up',
237+
};
238+
return labels[degrees] || `${degrees}°`;
239+
}
240+
231241
function checkScaleDisagreement() {
232242
if (!dom.scaleWarning) {
233243
return;
@@ -1029,7 +1039,8 @@ function handleDistanceModalConfirm() {
10291039
saveSettings();
10301040

10311041
if (state.pairs.length === 1) {
1032-
showToast('1-point calibration active (North-up). Add a second point to fix orientation and scale.', { tone: 'success', duration: 6000 });
1042+
const rotationLabel = getRotationLabel(state.defaultRotation);
1043+
showToast(`1-point calibration active (${rotationLabel}). Add a second point to fix orientation and scale.`, { tone: 'success', duration: 6000 });
10331044
} else {
10341045
showToast(`Scale set: ${formatDistance(result.referenceDistance.meters, state.preferredUnit)} = ${result.referenceDistance.metersPerPixel.toFixed(4)} m/px`, { tone: 'success' });
10351046
}
@@ -1123,7 +1134,8 @@ function handleOneTapClick(pixel) {
11231134
recalculateCalibration();
11241135

11251136
if (state.referenceDistance) {
1126-
showToast('1-point calibration active (North-up). Add a second point to fix orientation and scale.', { tone: 'success', duration: 6000 });
1137+
const rotationLabel = getRotationLabel(state.defaultRotation);
1138+
showToast(`1-point calibration active (${rotationLabel}). Add a second point to fix orientation and scale.`, { tone: 'success', duration: 6000 });
11271139
} else {
11281140
showToast('Position pinned. Now set the scale to enable live view.', { duration: 5000 });
11291141
}

0 commit comments

Comments
 (0)