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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

hammer.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2001          return this._super.attrTest.call(this, input) &&2002              direction & input.offsetDirection &&2003              input.distance > this.options.threshold &&2004              input.maxPointers == this.options.pointers &&2005              abs(velocity) > this.options.velocity && input.eventType & INPUT_END;2006      },2007  2008      emit: function(input) {2009          var direction = directionStr(input.offsetDirection);2010          if (direction) {2011              this.manager.emit(this.options.event + direction, input);
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
2012
}
2013
2014 this.manager.emit(this.options.event, input);
2015 }
2016 });
2017
2018 /**
2019 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
2020 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
2021 * a single tap.
2022 *
2023 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
2024 * multi-taps being recognized.
2025 * @constructor
2026 * @extends Recognizer
2027 */
2028 function TapRecognizer() {
2029 Recognizer.apply(this, arguments);
2030
2031 // previous time and center,
2032 // used for tap counting
2033 this.pTime = false;
2034 this.pCenter = false;
2035
2036 this._timer = null;
2037 this._input = null;
2038 this.count = 0;
2039 }
2040
2041 inherit(TapRecognizer, Recognizer, {
2042 /**
2043 * @namespace
2044 * @memberof PinchRecognizer
2045 */
2046 defaults: {
2047 event: 'tap',
2048 pointers: 1,
2049 taps: 1,
2050 interval: 300, // max time between the multi-tap taps
2051 time: 250, // max time of the pointer to be down (like finger on the screen)
2052 threshold: 9, // a minimal movement is ok, but keep it low
2053 posThreshold: 10 // a multi-tap can be a bit off the initial position
2054 },
2055
2056 getTouchAction: function() {
2057 return [TOUCH_ACTION_MANIPULATION];
2058 },
2059
2060 process: function(input) {
2061 var options = this.options;
2062
2063 var validPointers = input.pointers.length === options.pointers;
2064 var validMovement = input.distance < options.threshold;
2065 var validTouchTime = input.deltaTime < options.time;
2066
2067 this.reset();
2068
2069 if ((input.eventType & INPUT_START) && (this.count === 0)) {
2070 return this.failTimeout();
2071 }
2072
2073 // we only allow little movement
2074 // and we've reached an end event, so a tap is possible
2075 if (validMovement && validTouchTime && validPointers) {
2076 if (input.eventType != INPUT_END) {
2077 return this.failTimeout();
2078 }
2079
2080 var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
2081 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
2082
2083 this.pTime = input.timeStamp;
2084 this.pCenter = input.center;
2085
2086 if (!validMultiTap || !validInterval) {
2087 this.count = 1;
2088 } else {
2089 this.count += 1;
2090 }
2091
2092 this._input = input;
2093
2094 // if tap count matches we have recognized it,
2095 // else it has began recognizing...
2096 var tapCount = this.count % options.taps;
2097 if (tapCount === 0) {
2098 // no failing requirements, immediately trigger the tap event
2099 // or wait as long as the multitap interval to trigger
2100 if (!this.hasRequireFailures()) {
Предыдущие 100 строкСледующие 100 строк