@yogiswara/honcho-editor-ui 3.1.16 → 3.1.17
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.
|
@@ -114,7 +114,7 @@ export default function HSliderColorMobile(props) {
|
|
|
114
114
|
color: colors.surface,
|
|
115
115
|
width: "40px", // Keep the fixed width for alignment
|
|
116
116
|
textAlign: "right", // Keep the text alignment
|
|
117
|
-
}, children: formatValue(props.tempScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%'
|
|
117
|
+
}, children: formatValue(props.tempScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
118
118
|
position: 'absolute',
|
|
119
119
|
top: 0,
|
|
120
120
|
bottom: 0,
|
|
@@ -152,7 +152,7 @@ export default function HSliderColorMobile(props) {
|
|
|
152
152
|
color: colors.surface,
|
|
153
153
|
width: "40px", // Keep the fixed width for alignment
|
|
154
154
|
textAlign: "right", // Keep the text alignment
|
|
155
|
-
}, children: formatValue(props.tintScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%'
|
|
155
|
+
}, children: formatValue(props.tintScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
156
156
|
position: 'absolute',
|
|
157
157
|
top: 0,
|
|
158
158
|
bottom: 0,
|
|
@@ -190,7 +190,7 @@ export default function HSliderColorMobile(props) {
|
|
|
190
190
|
color: colors.surface,
|
|
191
191
|
width: "40px", // Keep the fixed width for alignment
|
|
192
192
|
textAlign: "right", // Keep the text alignment
|
|
193
|
-
}, children: formatValue(props.vibranceScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%'
|
|
193
|
+
}, children: formatValue(props.vibranceScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
194
194
|
position: 'absolute',
|
|
195
195
|
top: 0,
|
|
196
196
|
bottom: 0,
|
|
@@ -228,7 +228,7 @@ export default function HSliderColorMobile(props) {
|
|
|
228
228
|
color: colors.surface,
|
|
229
229
|
width: "40px", // Keep the fixed width for alignment
|
|
230
230
|
textAlign: "right", // Keep the text alignment
|
|
231
|
-
}, children: formatValue(props.saturationScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%'
|
|
231
|
+
}, children: formatValue(props.saturationScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
232
232
|
position: 'absolute',
|
|
233
233
|
top: 0,
|
|
234
234
|
bottom: 0,
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
|
|
3
3
|
const elementRef = useRef(null);
|
|
4
|
+
// ✅ 1. Add a ref to track if a drag is active
|
|
5
|
+
const isDraggingRef = useRef(false);
|
|
4
6
|
useEffect(() => {
|
|
5
7
|
const element = elementRef.current;
|
|
6
8
|
if (!element)
|
|
7
9
|
return;
|
|
8
10
|
const handleDragEnd = () => {
|
|
9
|
-
|
|
11
|
+
// ✅ 2. Check the flag. If not dragging, do nothing.
|
|
12
|
+
if (!isDraggingRef.current)
|
|
13
|
+
return;
|
|
14
|
+
// If we are dragging, set the flag to false immediately
|
|
15
|
+
isDraggingRef.current = false;
|
|
16
|
+
onDragEnd(); // Then call the function
|
|
10
17
|
window.removeEventListener('pointerup', handleDragEnd);
|
|
11
18
|
};
|
|
12
19
|
const handleDragStart = (event) => {
|
|
13
|
-
//
|
|
14
|
-
|
|
20
|
+
// ✅ 3. When a drag starts, set the flag to true
|
|
21
|
+
isDraggingRef.current = true;
|
|
15
22
|
if (!isBatchMode) {
|
|
16
23
|
onDragStart();
|
|
17
24
|
}
|