From 70b0996fb925f5f04ce69e5097c89f0cd3638ae4 Mon Sep 17 00:00:00 2001 From: case Date: Wed, 8 Jan 2020 09:16:01 -0800 Subject: [PATCH] Fixes corners jumping in Saturation field --- src/helpers/saturation.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers/saturation.js b/src/helpers/saturation.js index 8cad4e62..261a3c60 100644 --- a/src/helpers/saturation.js +++ b/src/helpers/saturation.js @@ -9,14 +9,16 @@ export const calculateChange = (e, hsl, container) => { left = 0 } else if (left > containerWidth) { left = containerWidth - } else if (top < 0) { + } + + if (top < 0) { top = 0 } else if (top > containerHeight) { top = containerHeight } - const saturation = (left * 100) / containerWidth - const bright = -((top * 100) / containerHeight) + 100 + const saturation = left / containerWidth + const bright = 1 - (top / containerHeight) return { h: hsl.h,