Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
vesselData.onValue(({vesselData, settings}) => {
const position = vesselData['navigation.position']
if (position) {
const newPos = [position.latitude, position.longitude]
myVessel.setLatLng(newPos)
}
const course =
settings.course === COG ? vesselData['navigation.courseOverGroundTrue'] : vesselData['navigation.headingTrue']
if (course) {
myVessel.setRotationAngle(toDegrees(course))
} else {
myVessel.setRotationAngle(0)
}
const speed = vesselData['navigation.speedOverGround']
const extensionLineCoordinates = calculateExtensionLine(position, course, speed, settings.extensionLine)
if (extensionLineCoordinates) {
pointer.setLatLngs([extensionLineCoordinates.start, extensionLineCoordinates.end])
pointerEnd.setLatLng(extensionLineCoordinates.end)
} else {
pointer.setLatLngs([[0, 0], [0, 0]])
pointerEnd.setLatLng([0, 0])
}
if (settings.follow && (extensionLineCoordinates || position)) {