@yogiswara/honcho-editor-ui 3.0.2 → 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.
@@ -139,6 +139,7 @@ export default function HSliderColorMobile(props) {
139
139
  '& .MuiSlider-thumb': {
140
140
  boxShadow: 'none',
141
141
  pointerEvents: 'auto', // IMPORTANT: Re-enable interaction ONLY for the thumb
142
+ touchAction: 'none',
142
143
  }
143
144
  }, slotProps: {
144
145
  thumb: {
@@ -165,6 +166,7 @@ export default function HSliderColorMobile(props) {
165
166
  '& .MuiSlider-thumb': {
166
167
  boxShadow: 'none',
167
168
  pointerEvents: 'auto',
169
+ touchAction: 'none',
168
170
  }
169
171
  }, slotProps: {
170
172
  thumb: {
@@ -191,6 +193,7 @@ export default function HSliderColorMobile(props) {
191
193
  '& .MuiSlider-thumb': {
192
194
  boxShadow: 'none',
193
195
  pointerEvents: 'auto',
196
+ touchAction: 'none',
194
197
  }
195
198
  }, slotProps: {
196
199
  thumb: {
@@ -217,6 +220,7 @@ export default function HSliderColorMobile(props) {
217
220
  '& .MuiSlider-thumb': {
218
221
  boxShadow: 'none',
219
222
  pointerEvents: 'auto',
223
+ touchAction: 'none',
220
224
  }
221
225
  }, slotProps: {
222
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 to reliably catch the end of the drag.
9
+ // This handler is attached to the WINDOW for the 'pointerup' event.
10
10
  const handleDragEnd = () => {
11
11
  onDragEnd();
12
- // Clean up the global listeners immediately after they fire.
13
- window.removeEventListener('mouseup', handleDragEnd);
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 to start the drag.
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('mouseup', handleDragEnd);
23
- window.addEventListener('touchend', handleDragEnd);
23
+ window.addEventListener('pointerup', handleDragEnd);
24
24
  };
25
- // Attach "start" listeners to the specific element (the thumb).
26
- element.addEventListener('mousedown', handleDragStart);
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('mousedown', handleDragStart);
31
- element.removeEventListener('touchstart', handleDragStart);
29
+ element.removeEventListener('pointerdown', handleDragStart);
32
30
  // Ensure any lingering window listeners are also removed.
33
- window.removeEventListener('mouseup', handleDragEnd);
34
- window.removeEventListener('touchend', handleDragEnd);
31
+ window.removeEventListener('pointerup', handleDragEnd);
35
32
  };
36
33
  }, [onDragStart, onDragEnd, isBatchMode]);
37
34
  return elementRef;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",