@mapbox/mapbox-gl-style-spec 14.15.0-beta.1 → 14.15.0-beta.2

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/dist/index.cjs CHANGED
@@ -12956,17 +12956,19 @@
12956
12956
  0,
12957
12957
  0
12958
12958
  ];
12959
- r /= a;
12960
- g /= a;
12961
- b /= a;
12959
+ const invA = 1 / a;
12960
+ r *= invA;
12961
+ g *= invA;
12962
+ b *= invA;
12962
12963
  }
12963
12964
  const red = Math.min(Math.max(r, 0), 1);
12964
12965
  const green = Math.min(Math.max(g, 0), 1);
12965
12966
  const blue = Math.min(Math.max(b, 0), 1);
12966
12967
  const min = Math.min(red, green, blue);
12967
12968
  const max = Math.max(red, green, blue);
12968
- const l = (min + max) / 2;
12969
- if (min === max) {
12969
+ const delta = max - min;
12970
+ const l = (min + max) * 0.5;
12971
+ if (delta === 0) {
12970
12972
  return [
12971
12973
  0,
12972
12974
  0,
@@ -12974,21 +12976,22 @@
12974
12976
  a
12975
12977
  ];
12976
12978
  }
12977
- const delta = max - min;
12978
12979
  const s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
12979
- let h = 0;
12980
- if (max === red) {
12981
- h = (green - blue) / delta + (green < blue ? 6 : 0);
12982
- } else if (max === green) {
12983
- h = (blue - red) / delta + 2;
12984
- } else if (max === blue) {
12985
- h = (red - green) / delta + 4;
12986
- }
12987
- h *= 60;
12980
+ let h;
12981
+ switch (max) {
12982
+ case red:
12983
+ h = ((green - blue) / delta + (green < blue ? 6 : 0)) * 60;
12984
+ break;
12985
+ case green:
12986
+ h = ((blue - red) / delta + 2) * 60;
12987
+ break;
12988
+ default:
12989
+ h = ((red - green) / delta + 4) * 60;
12990
+ }
12988
12991
  return [
12989
- Math.min(Math.max(h, 0), 360),
12990
- Math.min(Math.max(s * 100, 0), 100),
12991
- Math.min(Math.max(l * 100, 0), 100),
12992
+ h,
12993
+ s * 100,
12994
+ l * 100,
12992
12995
  a
12993
12996
  ];
12994
12997
  }