Skip to content

Commit

Permalink
refactor(#47): ⚡ improve updating of labels on the UI
Browse files Browse the repository at this point in the history
made labels come up faster after a movement, not requiring a camera update anymore
  • Loading branch information
franmagn committed Oct 30, 2025
1 parent 087cefd commit df109d3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/MeasurementControl/measurementsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,24 @@ export function initMeasurementsPanel(viewer) {
})
} catch (_e) {}
})

// Listen to movement events separately so we can update overlay label
// positions immediately when a marker/point is moved
;['marker_moved', 'marker_dropped', 'point_moved'].forEach((ev) => {
try {
obj.addEventListener(ev, () => {
// schedule a position update on next frame
requestAnimationFrame(() => updateOverlayPositions())
// If this measurement is currently selected, refresh the panel too
if (lastSelection.uuid === obj.uuid) {
try {
updateActiveSelection(obj.uuid)
showPanelInMeasurements()
} catch (_e) {}
}
})
} catch (_e) {}
})
}

// Distance/Height/Angle measurements can change type based on point count
Expand Down

0 comments on commit df109d3

Please sign in to comment.