Skip to content

Commit c5abcc6

Browse files
committed
Improve fading
1 parent 04d63d3 commit c5abcc6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/main/java/com/lbry/globe/api/API.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ public static void fillPoints(JSONArray points){
3737
obj.put("lat",node.getLatitude());
3838
obj.put("lng",node.getLongitude());
3939
obj.put("type",service.getType());
40-
long ttl = (300_000-(System.currentTimeMillis()-service.getLastSeen()));
41-
if(ttl<0){
42-
ttl = 0;
43-
}
44-
obj.put("ttl",ttl/1000);
40+
obj.put("notSeenTime",System.currentTimeMillis() - service.getLastSeen());
4541
points.put(obj);
4642
}
4743
}

src/main/resources/globe.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ const POINT_COLOR = {
4242
hub: '#FF0000',
4343
};
4444

45+
const POINT_TTL = {
46+
blockchain: 60,
47+
};
48+
4549
const POINT_RADIUS = {
4650
blockchain: 0.125,
4751
dht: 0.1,
@@ -51,8 +55,9 @@ const POINT_RADIUS = {
5155
globe.pointAltitude(point => POINT_ALTITUDE[point.type]);
5256
globe.pointColor(function(point){
5357
var color = POINT_COLOR[point.type];
54-
if(point.ttl!==undefined){
55-
color += Math.round(point.ttl/300*256).toString(16).padStart(2,'0');
58+
var ttl = POINT_TTL[point.type];
59+
if(point.notSeenTime!==undefined && ttl!==undefined){
60+
color += (point.notSeenTime/ttl*255).toString(16).padStart(2,'0');
5661
}
5762
return color;
5863
});

0 commit comments

Comments
 (0)