@carto/api-client 0.5.15-alpha.raster-4 → 0.5.15-alpha.raster-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/api-client.cjs
CHANGED
|
@@ -9736,25 +9736,26 @@ function findAccessorKey(keys, properties) {
|
|
|
9736
9736
|
function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
|
|
9737
9737
|
const { scale: scale2, domain } = calculateLayerScale(
|
|
9738
9738
|
colorColumn || name,
|
|
9739
|
-
scaleType,
|
|
9739
|
+
colorColumn ? "identity" : scaleType,
|
|
9740
9740
|
range,
|
|
9741
9741
|
data
|
|
9742
9742
|
);
|
|
9743
9743
|
const alpha = opacityToAlpha(opacity);
|
|
9744
|
-
let accessorKeys = getAccessorKeys(name, aggregation);
|
|
9744
|
+
let accessorKeys = getAccessorKeys(colorColumn || name, aggregation);
|
|
9745
9745
|
const accessor = (properties) => {
|
|
9746
9746
|
if (!(accessorKeys[0] in properties)) {
|
|
9747
9747
|
accessorKeys = findAccessorKey(accessorKeys, properties);
|
|
9748
9748
|
}
|
|
9749
9749
|
const propertyValue = properties[accessorKeys[0]];
|
|
9750
|
-
const
|
|
9751
|
-
|
|
9750
|
+
const scaled = scale2(propertyValue);
|
|
9751
|
+
const rgb2 = typeof scaled === "string" ? hexToRGB(scaled) : scaled;
|
|
9752
|
+
return [...rgb2, propertyValue === null ? 0 : alpha];
|
|
9752
9753
|
};
|
|
9753
9754
|
return {
|
|
9754
9755
|
accessor: normalizeAccessor(accessor, data),
|
|
9755
9756
|
scaleDomain: scale2.domain(),
|
|
9756
9757
|
domain,
|
|
9757
|
-
range: scale2.range().map(rgbToHex)
|
|
9758
|
+
range: (scale2.range() || []).map(rgbToHex)
|
|
9758
9759
|
};
|
|
9759
9760
|
}
|
|
9760
9761
|
function calculateLayerScale(name, scaleType, range, data) {
|