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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

hammer.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1301  1302  /**1303   * when the touchActions are collected they are not a valid value, so we need to clean things up. *1304   * @param {String} actions1305   * @returns {*}1306   */1307  function cleanTouchActions(actions) {1308      // none1309      if (inStr(actions, TOUCH_ACTION_NONE)) {1310          return TOUCH_ACTION_NONE;1311      }1312  
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
1313 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
1314 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
1315
1316 // if both pan-x and pan-y are set (different recognizers
1317 // for different directions, e.g. horizontal pan but vertical swipe?)
1318 // we need none (as otherwise with pan-x pan-y combined none of these
1319 // recognizers will work, since the browser would handle all panning
1320 if (hasPanX && hasPanY) {
1321 return TOUCH_ACTION_NONE;
1322 }
1323
1324 // pan-x OR pan-y
1325 if (hasPanX || hasPanY) {
1326 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
1327 }
1328
1329 // manipulation
1330 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
1331 return TOUCH_ACTION_MANIPULATION;
1332 }
1333
1334 return TOUCH_ACTION_AUTO;
1335 }
1336
1337 function getTouchActionProps() {
1338 if (!NATIVE_TOUCH_ACTION) {
1339 return false;
1340 }
1341 var touchMap = {};
1342 var cssSupports = window.CSS && window.CSS.supports;
1343 ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {
1344
1345 // If css.supports is not supported but there is native touch-action assume it supports
1346 // all values. This is the case for IE 10 and 11.
1347 touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
1348 });
1349 return touchMap;
1350 }
1351
1352 /**
1353 * Recognizer flow explained; *
1354 * All recognizers have the initial state of POSSIBLE when a input session starts.
1355 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
1356 * Example session for mouse-input: mousedown -> mousemove -> mouseup
1357 *
1358 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
1359 * which determines with state it should be.
1360 *
1361 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
1362 * POSSIBLE to give it another change on the next cycle.
1363 *
1364 * Possible
1365 * |
1366 * +-----+---------------+
1367 * | |
1368 * +-----+-----+ |
1369 * | | |
1370 * Failed Cancelled |
1371 * +-------+------+
1372 * | |
1373 * Recognized Began
1374 * |
1375 * Changed
1376 * |
1377 * Ended/Recognized
1378 */
1379 var STATE_POSSIBLE = 1;
1380 var STATE_BEGAN = 2;
1381 var STATE_CHANGED = 4;
1382 var STATE_ENDED = 8;
1383 var STATE_RECOGNIZED = STATE_ENDED;
1384 var STATE_CANCELLED = 16;
1385 var STATE_FAILED = 32;
1386
1387 /**
1388 * Recognizer
1389 * Every recognizer needs to extend from this class.
1390 * @constructor
1391 * @param {Object} options
1392 */
1393 function Recognizer(options) {
1394 this.options = assign({}, this.defaults, options || {});
1395
1396 this.id = uniqueId();
1397
1398 this.manager = null;
1399
1400 // default is enable true
Предыдущие 100 строкСледующие 100 строк