@onesy/ui-react 1.0.175 → 1.0.176
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.
- package/Interaction/Interaction.js +22 -14
- package/esm/Interaction/Interaction.js +22 -14
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -232,22 +232,32 @@ const Interaction = props_ => {
|
|
|
232
232
|
remove('mouse-down');
|
|
233
233
|
removeWaves();
|
|
234
234
|
};
|
|
235
|
+
const onTouchStart = () => {
|
|
236
|
+
onMouseUp();
|
|
237
|
+
onMouseIn();
|
|
238
|
+
};
|
|
239
|
+
const onTouchUp = () => {
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
onMouseUp();
|
|
242
|
+
onMouseOut();
|
|
243
|
+
}, 15);
|
|
244
|
+
};
|
|
245
|
+
const onTouchCancel = () => {
|
|
246
|
+
setTimeout(() => {
|
|
247
|
+
onMouseUp();
|
|
248
|
+
onMouseOut();
|
|
249
|
+
}, 15);
|
|
250
|
+
};
|
|
235
251
|
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current = refs.root.current) === null || _refs$root$current === void 0 ? void 0 : _refs$root$current.ownerDocument) || window.document : undefined;
|
|
236
252
|
if (parent) {
|
|
237
253
|
if (touch) {
|
|
238
|
-
parent.addEventListener('touchstart',
|
|
239
|
-
passive: true
|
|
240
|
-
});
|
|
241
|
-
parent.addEventListener('touchend', onMouseUp, {
|
|
242
|
-
passive: true
|
|
243
|
-
});
|
|
244
|
-
rootDocument.addEventListener('touchend', onMouseUp, {
|
|
254
|
+
parent.addEventListener('touchstart', onTouchStart, {
|
|
245
255
|
passive: true
|
|
246
256
|
});
|
|
247
|
-
|
|
257
|
+
rootDocument.addEventListener('touchend', onTouchUp, {
|
|
248
258
|
passive: true
|
|
249
259
|
});
|
|
250
|
-
|
|
260
|
+
rootDocument.addEventListener('touchcancel', onTouchCancel, {
|
|
251
261
|
passive: true
|
|
252
262
|
});
|
|
253
263
|
} else {
|
|
@@ -261,11 +271,9 @@ const Interaction = props_ => {
|
|
|
261
271
|
refs.init.current = true;
|
|
262
272
|
return () => {
|
|
263
273
|
if (parent) {
|
|
264
|
-
parent.removeEventListener('touchstart',
|
|
265
|
-
|
|
266
|
-
rootDocument.removeEventListener('
|
|
267
|
-
parent.removeEventListener('touchstart', onMouseIn);
|
|
268
|
-
parent.removeEventListener('touchend', onMouseOut);
|
|
274
|
+
parent.removeEventListener('touchstart', onTouchStart);
|
|
275
|
+
rootDocument.removeEventListener('touchend', onTouchUp);
|
|
276
|
+
rootDocument.removeEventListener('touchcancel', onTouchCancel);
|
|
269
277
|
parent.removeEventListener('mousedown', onMouseDown);
|
|
270
278
|
parent.removeEventListener('mouseup', onMouseUp);
|
|
271
279
|
rootDocument.removeEventListener('mouseup', onMouseUp);
|
|
@@ -223,22 +223,32 @@ const Interaction = props_ => {
|
|
|
223
223
|
remove('mouse-down');
|
|
224
224
|
removeWaves();
|
|
225
225
|
};
|
|
226
|
+
const onTouchStart = () => {
|
|
227
|
+
onMouseUp();
|
|
228
|
+
onMouseIn();
|
|
229
|
+
};
|
|
230
|
+
const onTouchUp = () => {
|
|
231
|
+
setTimeout(() => {
|
|
232
|
+
onMouseUp();
|
|
233
|
+
onMouseOut();
|
|
234
|
+
}, 15);
|
|
235
|
+
};
|
|
236
|
+
const onTouchCancel = () => {
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
onMouseUp();
|
|
239
|
+
onMouseOut();
|
|
240
|
+
}, 15);
|
|
241
|
+
};
|
|
226
242
|
const rootDocument = isEnvironment('browser') ? refs.root.current?.ownerDocument || window.document : undefined;
|
|
227
243
|
if (parent) {
|
|
228
244
|
if (touch) {
|
|
229
|
-
parent.addEventListener('touchstart',
|
|
230
|
-
passive: true
|
|
231
|
-
});
|
|
232
|
-
parent.addEventListener('touchend', onMouseUp, {
|
|
233
|
-
passive: true
|
|
234
|
-
});
|
|
235
|
-
rootDocument.addEventListener('touchend', onMouseUp, {
|
|
245
|
+
parent.addEventListener('touchstart', onTouchStart, {
|
|
236
246
|
passive: true
|
|
237
247
|
});
|
|
238
|
-
|
|
248
|
+
rootDocument.addEventListener('touchend', onTouchUp, {
|
|
239
249
|
passive: true
|
|
240
250
|
});
|
|
241
|
-
|
|
251
|
+
rootDocument.addEventListener('touchcancel', onTouchCancel, {
|
|
242
252
|
passive: true
|
|
243
253
|
});
|
|
244
254
|
} else {
|
|
@@ -252,11 +262,9 @@ const Interaction = props_ => {
|
|
|
252
262
|
refs.init.current = true;
|
|
253
263
|
return () => {
|
|
254
264
|
if (parent) {
|
|
255
|
-
parent.removeEventListener('touchstart',
|
|
256
|
-
|
|
257
|
-
rootDocument.removeEventListener('
|
|
258
|
-
parent.removeEventListener('touchstart', onMouseIn);
|
|
259
|
-
parent.removeEventListener('touchend', onMouseOut);
|
|
265
|
+
parent.removeEventListener('touchstart', onTouchStart);
|
|
266
|
+
rootDocument.removeEventListener('touchend', onTouchUp);
|
|
267
|
+
rootDocument.removeEventListener('touchcancel', onTouchCancel);
|
|
260
268
|
parent.removeEventListener('mousedown', onMouseDown);
|
|
261
269
|
parent.removeEventListener('mouseup', onMouseUp);
|
|
262
270
|
rootDocument.removeEventListener('mouseup', onMouseUp);
|
package/esm/index.js
CHANGED
package/index.js
CHANGED