Skip to content

Commit 65581a0

Browse files
authored
fix: hsv gradient position is changed on slider drag (#121)
* fix: hsv gradient position is changed on slider drag * test: ColorBox onChange behaves differently
1 parent 8e7d281 commit 65581a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/ColorBox/HSVGradient.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const HSVGradient = ({ className, color, onChange, ...props }) => {
160160
event.preventDefault();
161161
};
162162
const handleMove = event => {
163-
if (pressed || event.buttons) {
163+
if (pressed && event.buttons) {
164164
const xy = { x: event.pageX - window.scrollX, y: event.pageY - window.scrollY };
165165
convertMousePosition(xy, ref);
166166
event.preventDefault();

test/ColorBox.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ test('ColorBox hsvgradient cursor changes', async () => {
194194
pageY: -600,
195195
}),
196196
);
197-
expect(onChange).toHaveBeenCalledTimes(3);
197+
expect(onChange).toHaveBeenCalledTimes(1);
198198
expect(value.name).toBe('white');
199199
});
200200

0 commit comments

Comments
 (0)