@yogiswara/honcho-editor-ui 3.0.3 → 3.0.4
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.
|
@@ -125,15 +125,22 @@ export default function HSliderColorMobile(props) {
|
|
|
125
125
|
textAlign: "right", // Keep the text alignment
|
|
126
126
|
}, children: formatValue(props.tempScore) })] }), _jsx(Slider, { sx: {
|
|
127
127
|
width: "100%",
|
|
128
|
+
color: colors.surface,
|
|
128
129
|
'& .MuiSlider-rail': {
|
|
129
|
-
|
|
130
|
+
background: tempGradient,
|
|
131
|
+
opacity: 1,
|
|
132
|
+
pointerEvents: 'none', // Make the rail non-interactive
|
|
130
133
|
},
|
|
131
134
|
'& .MuiSlider-track': {
|
|
132
|
-
|
|
135
|
+
background: 'transparent',
|
|
136
|
+
border: 'none',
|
|
137
|
+
pointerEvents: 'none', // Make the track non-interactive
|
|
133
138
|
},
|
|
134
139
|
'& .MuiSlider-thumb': {
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
boxShadow: 'none',
|
|
141
|
+
pointerEvents: 'auto', // IMPORTANT: Re-enable interaction ONLY for the thumb
|
|
142
|
+
touchAction: 'none',
|
|
143
|
+
}
|
|
137
144
|
}, slotProps: {
|
|
138
145
|
thumb: {
|
|
139
146
|
ref: tempSliderRef
|
|
@@ -159,6 +166,7 @@ export default function HSliderColorMobile(props) {
|
|
|
159
166
|
'& .MuiSlider-thumb': {
|
|
160
167
|
boxShadow: 'none',
|
|
161
168
|
pointerEvents: 'auto',
|
|
169
|
+
touchAction: 'none',
|
|
162
170
|
}
|
|
163
171
|
}, slotProps: {
|
|
164
172
|
thumb: {
|
|
@@ -185,6 +193,7 @@ export default function HSliderColorMobile(props) {
|
|
|
185
193
|
'& .MuiSlider-thumb': {
|
|
186
194
|
boxShadow: 'none',
|
|
187
195
|
pointerEvents: 'auto',
|
|
196
|
+
touchAction: 'none',
|
|
188
197
|
}
|
|
189
198
|
}, slotProps: {
|
|
190
199
|
thumb: {
|
|
@@ -211,6 +220,7 @@ export default function HSliderColorMobile(props) {
|
|
|
211
220
|
'& .MuiSlider-thumb': {
|
|
212
221
|
boxShadow: 'none',
|
|
213
222
|
pointerEvents: 'auto',
|
|
223
|
+
touchAction: 'none',
|
|
214
224
|
}
|
|
215
225
|
}, slotProps: {
|
|
216
226
|
thumb: {
|
|
@@ -6,32 +6,29 @@ export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
|
|
|
6
6
|
const element = elementRef.current;
|
|
7
7
|
if (!element)
|
|
8
8
|
return;
|
|
9
|
-
// This handler is attached to the WINDOW
|
|
9
|
+
// This handler is attached to the WINDOW for the 'pointerup' event.
|
|
10
10
|
const handleDragEnd = () => {
|
|
11
11
|
onDragEnd();
|
|
12
|
-
// Clean up the global
|
|
13
|
-
window.removeEventListener('
|
|
14
|
-
window.removeEventListener('touchend', handleDragEnd);
|
|
12
|
+
// Clean up the global listener immediately after the drag ends.
|
|
13
|
+
window.removeEventListener('pointerup', handleDragEnd);
|
|
15
14
|
};
|
|
16
|
-
// This handler is attached to the slider THUMB
|
|
17
|
-
const handleDragStart = () => {
|
|
15
|
+
// This handler is attached to the slider THUMB for the 'pointerdown' event.
|
|
16
|
+
const handleDragStart = (event) => {
|
|
17
|
+
// Prevent the browser from doing default actions like text selection
|
|
18
|
+
event.preventDefault();
|
|
18
19
|
if (!isBatchMode) {
|
|
19
20
|
onDragStart();
|
|
20
21
|
}
|
|
21
22
|
// When dragging starts, listen on the entire window for the end.
|
|
22
|
-
window.addEventListener('
|
|
23
|
-
window.addEventListener('touchend', handleDragEnd);
|
|
23
|
+
window.addEventListener('pointerup', handleDragEnd);
|
|
24
24
|
};
|
|
25
|
-
// Attach "start"
|
|
26
|
-
element.addEventListener('
|
|
27
|
-
element.addEventListener('touchstart', handleDragStart, { passive: true });
|
|
25
|
+
// Attach a single "start" listener to the specific element (the thumb).
|
|
26
|
+
element.addEventListener('pointerdown', handleDragStart);
|
|
28
27
|
// Cleanup function when the component unmounts.
|
|
29
28
|
return () => {
|
|
30
|
-
element.removeEventListener('
|
|
31
|
-
element.removeEventListener('touchstart', handleDragStart);
|
|
29
|
+
element.removeEventListener('pointerdown', handleDragStart);
|
|
32
30
|
// Ensure any lingering window listeners are also removed.
|
|
33
|
-
window.removeEventListener('
|
|
34
|
-
window.removeEventListener('touchend', handleDragEnd);
|
|
31
|
+
window.removeEventListener('pointerup', handleDragEnd);
|
|
35
32
|
};
|
|
36
33
|
}, [onDragStart, onDragEnd, isBatchMode]);
|
|
37
34
|
return elementRef;
|