mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-01-06 16:50:01 +01:00
add custom retention time to markers from location.ttl
This commit is contained in:
parent
26171a69f3
commit
96c6863c93
|
|
@ -194,12 +194,12 @@ Locator.prototype.update = function(update) {
|
|||
this.setCenter(lat, lon);
|
||||
|
||||
// Age locator
|
||||
this.age(new Date().getTime() - update.lastseen);
|
||||
this.age(new Date().getTime() - update.lastseen, update.location.ttl);
|
||||
};
|
||||
|
||||
Locator.prototype.age = function(age) {
|
||||
if (age <= retention_time) {
|
||||
this.setOpacity(Marker.getOpacityScale(age));
|
||||
Locator.prototype.age = function(age, ttl=retention_time) {
|
||||
if (age <= ttl) {
|
||||
this.setOpacity(Marker.getOpacityScale(age, ttl));
|
||||
return true;
|
||||
} else {
|
||||
this.setMap();
|
||||
|
|
|
|||
|
|
@ -188,10 +188,10 @@ Marker.makeListItem = function(name, value) {
|
|||
};
|
||||
|
||||
// Get opacity value in the 0..1 range based on the given age.
|
||||
Marker.getOpacityScale = function(age) {
|
||||
Marker.getOpacityScale = function(age, ttl=retention_time) {
|
||||
var scale = 1;
|
||||
if (age >= retention_time / 2) {
|
||||
scale = (retention_time - age) / (retention_time / 2);
|
||||
if (age >= ttl / 2) {
|
||||
scale = (ttl - age) / (ttl / 2);
|
||||
}
|
||||
return Math.max(0, Math.min(1, scale));
|
||||
};
|
||||
|
|
@ -199,9 +199,9 @@ Marker.getOpacityScale = function(age) {
|
|||
// Set marker's opacity based on the supplied age. Returns TRUE
|
||||
// if the marker should still be visible, FALSE if it has to be
|
||||
// removed.
|
||||
Marker.prototype.age = function(age) {
|
||||
if(age <= retention_time) {
|
||||
this.setMarkerOpacity(Marker.getOpacityScale(age));
|
||||
Marker.prototype.age = function(age, ttl=retention_time) {
|
||||
if(age <= ttl) {
|
||||
this.setMarkerOpacity(Marker.getOpacityScale(age, ttl));
|
||||
return true;
|
||||
} else {
|
||||
this.setMap();
|
||||
|
|
@ -243,7 +243,7 @@ FeatureMarker.prototype.update = function(update) {
|
|||
this.setMarkerPosition(update.callsign, update.location.lat, update.location.lon);
|
||||
|
||||
// Age locator
|
||||
this.age(new Date().getTime() - update.lastseen);
|
||||
this.age(new Date().getTime() - update.lastseen, update.location.ttl);
|
||||
};
|
||||
|
||||
FeatureMarker.prototype.draw = function() {
|
||||
|
|
@ -369,7 +369,7 @@ AprsMarker.prototype.update = function(update) {
|
|||
this.setMarkerPosition(update.callsign, update.location.lat, update.location.lon);
|
||||
|
||||
// Age locator
|
||||
this.age(new Date().getTime() - update.lastseen);
|
||||
this.age(new Date().getTime() - update.lastseen, update.location.ttl);
|
||||
};
|
||||
|
||||
AprsMarker.prototype.isFacingEast = function(symbol) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue