Skip to content

Commit b46bc0b

Browse files
SynarTristramg
authored andcommitted
html-demo: fix negative offset display
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
1 parent 9016f92 commit b46bc0b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

wasm/html_demo/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ async function file_selected(el) {
193193

194194
window_lrms.selectedFeature = curves_features[lrm_id];
195195
let offset = Math.round(projection.measure.scale_offset)
196-
window_lrms.pkStart = projection.measure.anchor_name + '+' + String(offset).padStart(3, "0");
196+
const offset_sign = offset >= 0 ? '+' : '-';
197+
window_lrms.pkStart = projection.measure.anchor_name + offset_sign + String(Math.abs(offset)).padStart(3, "0");
197198

198199
window_lrms.startMeasure = projection.measure;
199200
let point = lrs.resolve(lrm_id, projection.measure)

0 commit comments

Comments
 (0)