Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

hammer.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2301          assign(this.options, options);2302  2303          // Options that need a little more setup2304          if (options.touchAction) {2305              this.touchAction.update();2306          }2307          if (options.inputTarget) {2308              // Clean up existing event listeners and reinitialize2309              this.input.destroy();2310              this.input.target = options.inputTarget;2311              this.input.init();2312
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
}
2313 return this;
2314 },
2315
2316 /**
2317 * stop recognizing for this session.
2318 * This session will be discarded, when a new [input]start event is fired.
2319 * When forced, the recognizer cycle is stopped immediately.
2320 * @param {Boolean} [force]
2321 */
2322 stop: function(force) {
2323 this.session.stopped = force ? FORCED_STOP : STOP;
2324 },
2325
2326 /**
2327 * run the recognizers!
2328 * called by the inputHandler function on every movement of the pointers (touches)
2329 * it walks through all the recognizers and tries to detect the gesture that is being made
2330 * @param {Object} inputData
2331 */
2332 recognize: function(inputData) {
2333 var session = this.session;
2334 if (session.stopped) {
2335 return;
2336 }
2337
2338 // run the touch-action polyfill
2339 this.touchAction.preventDefaults(inputData);
2340
2341 var recognizer;
2342 var recognizers = this.recognizers;
2343
2344 // this holds the recognizer that is being recognized.
2345 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
2346 // if no recognizer is detecting a thing, it is set to `null`
2347 var curRecognizer = session.curRecognizer;
2348
2349 // reset when the last recognizer is recognized
2350 // or when we're in a new session
2351 if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
2352 curRecognizer = session.curRecognizer = null;
2353 }
2354
2355 var i = 0;
2356 while (i < recognizers.length) {
2357 recognizer = recognizers[i];
2358
2359 // find out if we are allowed try to recognize the input for this one.
2360 // 1. allow if the session is NOT forced stopped (see the .stop() method)
2361 // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
2362 // that is being recognized.
2363 // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
2364 // this can be setup with the `recognizeWith()` method on the recognizer.
2365 if (session.stopped !== FORCED_STOP && ( // 1
2366 !curRecognizer || recognizer == curRecognizer || // 2
2367 recognizer.canRecognizeWith(curRecognizer))) { // 3
2368 recognizer.recognize(inputData);
2369 } else {
2370 recognizer.reset();
2371 }
2372
2373 // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
2374 // current active recognizer. but only if we don't already have an active recognizer
2375 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
2376 curRecognizer = session.curRecognizer = recognizer;
2377 }
2378 i++;
2379 }
2380 },
2381
2382 /**
2383 * get a recognizer by its event name.
2384 * @param {Recognizer|String} recognizer
2385 * @returns {Recognizer|Null}
2386 */
2387 get: function(recognizer) {
2388 if (recognizer instanceof Recognizer) {
2389 return recognizer;
2390 }
2391
2392 var recognizers = this.recognizers;
2393 for (var i = 0; i < recognizers.length; i++) {
2394 if (recognizers[i].options.event == recognizer) {
2395 return recognizers[i];
2396 }
2397 }
2398 return null;
2399 },
2400
Предыдущие 100 строкСледующие 100 строк