@yogiswara/honcho-editor-ui 3.1.15 → 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,
|
|
@@ -123,7 +123,7 @@ export default function HSliderColorMobile(props) {
|
|
|
123
123
|
right: '16px',
|
|
124
124
|
zIndex: 1,
|
|
125
125
|
touchAction: 'manipulation', // ✅ 1. Add this to make double-tap reliable on mobile
|
|
126
|
-
}
|
|
126
|
+
} }), _jsx(Slider, { sx: {
|
|
127
127
|
width: "100%",
|
|
128
128
|
color: colors.surface,
|
|
129
129
|
'& .MuiSlider-rail': {
|
|
@@ -152,75 +152,114 @@ 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) })] }),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
}, children: formatValue(props.tintScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
156
|
+
position: 'absolute',
|
|
157
|
+
top: 0,
|
|
158
|
+
bottom: 0,
|
|
159
|
+
// Offset by 16px to align with the slider's track inside the component
|
|
160
|
+
left: '16px',
|
|
161
|
+
right: '16px',
|
|
162
|
+
zIndex: 1,
|
|
163
|
+
touchAction: 'manipulation', // ✅ 1. Add this to make double-tap reliable on mobile
|
|
164
|
+
} }), _jsx(Slider, { sx: {
|
|
165
|
+
width: "100%",
|
|
166
|
+
color: colors.surface,
|
|
167
|
+
'& .MuiSlider-rail': {
|
|
168
|
+
background: tintGradient,
|
|
169
|
+
opacity: 1,
|
|
170
|
+
pointerEvents: 'none', // Track is not interactive
|
|
171
|
+
},
|
|
172
|
+
'& .MuiSlider-track': {
|
|
173
|
+
background: 'transparent',
|
|
174
|
+
border: 'none',
|
|
175
|
+
pointerEvents: 'none', // Track is not interactive
|
|
176
|
+
},
|
|
177
|
+
'& .MuiSlider-thumb': {
|
|
178
|
+
boxShadow: 'none',
|
|
179
|
+
pointerEvents: 'auto', // Thumb IS interactive
|
|
180
|
+
touchAction: 'none',
|
|
181
|
+
zIndex: 2, // Thumb is on top of the overlay
|
|
182
|
+
}
|
|
183
|
+
}, slotProps: {
|
|
184
|
+
thumb: {
|
|
185
|
+
ref: tintSliderRef,
|
|
186
|
+
onDoubleClick: tintInput.handleDoubleClick
|
|
187
|
+
}
|
|
188
|
+
}, size: "small", value: props.tintScore, step: 1, min: -100, max: 100, onChange: (_event, newValue) => props.setTintScore("tintScore", newValue) })] }), _jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px', '&:focus-within .MuiFilledInput-input': focusedInputStyle }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: vibranceInput.handleDoubleClick, children: "Vibrance" }), _jsx(Typography, { sx: {
|
|
176
189
|
...typography.bodyMedium, // Use your standard typography
|
|
177
190
|
color: colors.surface,
|
|
178
191
|
width: "40px", // Keep the fixed width for alignment
|
|
179
192
|
textAlign: "right", // Keep the text alignment
|
|
180
|
-
}, children: formatValue(props.vibranceScore) })] }),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
193
|
+
}, children: formatValue(props.vibranceScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
top: 0,
|
|
196
|
+
bottom: 0,
|
|
197
|
+
// Offset by 16px to align with the slider's track inside the component
|
|
198
|
+
left: '16px',
|
|
199
|
+
right: '16px',
|
|
200
|
+
zIndex: 1,
|
|
201
|
+
touchAction: 'manipulation', // ✅ 1. Add this to make double-tap reliable on mobile
|
|
202
|
+
} }), _jsx(Slider, { sx: {
|
|
203
|
+
width: "100%",
|
|
204
|
+
color: colors.surface,
|
|
205
|
+
'& .MuiSlider-rail': {
|
|
206
|
+
background: fullTrackGradient,
|
|
207
|
+
opacity: 1,
|
|
208
|
+
pointerEvents: 'none', // Track is not interactive
|
|
209
|
+
},
|
|
210
|
+
'& .MuiSlider-track': {
|
|
211
|
+
background: 'transparent',
|
|
212
|
+
border: 'none',
|
|
213
|
+
pointerEvents: 'none', // Track is not interactive
|
|
214
|
+
},
|
|
215
|
+
'& .MuiSlider-thumb': {
|
|
216
|
+
boxShadow: 'none',
|
|
217
|
+
pointerEvents: 'auto', // Thumb IS interactive
|
|
218
|
+
touchAction: 'none',
|
|
219
|
+
zIndex: 2, // Thumb is on top of the overlay
|
|
220
|
+
}
|
|
221
|
+
}, slotProps: {
|
|
222
|
+
thumb: {
|
|
223
|
+
ref: vibranceSliderRef,
|
|
224
|
+
onDoubleClick: vibranceInput.handleDoubleClick
|
|
225
|
+
}
|
|
226
|
+
}, size: "small", value: props.vibranceScore, step: 1, min: -100, max: 100, onChange: (_event, newValue) => props.setVibranceScore("vibranceScore", newValue) })] }), _jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px', '&:focus-within .MuiFilledInput-input': focusedInputStyle }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: saturationInput.handleDoubleClick, children: "Saturation" }), _jsx(Typography, { sx: {
|
|
201
227
|
...typography.bodyMedium, // Use your standard typography
|
|
202
228
|
color: colors.surface,
|
|
203
229
|
width: "40px", // Keep the fixed width for alignment
|
|
204
230
|
textAlign: "right", // Keep the text alignment
|
|
205
|
-
}, children: formatValue(props.saturationScore) })] }),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
}, children: formatValue(props.saturationScore) })] }), _jsxs(Box, { sx: { position: 'relative', width: '100%' }, children: [_jsx("div", { style: {
|
|
232
|
+
position: 'absolute',
|
|
233
|
+
top: 0,
|
|
234
|
+
bottom: 0,
|
|
235
|
+
// Offset by 16px to align with the slider's track inside the component
|
|
236
|
+
left: '16px',
|
|
237
|
+
right: '16px',
|
|
238
|
+
zIndex: 1,
|
|
239
|
+
touchAction: 'manipulation', // ✅ 1. Add this to make double-tap reliable on mobile
|
|
240
|
+
} }), _jsx(Slider, { sx: {
|
|
241
|
+
width: "100%",
|
|
242
|
+
color: colors.surface,
|
|
243
|
+
'& .MuiSlider-rail': {
|
|
244
|
+
background: fullTrackGradient,
|
|
245
|
+
opacity: 1,
|
|
246
|
+
pointerEvents: 'none',
|
|
247
|
+
},
|
|
248
|
+
'& .MuiSlider-track': {
|
|
249
|
+
background: 'transparent',
|
|
250
|
+
border: 'none',
|
|
251
|
+
pointerEvents: 'none',
|
|
252
|
+
},
|
|
253
|
+
'& .MuiSlider-thumb': {
|
|
254
|
+
boxShadow: 'none',
|
|
255
|
+
pointerEvents: 'auto',
|
|
256
|
+
touchAction: 'none',
|
|
257
|
+
zIndex: 2,
|
|
258
|
+
}
|
|
259
|
+
}, slotProps: {
|
|
260
|
+
thumb: {
|
|
261
|
+
ref: saturationSliderRef,
|
|
262
|
+
onDoubleClick: saturationInput.handleDoubleClick
|
|
263
|
+
}
|
|
264
|
+
}, size: "small", value: props.saturationScore, step: 1, min: -100, max: 100, onChange: (_event, newValue) => props.setSaturationScore("saturationScore", newValue) })] })] }) }));
|
|
226
265
|
}
|
|
@@ -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
|
}
|