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

Function touchstart

src/handlers/quickToolsInit.js:167–203  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

165}
166
167function touchstart(e) {
168 reset();
169
170 const $el = e.target;
171 if ($el instanceof HTMLInputElement) {
172 return;
173 }
174 if ($el.disabled) {
175 e.preventDefault();
176 e.stopPropagation();
177 return;
178 }
179
180 startTime = performance.now();
181 $touchstart = $el;
182 e.preventDefault();
183 e.stopPropagation();
184
185 if ($el.dataset.repeat === "true") {
186 contextmenuTimeout = setTimeout(() => {
187 if (touchMoved) return;
188 contextmenu = true;
189 oncontextmenu(e);
190 }, CONTEXT_MENU_TIMEOUT);
191 }
192
193 if ($el.classList.contains("active")) {
194 active = true;
195 } else {
196 $el.classList.add("active");
197 }
198
199 document.addEventListener("touchmove", touchmove);
200 document.addEventListener("keyup", touchcancel);
201 document.addEventListener("touchend", touchend);
202 document.addEventListener("touchcancel", touchcancel);
203}
204
205/**
206 * Event handler for touchmove event

Callers

nothing calls this directly

Calls 5

oncontextmenuFunction · 0.85
addMethod · 0.80
resetFunction · 0.70
preventDefaultMethod · 0.45
stopPropagationMethod · 0.45

Tested by

no test coverage detected