Browse Source

Create GenerateCSSGradient function, but it's not used yet.

pull/35/head
Starbeamrainbowlabs 4 years ago
parent
commit
a91c2283af
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 21
      client_src/js/Helpers/GradientHelpers.mjs
  2. 13
      client_src/js/Helpers/RenderGradient.mjs
  3. 2
      client_src/js/LayerHeatmap.mjs

21
client_src/js/Helpers/GradientHelpers.mjs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
"use strict";
function RenderGradient(stops, max) {
let result = {};
for(let value in stops) {
result[value / max] = stops[value];
}
return result;
}
function GenerateCSSGradient(stops, max) {
let stops_processed = [];
for(let value in stops) {
stops_processed = `${stops[value]} ${(value/max).toFixed(3)}%`
}
return `linear-gradient(to bottom, ${stops_processed.join(", ")})`;
}
export { RenderGradient };

13
client_src/js/Helpers/RenderGradient.mjs

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
"use strict";
function RenderGradient(stops, max) {
let result = {};
for(let value in stops) {
result[value / max] = stops[value];
}
return result;
}
export default RenderGradient;

2
client_src/js/LayerHeatmap.mjs

@ -5,7 +5,7 @@ import HeatmapOverlay from 'leaflet-heatmap'; @@ -5,7 +5,7 @@ import HeatmapOverlay from 'leaflet-heatmap';
import Config from './Config.mjs';
import GetFromUrl from './Helpers/GetFromUrl.mjs';
import RenderGradient from './Helpers/RenderGradient.mjs';
import { RenderGradient } from './Helpers/GradientHelpers.mjs';
class LayerHeatmap {

Loading…
Cancel
Save