update components
This commit is contained in:
parent
fc3c827c89
commit
ed6ccbba2f
12 changed files with 227 additions and 91 deletions
|
@ -1,20 +1,19 @@
|
||||||
{
|
{
|
||||||
"name": "hammerjs",
|
"name": "hammerjs",
|
||||||
"version": "2.0.4",
|
|
||||||
"main": "hammer.js",
|
"main": "hammer.js",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tests",
|
"tests",
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/hammerjs/hammer.js",
|
"homepage": "https://github.com/hammerjs/hammer.js",
|
||||||
"_release": "2.0.4",
|
"version": "2.0.5",
|
||||||
|
"_release": "2.0.5",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "2.0.4",
|
"tag": "v2.0.5",
|
||||||
"commit": "7fc11efb37d6f2334ce957e26e9cf53690e10fa5"
|
"commit": "4ac915029353faf7cbe3ac9252d84a2621772f85"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/hammerjs/hammer.js.git",
|
"_source": "git://github.com/hammerjs/hammer.js.git",
|
||||||
"_target": "~2.0.4",
|
"_target": "~2.0.4",
|
||||||
"_originalSource": "hammer.js",
|
"_originalSource": "hammer.js"
|
||||||
"_direct": true
|
|
||||||
}
|
}
|
99
dashboard-ui/bower_components/hammerjs/.jscsrc
vendored
99
dashboard-ui/bower_components/hammerjs/.jscsrc
vendored
|
@ -1,8 +1,95 @@
|
||||||
{
|
{
|
||||||
"preset": "google",
|
"excludeFiles": [
|
||||||
"excludeFiles": [
|
"*.js",
|
||||||
"*.js",
|
"tests/**/assets",
|
||||||
"tests/**/assets",
|
"node_modules/**"
|
||||||
"node_modules/**"
|
],
|
||||||
]
|
"requireCurlyBraces": [
|
||||||
|
"if",
|
||||||
|
"else",
|
||||||
|
"for",
|
||||||
|
"while",
|
||||||
|
"do",
|
||||||
|
"try",
|
||||||
|
"catch"
|
||||||
|
],
|
||||||
|
"requireOperatorBeforeLineBreak": true,
|
||||||
|
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
||||||
|
"maximumLineLength": {
|
||||||
|
"value": 120,
|
||||||
|
"allowComments": true,
|
||||||
|
"allowRegex": true
|
||||||
|
},
|
||||||
|
"validateIndentation": 4,
|
||||||
|
"validateQuoteMarks": "'",
|
||||||
|
"disallowMultipleLineStrings": true,
|
||||||
|
"disallowMixedSpacesAndTabs": true,
|
||||||
|
"disallowTrailingWhitespace": true,
|
||||||
|
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||||
|
"requireSpaceAfterKeywords": [
|
||||||
|
"if",
|
||||||
|
"else",
|
||||||
|
"for",
|
||||||
|
"while",
|
||||||
|
"do",
|
||||||
|
"switch",
|
||||||
|
"return",
|
||||||
|
"try",
|
||||||
|
"catch"
|
||||||
|
],
|
||||||
|
"requireSpaceBeforeBinaryOperators": [
|
||||||
|
"=",
|
||||||
|
"+=",
|
||||||
|
"-=",
|
||||||
|
"*=",
|
||||||
|
"/=",
|
||||||
|
"%=",
|
||||||
|
"<<=",
|
||||||
|
">>=",
|
||||||
|
">>>=",
|
||||||
|
"&=",
|
||||||
|
"|=",
|
||||||
|
"^=",
|
||||||
|
"+=",
|
||||||
|
"+",
|
||||||
|
"-",
|
||||||
|
"*",
|
||||||
|
"/",
|
||||||
|
"%",
|
||||||
|
"<<",
|
||||||
|
">>",
|
||||||
|
">>>",
|
||||||
|
"&",
|
||||||
|
"|",
|
||||||
|
"^",
|
||||||
|
"&&",
|
||||||
|
"||",
|
||||||
|
"===",
|
||||||
|
"==",
|
||||||
|
">=",
|
||||||
|
"<=",
|
||||||
|
"<",
|
||||||
|
">",
|
||||||
|
"!=",
|
||||||
|
"!=="
|
||||||
|
],
|
||||||
|
"requireSpaceAfterBinaryOperators": true,
|
||||||
|
"requireSpacesInConditionalExpression": true,
|
||||||
|
"requireSpaceBeforeBlockStatements": true,
|
||||||
|
"requireLineFeedAtFileEnd": true,
|
||||||
|
"requireSpacesInFunctionExpression": {
|
||||||
|
"beforeOpeningCurlyBrace": true
|
||||||
|
},
|
||||||
|
"disallowSpacesInAnonymousFunctionExpression": {
|
||||||
|
"beforeOpeningRoundBrace": true
|
||||||
|
},
|
||||||
|
"disallowSpacesInsideObjectBrackets": "all",
|
||||||
|
"disallowSpacesInsideArrayBrackets": "all",
|
||||||
|
"disallowSpacesInsideParentheses": true,
|
||||||
|
"validateJSDoc": {
|
||||||
|
"checkParamNames": true,
|
||||||
|
"requireParamTypes": true
|
||||||
|
},
|
||||||
|
"disallowMultipleLineBreaks": true,
|
||||||
|
"disallowNewlineBeforeBlockStatements": true
|
||||||
}
|
}
|
|
@ -2,6 +2,8 @@ language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "0.10"
|
- "0.10"
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g grunt-cli
|
- npm install -g grunt-cli
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = (grunt) ->
|
||||||
concat:
|
concat:
|
||||||
build:
|
build:
|
||||||
src: [
|
src: [
|
||||||
'src/hammer.prefix'
|
'src/hammer.prefix.js'
|
||||||
'src/utils.js'
|
'src/utils.js'
|
||||||
'src/input.js'
|
'src/input.js'
|
||||||
'src/input/*.js'
|
'src/input/*.js'
|
||||||
|
@ -29,7 +29,7 @@ module.exports = (grunt) ->
|
||||||
'src/hammer.js'
|
'src/hammer.js'
|
||||||
'src/manager.js'
|
'src/manager.js'
|
||||||
'src/expose.js'
|
'src/expose.js'
|
||||||
'src/hammer.suffix']
|
'src/hammer.suffix.js']
|
||||||
dest: 'hammer.js'
|
dest: 'hammer.js'
|
||||||
|
|
||||||
uglify:
|
uglify:
|
||||||
|
@ -80,8 +80,9 @@ module.exports = (grunt) ->
|
||||||
|
|
||||||
jscs:
|
jscs:
|
||||||
src: [
|
src: [
|
||||||
'src/**/*.js'
|
'src/**/*.js',
|
||||||
'tests/unit/*.js'
|
'!src/hammer.prefix.js',
|
||||||
|
'!src/hammer.suffix.js'
|
||||||
]
|
]
|
||||||
options:
|
options:
|
||||||
config: "./.jscsrc"
|
config: "./.jscsrc"
|
||||||
|
@ -113,7 +114,7 @@ module.exports = (grunt) ->
|
||||||
grunt.loadNpmTasks 'grunt-contrib-connect'
|
grunt.loadNpmTasks 'grunt-contrib-connect'
|
||||||
grunt.loadNpmTasks 'grunt-string-replace'
|
grunt.loadNpmTasks 'grunt-string-replace'
|
||||||
grunt.loadNpmTasks 'grunt-banner'
|
grunt.loadNpmTasks 'grunt-banner'
|
||||||
grunt.loadNpmTasks 'grunt-jscs-checker'
|
grunt.loadNpmTasks 'grunt-jscs'
|
||||||
|
|
||||||
# Default task(s)
|
# Default task(s)
|
||||||
grunt.registerTask 'default', ['connect', 'watch']
|
grunt.registerTask 'default', ['connect', 'watch']
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "hammerjs",
|
"name": "hammerjs",
|
||||||
"version": "2.0.4",
|
|
||||||
"main": "hammer.js",
|
"main": "hammer.js",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tests",
|
"tests",
|
||||||
|
|
153
dashboard-ui/bower_components/hammerjs/hammer.js
vendored
153
dashboard-ui/bower_components/hammerjs/hammer.js
vendored
|
@ -1,12 +1,12 @@
|
||||||
/*! Hammer.JS - v2.0.4 - 2014-09-28
|
/*! Hammer.JS - v2.0.4 - 2015-12-22
|
||||||
* http://hammerjs.github.io/
|
* http://hammerjs.github.io/
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Jorik Tangelder;
|
* Copyright (c) 2015 Jorik Tangelder;
|
||||||
* Licensed under the MIT license */
|
* Licensed under the license */
|
||||||
(function(window, document, exportName, undefined) {
|
(function(window, document, exportName, undefined) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
|
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
||||||
var TEST_ELEMENT = document.createElement('div');
|
var TEST_ELEMENT = document.createElement('div');
|
||||||
|
|
||||||
var TYPE_FUNCTION = 'function';
|
var TYPE_FUNCTION = 'function';
|
||||||
|
@ -320,8 +320,8 @@ function uniqueId() {
|
||||||
* @returns {DocumentView|Window}
|
* @returns {DocumentView|Window}
|
||||||
*/
|
*/
|
||||||
function getWindowForElement(element) {
|
function getWindowForElement(element) {
|
||||||
var doc = element.ownerDocument;
|
var doc = element.ownerDocument || element;
|
||||||
return (doc.defaultView || doc.parentWindow);
|
return (doc.defaultView || doc.parentWindow || window);
|
||||||
}
|
}
|
||||||
|
|
||||||
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
||||||
|
@ -500,9 +500,17 @@ function computeInputData(manager, input) {
|
||||||
computeDeltaXY(session, input);
|
computeDeltaXY(session, input);
|
||||||
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
||||||
|
|
||||||
|
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
|
||||||
|
input.overallVelocityX = overallVelocity.x;
|
||||||
|
input.overallVelocityY = overallVelocity.y;
|
||||||
|
input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
|
||||||
|
|
||||||
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
||||||
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
||||||
|
|
||||||
|
input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
|
||||||
|
session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
|
||||||
|
|
||||||
computeIntervalInputData(session, input);
|
computeIntervalInputData(session, input);
|
||||||
|
|
||||||
// find the correct target
|
// find the correct target
|
||||||
|
@ -546,8 +554,8 @@ function computeIntervalInputData(session, input) {
|
||||||
velocity, velocityX, velocityY, direction;
|
velocity, velocityX, velocityY, direction;
|
||||||
|
|
||||||
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
||||||
var deltaX = last.deltaX - input.deltaX;
|
var deltaX = input.deltaX - last.deltaX;
|
||||||
var deltaY = last.deltaY - input.deltaY;
|
var deltaY = input.deltaY - last.deltaY;
|
||||||
|
|
||||||
var v = getVelocity(deltaTime, deltaX, deltaY);
|
var v = getVelocity(deltaTime, deltaX, deltaY);
|
||||||
velocityX = v.x;
|
velocityX = v.x;
|
||||||
|
@ -652,9 +660,9 @@ function getDirection(x, y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(x) >= abs(y)) {
|
if (abs(x) >= abs(y)) {
|
||||||
return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||||
}
|
}
|
||||||
return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -697,7 +705,7 @@ function getAngle(p1, p2, props) {
|
||||||
* @return {Number} rotation
|
* @return {Number} rotation
|
||||||
*/
|
*/
|
||||||
function getRotation(start, end) {
|
function getRotation(start, end) {
|
||||||
return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -790,7 +798,7 @@ var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
||||||
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
||||||
|
|
||||||
// IE10 has prefixed support, and case-sensitive
|
// IE10 has prefixed support, and case-sensitive
|
||||||
if (window.MSPointerEvent) {
|
if (window.MSPointerEvent && !window.PointerEvent) {
|
||||||
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
||||||
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1122,7 @@ TouchAction.prototype = {
|
||||||
value = this.compute();
|
value = this.compute();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NATIVE_TOUCH_ACTION) {
|
if (NATIVE_TOUCH_ACTION && this.manager.element.style) {
|
||||||
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
||||||
}
|
}
|
||||||
this.actions = value.toLowerCase().trim();
|
this.actions = value.toLowerCase().trim();
|
||||||
|
@ -1165,6 +1173,23 @@ TouchAction.prototype = {
|
||||||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||||
|
|
||||||
|
if (hasNone) {
|
||||||
|
//do not prevent defaults if this is a tap gesture
|
||||||
|
|
||||||
|
var isTapPointer = input.pointers.length === 1;
|
||||||
|
var isTapMovement = input.distance < 2;
|
||||||
|
var isTapTouchTime = input.deltaTime < 250;
|
||||||
|
|
||||||
|
if (isTapPointer && isTapMovement && isTapTouchTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPanX && hasPanY) {
|
||||||
|
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasNone ||
|
if (hasNone ||
|
||||||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
||||||
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
||||||
|
@ -1196,9 +1221,12 @@ function cleanTouchActions(actions) {
|
||||||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||||
|
|
||||||
// pan-x and pan-y can be combined
|
// if both pan-x and pan-y are set (different recognizers
|
||||||
|
// for different directions, e.g. horizontal pan but vertical swipe?)
|
||||||
|
// we need none (as otherwise with pan-x pan-y combined none of these
|
||||||
|
// recognizers will work, since the browser would handle all panning
|
||||||
if (hasPanX && hasPanY) {
|
if (hasPanX && hasPanY) {
|
||||||
return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
|
return TOUCH_ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pan-x OR pan-y
|
// pan-x OR pan-y
|
||||||
|
@ -1256,10 +1284,13 @@ var STATE_FAILED = 32;
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
function Recognizer(options) {
|
function Recognizer(options) {
|
||||||
|
// make sure, options are copied over to a new object to prevent leaking it outside
|
||||||
|
options = extend({}, options || {});
|
||||||
|
|
||||||
this.id = uniqueId();
|
this.id = uniqueId();
|
||||||
|
|
||||||
this.manager = null;
|
this.manager = null;
|
||||||
this.options = merge(options || {}, this.defaults);
|
this.options = merge(options, this.defaults);
|
||||||
|
|
||||||
// default is enable true
|
// default is enable true
|
||||||
this.options.enable = ifUndefined(this.options.enable, true);
|
this.options.enable = ifUndefined(this.options.enable, true);
|
||||||
|
@ -1387,20 +1418,24 @@ Recognizer.prototype = {
|
||||||
var self = this;
|
var self = this;
|
||||||
var state = this.state;
|
var state = this.state;
|
||||||
|
|
||||||
function emit(withState) {
|
function emit(event) {
|
||||||
self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input);
|
self.manager.emit(event, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'panstart' and 'panmove'
|
// 'panstart' and 'panmove'
|
||||||
if (state < STATE_ENDED) {
|
if (state < STATE_ENDED) {
|
||||||
emit(true);
|
emit(self.options.event + stateStr(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(); // simple 'eventName' events
|
emit(self.options.event); // simple 'eventName' events
|
||||||
|
|
||||||
|
if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
|
||||||
|
emit(input.additionalEvent);
|
||||||
|
}
|
||||||
|
|
||||||
// panend and pancancel
|
// panend and pancancel
|
||||||
if (state >= STATE_ENDED) {
|
if (state >= STATE_ENDED) {
|
||||||
emit(true);
|
emit(self.options.event + stateStr(state));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1665,14 +1700,15 @@ inherit(PanRecognizer, AttrRecognizer, {
|
||||||
},
|
},
|
||||||
|
|
||||||
emit: function(input) {
|
emit: function(input) {
|
||||||
|
|
||||||
this.pX = input.deltaX;
|
this.pX = input.deltaX;
|
||||||
this.pY = input.deltaY;
|
this.pY = input.deltaY;
|
||||||
|
|
||||||
var direction = directionStr(input.direction);
|
var direction = directionStr(input.direction);
|
||||||
if (direction) {
|
|
||||||
this.manager.emit(this.options.event + direction, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (direction) {
|
||||||
|
input.additionalEvent = this.options.event + direction;
|
||||||
|
}
|
||||||
this._super.emit.call(this, input);
|
this._super.emit.call(this, input);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1708,11 +1744,11 @@ inherit(PinchRecognizer, AttrRecognizer, {
|
||||||
},
|
},
|
||||||
|
|
||||||
emit: function(input) {
|
emit: function(input) {
|
||||||
this._super.emit.call(this, input);
|
|
||||||
if (input.scale !== 1) {
|
if (input.scale !== 1) {
|
||||||
var inOut = input.scale < 1 ? 'in' : 'out';
|
var inOut = input.scale < 1 ? 'in' : 'out';
|
||||||
this.manager.emit(this.options.event + inOut, input);
|
input.additionalEvent = this.options.event + inOut;
|
||||||
}
|
}
|
||||||
|
this._super.emit.call(this, input);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1737,8 +1773,8 @@ inherit(PressRecognizer, Recognizer, {
|
||||||
defaults: {
|
defaults: {
|
||||||
event: 'press',
|
event: 'press',
|
||||||
pointers: 1,
|
pointers: 1,
|
||||||
time: 500, // minimal time of the pointer to be pressed
|
time: 251, // minimal time of the pointer to be pressed
|
||||||
threshold: 5 // a minimal movement is ok, but keep it low
|
threshold: 9 // a minimal movement is ok, but keep it low
|
||||||
},
|
},
|
||||||
|
|
||||||
getTouchAction: function() {
|
getTouchAction: function() {
|
||||||
|
@ -1836,7 +1872,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
||||||
defaults: {
|
defaults: {
|
||||||
event: 'swipe',
|
event: 'swipe',
|
||||||
threshold: 10,
|
threshold: 10,
|
||||||
velocity: 0.65,
|
velocity: 0.3,
|
||||||
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
||||||
pointers: 1
|
pointers: 1
|
||||||
},
|
},
|
||||||
|
@ -1850,21 +1886,22 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
||||||
var velocity;
|
var velocity;
|
||||||
|
|
||||||
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
||||||
velocity = input.velocity;
|
velocity = input.overallVelocity;
|
||||||
} else if (direction & DIRECTION_HORIZONTAL) {
|
} else if (direction & DIRECTION_HORIZONTAL) {
|
||||||
velocity = input.velocityX;
|
velocity = input.overallVelocityX;
|
||||||
} else if (direction & DIRECTION_VERTICAL) {
|
} else if (direction & DIRECTION_VERTICAL) {
|
||||||
velocity = input.velocityY;
|
velocity = input.overallVelocityY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._super.attrTest.call(this, input) &&
|
return this._super.attrTest.call(this, input) &&
|
||||||
direction & input.direction &&
|
direction & input.offsetDirection &&
|
||||||
input.distance > this.options.threshold &&
|
input.distance > this.options.threshold &&
|
||||||
|
input.maxPointers == this.options.pointers &&
|
||||||
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
||||||
},
|
},
|
||||||
|
|
||||||
emit: function(input) {
|
emit: function(input) {
|
||||||
var direction = directionStr(input.direction);
|
var direction = directionStr(input.offsetDirection);
|
||||||
if (direction) {
|
if (direction) {
|
||||||
this.manager.emit(this.options.event + direction, input);
|
this.manager.emit(this.options.event + direction, input);
|
||||||
}
|
}
|
||||||
|
@ -1907,7 +1944,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||||
taps: 1,
|
taps: 1,
|
||||||
interval: 300, // max time between the multi-tap taps
|
interval: 300, // max time between the multi-tap taps
|
||||||
time: 250, // max time of the pointer to be down (like finger on the screen)
|
time: 250, // max time of the pointer to be down (like finger on the screen)
|
||||||
threshold: 2, // a minimal movement is ok, but keep it low
|
threshold: 9, // a minimal movement is ok, but keep it low
|
||||||
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1981,7 +2018,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||||
},
|
},
|
||||||
|
|
||||||
emit: function() {
|
emit: function() {
|
||||||
if (this.state == STATE_RECOGNIZED ) {
|
if (this.state == STATE_RECOGNIZED) {
|
||||||
this._input.tapCount = this.count;
|
this._input.tapCount = this.count;
|
||||||
this.manager.emit(this.options.event, this._input);
|
this.manager.emit(this.options.event, this._input);
|
||||||
}
|
}
|
||||||
|
@ -1989,7 +2026,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple way to create an manager with a default set of recognizers.
|
* Simple way to create a manager with a default set of recognizers.
|
||||||
* @param {HTMLElement} element
|
* @param {HTMLElement} element
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @constructor
|
* @constructor
|
||||||
|
@ -2055,12 +2092,12 @@ Hammer.defaults = {
|
||||||
*/
|
*/
|
||||||
preset: [
|
preset: [
|
||||||
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
|
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
|
||||||
[RotateRecognizer, { enable: false }],
|
[RotateRecognizer, {enable: false}],
|
||||||
[PinchRecognizer, { enable: false }, ['rotate']],
|
[PinchRecognizer, {enable: false}, ['rotate']],
|
||||||
[SwipeRecognizer,{ direction: DIRECTION_HORIZONTAL }],
|
[SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
|
||||||
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],
|
[PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
|
||||||
[TapRecognizer],
|
[TapRecognizer],
|
||||||
[TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],
|
[TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
|
||||||
[PressRecognizer]
|
[PressRecognizer]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -2127,9 +2164,9 @@ var FORCED_STOP = 2;
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Manager(element, options) {
|
function Manager(element, options) {
|
||||||
options = options || {};
|
var newOptions = options ? extend({}, options) : {};
|
||||||
|
this.options = merge(newOptions, Hammer.defaults);
|
||||||
|
|
||||||
this.options = merge(options, Hammer.defaults);
|
|
||||||
this.options.inputTarget = this.options.inputTarget || element;
|
this.options.inputTarget = this.options.inputTarget || element;
|
||||||
|
|
||||||
this.handlers = {};
|
this.handlers = {};
|
||||||
|
@ -2142,7 +2179,7 @@ function Manager(element, options) {
|
||||||
|
|
||||||
toggleCssProps(this, true);
|
toggleCssProps(this, true);
|
||||||
|
|
||||||
each(options.recognizers, function(item) {
|
each(this.options.recognizers, function(item) {
|
||||||
var recognizer = this.add(new (item[0])(item[1]));
|
var recognizer = this.add(new (item[0])(item[1]));
|
||||||
item[2] && recognizer.recognizeWith(item[2]);
|
item[2] && recognizer.recognizeWith(item[2]);
|
||||||
item[3] && recognizer.requireFailure(item[3]);
|
item[3] && recognizer.requireFailure(item[3]);
|
||||||
|
@ -2290,11 +2327,19 @@ Manager.prototype = {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
var recognizers = this.recognizers;
|
|
||||||
recognizer = this.get(recognizer);
|
recognizer = this.get(recognizer);
|
||||||
recognizers.splice(inArray(recognizers, recognizer), 1);
|
|
||||||
|
|
||||||
this.touchAction.update();
|
// let's make sure this recognizer exists
|
||||||
|
if (recognizer) {
|
||||||
|
var recognizers = this.recognizers;
|
||||||
|
var index = inArray(recognizers, recognizer);
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
recognizers.splice(index, 1);
|
||||||
|
this.touchAction.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2325,7 +2370,7 @@ Manager.prototype = {
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
delete handlers[event];
|
delete handlers[event];
|
||||||
} else {
|
} else {
|
||||||
handlers[event].splice(inArray(handlers[event], handler), 1);
|
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
|
@ -2381,6 +2426,9 @@ Manager.prototype = {
|
||||||
*/
|
*/
|
||||||
function toggleCssProps(manager, add) {
|
function toggleCssProps(manager, add) {
|
||||||
var element = manager.element;
|
var element = manager.element;
|
||||||
|
if (!element.style) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
each(manager.options.cssProps, function(value, name) {
|
each(manager.options.cssProps, function(value, name) {
|
||||||
element.style[prefixed(element.style, name)] = add ? value : '';
|
element.style[prefixed(element.style, name)] = add ? value : '';
|
||||||
});
|
});
|
||||||
|
@ -2450,7 +2498,12 @@ extend(Hammer, {
|
||||||
prefixed: prefixed
|
prefixed: prefixed
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof define == TYPE_FUNCTION && define.amd) {
|
// this prevents errors when Hammer is loaded in the presence of an AMD
|
||||||
|
// style loader but by script tag, not by the loader.
|
||||||
|
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
|
||||||
|
freeGlobal.Hammer = Hammer;
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(function() {
|
define(function() {
|
||||||
return Hammer;
|
return Hammer;
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,14 +2,9 @@
|
||||||
"name": "hammerjs",
|
"name": "hammerjs",
|
||||||
"title": "Hammer.JS",
|
"title": "Hammer.JS",
|
||||||
"description": "A javascript library for multi-touch gestures",
|
"description": "A javascript library for multi-touch gestures",
|
||||||
"version": "2.0.4",
|
"version": "2.0.5",
|
||||||
"homepage": "http://hammerjs.github.io/",
|
"homepage": "http://hammerjs.github.io/",
|
||||||
"licenses": [
|
"license": "MIT",
|
||||||
{
|
|
||||||
"type": "MIT",
|
|
||||||
"url": "https://github.com/hammerjs/hammer.js/blob/master/LICENSE.md"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"touch",
|
"touch",
|
||||||
"gestures"
|
"gestures"
|
||||||
|
@ -35,9 +30,9 @@
|
||||||
"grunt-contrib-qunit": "^0.5.1",
|
"grunt-contrib-qunit": "^0.5.1",
|
||||||
"grunt-contrib-uglify": "0.4.x",
|
"grunt-contrib-uglify": "0.4.x",
|
||||||
"grunt-contrib-watch": "0.6.x",
|
"grunt-contrib-watch": "0.6.x",
|
||||||
"grunt-jscs-checker": "^0.4.1",
|
"grunt-jscs": "^0.8.0",
|
||||||
"grunt-string-replace": "^0.2.7",
|
"grunt-string-replace": "^0.2.7",
|
||||||
"hammer-jquery": "git://github.com/hammerjs/jquery.hammer.js#master",
|
"jquery-hammerjs": "2.0.x",
|
||||||
"hammer-simulator": "git://github.com/hammerjs/simulator#master"
|
"hammer-simulator": "git://github.com/hammerjs/simulator#master"
|
||||||
},
|
},
|
||||||
"main": "hammer.js",
|
"main": "hammer.js",
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
"iron-component-page": "polymerelements/iron-component-page#^1.0.0"
|
"iron-component-page": "polymerelements/iron-component-page#^1.0.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/polymerelements/iron-flex-layout",
|
"homepage": "https://github.com/PolymerElements/iron-flex-layout",
|
||||||
"_release": "1.2.2",
|
"_release": "1.2.2",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.2.2",
|
"tag": "v1.2.2",
|
||||||
"commit": "41c4f35be1368afb770312b907a258175565dbdf"
|
"commit": "41c4f35be1368afb770312b907a258175565dbdf"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/iron-flex-layout.git",
|
"_source": "git://github.com/PolymerElements/iron-flex-layout.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/iron-flex-layout"
|
"_originalSource": "PolymerElements/iron-flex-layout"
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@
|
||||||
"tag": "v1.0.5",
|
"tag": "v1.0.5",
|
||||||
"commit": "8a906004d8d0071004aafcd4bc4536ed2cf14bde"
|
"commit": "8a906004d8d0071004aafcd4bc4536ed2cf14bde"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-material.git",
|
"_source": "git://github.com/PolymerElements/paper-material.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-material"
|
"_originalSource": "PolymerElements/paper-material"
|
||||||
}
|
}
|
|
@ -32,14 +32,14 @@
|
||||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/polymerelements/paper-ripple",
|
"homepage": "https://github.com/PolymerElements/paper-ripple",
|
||||||
"_release": "1.0.5",
|
"_release": "1.0.5",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.0.5",
|
"tag": "v1.0.5",
|
||||||
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
"_source": "git://github.com/PolymerElements/paper-ripple.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-ripple"
|
"_originalSource": "PolymerElements/paper-ripple"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue