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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

hammer.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1501       * has require failures boolean1502       * @returns {boolean}1503       */1504      hasRequireFailures: function() {1505          return this.requireFail.length > 0;1506      },1507  1508      /**1509       * if the recognizer can recognize simultaneous with an other recognizer1510       * @param {Recognizer} otherRecognizer1511       * @returns {Boolean}1512
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
*/
1513 canRecognizeWith: function(otherRecognizer) {
1514 return !!this.simultaneous[otherRecognizer.id];
1515 },
1516
1517 /**
1518 * You should use `tryEmit` instead of `emit` directly to check
1519 * that all the needed recognizers has failed before emitting.
1520 * @param {Object} input
1521 */
1522 emit: function(input) {
1523 var self = this;
1524 var state = this.state;
1525
1526 function emit(event) {
1527 self.manager.emit(event, input);
1528 }
1529
1530 // 'panstart' and 'panmove'
1531 if (state < STATE_ENDED) {
1532 emit(self.options.event + stateStr(state));
1533 }
1534
1535 emit(self.options.event); // simple 'eventName' events
1536
1537 if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
1538 emit(input.additionalEvent);
1539 }
1540
1541 // panend and pancancel
1542 if (state >= STATE_ENDED) {
1543 emit(self.options.event + stateStr(state));
1544 }
1545 },
1546
1547 /**
1548 * Check that all the require failure recognizers has failed,
1549 * if true, it emits a gesture event,
1550 * otherwise, setup the state to FAILED.
1551 * @param {Object} input
1552 */
1553 tryEmit: function(input) {
1554 if (this.canEmit()) {
1555 return this.emit(input);
1556 }
1557 // it's failing anyway
1558 this.state = STATE_FAILED;
1559 },
1560
1561 /**
1562 * can we emit?
1563 * @returns {boolean}
1564 */
1565 canEmit: function() {
1566 var i = 0;
1567 while (i < this.requireFail.length) {
1568 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
1569 return false;
1570 }
1571 i++;
1572 }
1573 return true;
1574 },
1575
1576 /**
1577 * update the recognizer
1578 * @param {Object} inputData
1579 */
1580 recognize: function(inputData) {
1581 // make a new copy of the inputData
1582 // so we can change the inputData without messing up the other recognizers
1583 var inputDataClone = assign({}, inputData);
1584
1585 // is is enabled and allow recognizing?
1586 if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
1587 this.reset();
1588 this.state = STATE_FAILED;
1589 return;
1590 }
1591
1592 // reset when we've reached the end
1593 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
1594 this.state = STATE_POSSIBLE;
1595 }
1596
1597 this.state = this.process(inputDataClone);
1598
1599 // the recognizer has recognized a gesture
1600 // so trigger an event
Предыдущие 100 строкСледующие 100 строк