@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.js
CHANGED
|
@@ -9399,25 +9399,26 @@ function findAccessorKey(keys, properties) {
|
|
|
9399
9399
|
function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
|
|
9400
9400
|
const { scale: scale2, domain } = calculateLayerScale(
|
|
9401
9401
|
colorColumn || name,
|
|
9402
|
-
scaleType,
|
|
9402
|
+
colorColumn ? "identity" : scaleType,
|
|
9403
9403
|
range,
|
|
9404
9404
|
data
|
|
9405
9405
|
);
|
|
9406
9406
|
const alpha = opacityToAlpha(opacity);
|
|
9407
|
-
let accessorKeys = getAccessorKeys(name, aggregation);
|
|
9407
|
+
let accessorKeys = getAccessorKeys(colorColumn || name, aggregation);
|
|
9408
9408
|
const accessor = (properties) => {
|
|
9409
9409
|
if (!(accessorKeys[0] in properties)) {
|
|
9410
9410
|
accessorKeys = findAccessorKey(accessorKeys, properties);
|
|
9411
9411
|
}
|
|
9412
9412
|
const propertyValue = properties[accessorKeys[0]];
|
|
9413
|
-
const
|
|
9414
|
-
|
|
9413
|
+
const scaled = scale2(propertyValue);
|
|
9414
|
+
const rgb2 = typeof scaled === "string" ? hexToRGB(scaled) : scaled;
|
|
9415
|
+
return [...rgb2, propertyValue === null ? 0 : alpha];
|
|
9415
9416
|
};
|
|
9416
9417
|
return {
|
|
9417
9418
|
accessor: normalizeAccessor(accessor, data),
|
|
9418
9419
|
scaleDomain: scale2.domain(),
|
|
9419
9420
|
domain,
|
|
9420
|
-
range: scale2.range().map(rgbToHex)
|
|
9421
|
+
range: (scale2.range() || []).map(rgbToHex)
|
|
9421
9422
|
};
|
|
9422
9423
|
}
|
|
9423
9424
|
function calculateLayerScale(name, scaleType, range, data) {
|