@fab1o978/react-ui 0.2.4 → 0.2.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/dist/index.js CHANGED
@@ -4974,8 +4974,15 @@ function ColorWheel({
4974
4974
  const arcHandleR = ARC_HANDLE_R_FRAC * 380;
4975
4975
  const arcHandleDx = arcHandleR * Math.sin(arcAngleFromTop);
4976
4976
  const arcHandleDy = -arcHandleR * Math.cos(arcAngleFromTop);
4977
+ function nextHueHsv(h) {
4978
+ return {
4979
+ h,
4980
+ s: hsv.s === 0 ? 50 : hsv.s,
4981
+ v: hsv.v === 0 ? 50 : hsv.v
4982
+ };
4983
+ }
4977
4984
  function applyRingAngle(angle) {
4978
- if (mode === "h") commit({ ...hsv, h: angle }, alpha);
4985
+ if (mode === "h") commit(nextHueHsv(angle), alpha);
4979
4986
  else if (mode === "s") commit({ ...hsv, s: angle / 360 * 100 }, alpha);
4980
4987
  else if (mode === "a") commit(hsv, angle / 360);
4981
4988
  else commit({ ...hsv, v: angle / 360 * 100 }, alpha);
@@ -5026,7 +5033,7 @@ function ColorWheel({
5026
5033
  if (dist < rect.width * RING_INNER_FRAC || dist > rect.width * RING_OUTER_FRAC) return;
5027
5034
  e.preventDefault();
5028
5035
  const dir = e.deltaY > 0 ? -1 : 1;
5029
- if (mode === "h") commit({ ...hsv, h: (hsv.h + dir * 4 + 360) % 360 }, alpha);
5036
+ if (mode === "h") commit(nextHueHsv((hsv.h + dir * 4 + 360) % 360), alpha);
5030
5037
  else if (mode === "s") commit({ ...hsv, s: clamp2(hsv.s + dir * 3, 0, 100) }, alpha);
5031
5038
  else if (mode === "a") commit(hsv, clamp2(round2(alpha + dir * 0.03), 0, 1));
5032
5039
  else commit({ ...hsv, v: clamp2(hsv.v + dir * 3, 0, 100) }, alpha);