Skip to content

Commit

Permalink
Make raw tracks more usable on the post-process page
Browse files Browse the repository at this point in the history
Let users change color and opacity of raw tracks easily from the console (these are the defaults):
```
CriticalSnake.PlaybackOptions.defaultColor = '#00f'
CriticalSnake.PlaybackOptions.defaultOpacity = 0.1
```
  • Loading branch information
weliveindetail committed Jun 5, 2023
1 parent b1d5398 commit c273cc4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions critical-snake/playback.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ CriticalSnake.PlaybackOptions = {
// currently offers.
autoLimitFps: true,

// The color used to draw tracks and circles not associated with a snake.
defaultColor: "#888", // grey
// The color of raw tracks and circles not associated with a snake.
defaultColor: "#00f",

// The opacity of raw tracks.
defaultOpacity: 0.1,

// Colors for tracks and circles by snake-index.
snakeColors: [
Expand Down Expand Up @@ -104,7 +107,7 @@ CriticalSnake.Playback = function(bikeMap) {

function drawRawTracks(canvas, dataPoints, tracks, stamp, range, opacity) {
range = range || 10;
opacity = opacity || 0.1;
opacity = opacity || CriticalSnake.PlaybackOptions.defaultOpacity;

canvas.clearLayers();

Expand All @@ -124,7 +127,7 @@ CriticalSnake.Playback = function(bikeMap) {
visibleBikes += 1;
canvas.addLayer(
L.polyline(coords, {
color: "#888",
color: CriticalSnake.PlaybackOptions.defaultColor,
opacity: opacity
}));
}
Expand Down

0 comments on commit c273cc4

Please sign in to comment.