@carto/api-client 0.5.18-alpha.colormapfix-1 → 0.5.18

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.
@@ -9587,43 +9587,37 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
9587
9587
  };
9588
9588
  }
9589
9589
  function calculateLayerScale(name, scaleType, range, data) {
9590
- let domain = [];
9591
9590
  let scaleDomain;
9592
- let scaleColor = [];
9591
+ let scaleColors = [];
9593
9592
  const { colors } = range;
9593
+ const domain = calculateDomain(data, name, scaleType, colors.length);
9594
9594
  if (scaleType !== "identity") {
9595
9595
  if (range.colorMap) {
9596
9596
  const { colorMap } = range;
9597
9597
  scaleDomain = [];
9598
9598
  colorMap.forEach(([value, color2]) => {
9599
9599
  scaleDomain.push(value);
9600
- scaleColor.push(color2);
9600
+ scaleColors.push(color2);
9601
9601
  });
9602
- domain = scaleDomain;
9603
9602
  } else {
9604
9603
  if (scaleType === "custom" && range.uiCustomScaleType === "logarithmic") {
9605
- domain = calculateDomain(data, name, scaleType, colors.length);
9606
9604
  const [min2, max2] = domain;
9607
9605
  scaleDomain = getLog10ScaleSteps({
9608
9606
  min: min2,
9609
9607
  max: max2,
9610
9608
  steps: colors.length
9611
9609
  });
9612
- scaleColor = colors;
9610
+ scaleColors = colors;
9613
9611
  } else {
9614
- domain = calculateDomain(data, name, scaleType, colors.length);
9615
- scaleColor = colors;
9612
+ scaleColors = colors;
9616
9613
  }
9617
9614
  }
9618
- if (scaleType === "ordinal") {
9619
- domain = domain.slice(0, scaleColor.length);
9620
- }
9621
9615
  }
9622
9616
  return {
9623
9617
  scale: createColorScale(
9624
9618
  scaleType,
9625
9619
  scaleDomain || domain,
9626
- scaleColor.map(hexToRGB),
9620
+ scaleColors.map(hexToRGB),
9627
9621
  UNKNOWN_COLOR_RGB
9628
9622
  ),
9629
9623
  domain