Changed font color mapping to be more specific.

Since we moved the function out of the module for text specifically.
This commit is contained in:
Harrison Deng 2022-04-21 01:48:17 -05:00
parent 73ecd9e6de
commit ea56601126
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ import { mapBinNumerical, mapRangedAvgNumerical } from "./numeric.js";
* @param {number} [conf.upperVal=0] The upper boundary of possible values for the color component (0 to 255 inclusive).
* @returns {{bin: number, listener: VisUpdateRouter~visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter~visualizerRangedUpdateListener}} The ranged listener that was added.
*/
export function mapRgba({ element, color, lowerBin, visUpdateRouter, interpolator, upperBin = undefined, reversed = false, lowerVal = 0, upperVal = 255 }) {
export function mapFontRgba({ element, color, lowerBin, visUpdateRouter, interpolator, upperBin = undefined, reversed = false, lowerVal = 0, upperVal = 255 }) {
const rgbaStr = "rgba";
color = rgbaStr.indexOf(color);
if (color < 0) throw new Error("Invalid color parameter provided.");

View File

@ -105,7 +105,7 @@
</div>
<pre><code class="language-js">
const fontColorElem = document.getElementById("font-color-map-demo");
ask.mappings.coloring.mapRgba({ // Under mappings, the text module. We just want to map one of the RGBA color components...
ask.mappings.coloring.mapFontRgba({ // Under mappings, the text module. We just want to map one of the RGBA color components...
element: fontColorElem, // The element to map (same as above examples).
color: "r", // Choose the red component.
lowerBin: 128, // All other values are what we've seen above.
@ -173,7 +173,7 @@
ask.mappings.dimensions.mapHeight(squareElemConf);
const fontColorElem = document.getElementById("font-color-map-demo");
ask.mappings.coloring.mapRgba({
ask.mappings.coloring.mapFontRgba({
element: fontColorElem,
color: "r",
lowerBin: 128,