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

This commit is contained in:
Starbeamrainbowlabs 2019-04-23 16:09:46 +01:00
parent 9194a1f372
commit a91c2283af
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 22 additions and 14 deletions

View file

@ -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 };

View file

@ -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;

View file

@ -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 {