MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / touchend

Function touchend

src/handlers/quickToolsInit.js:262–302  ·  view source on GitHub ↗

* Event handler for touchend event * @param {TouchEvent} e

(e)

Source from the content-addressed store, hash-verified

260 * @param {TouchEvent} e
261 */
262function touchend(e) {
263 const { $row1 } = quickTools;
264 const $el = document.elementFromPoint(
265 e.changedTouches[0].clientX,
266 e.changedTouches[0].clientY,
267 );
268
269 if (touchMoved && $row) {
270 $row.style.scrollBehavior = "smooth";
271 let scroll = 0;
272 if (movedX < 0 && movedX < -MOVE_X_THRESHOLD) {
273 scroll = (slide - 1) * $row.clientWidth;
274 } else if (movedX > 0 && movedX > MOVE_X_THRESHOLD) {
275 scroll = (slide + 1) * $row.clientWidth;
276 } else {
277 scroll = slide * $row.clientWidth;
278 }
279
280 if ($row === $row1) {
281 localStorage.quickToolRow1ScrollLeft = scroll;
282 } else {
283 localStorage.quickToolRow2ScrollLeft = scroll;
284 }
285
286 $row.scrollLeft = scroll;
287 touchcancel(e);
288
289 if ($el === $touchstart && performance.now() - startTime < 100) {
290 click($el);
291 }
292 return;
293 }
294
295 if ($touchstart !== $el || contextmenu) {
296 touchcancel(e);
297 return;
298 }
299
300 touchcancel(e);
301 click($el);
302}
303
304/**
305 *

Callers

nothing calls this directly

Calls 2

touchcancelFunction · 0.85
clickFunction · 0.70

Tested by

no test coverage detected