fix multi-select

This commit is contained in:
Luke Pulverenti 2015-12-25 21:54:04 -05:00
parent 276a058b95
commit 9af2992260
17 changed files with 208 additions and 375 deletions

View File

@ -3,15 +3,23 @@
"main": "hammer.js",
"ignore": [
"tests",
"src"
"src",
".bowerrc",
".gitignore",
".jscsrc",
".jshintrc",
".travis.yml",
"component.json",
"Gruntfile.coffee",
"package.json"
],
"homepage": "https://github.com/hammerjs/hammer.js",
"version": "2.0.5",
"_release": "2.0.5",
"version": "2.0.6",
"_release": "2.0.6",
"_resolution": {
"type": "version",
"tag": "v2.0.5",
"commit": "4ac915029353faf7cbe3ac9252d84a2621772f85"
"tag": "v2.0.6",
"commit": "05f0872c6130daf537bad27a393310cd5833c9a1"
},
"_source": "git://github.com/hammerjs/hammer.js.git",
"_target": "~2.0.4",

View File

@ -1,3 +0,0 @@
{
"json": "bower.json"
}

View File

@ -1,21 +0,0 @@
# ide
.idea
.iml
# node
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
tests/build.js
npm-debug.log
node_modules

View File

@ -1,95 +0,0 @@
{
"excludeFiles": [
"*.js",
"tests/**/assets",
"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
}

View File

@ -1,22 +0,0 @@
{
"browser": true,
"curly": true,
"eqnull": true,
"expr": true,
"maxerr": 100,
"freeze": true,
"newcap": true,
"node": true,
"quotmark": "single",
"strict": true,
"sub": true,
"trailing": true,
"undef": true,
"unused": true,
"camelcase": true,
"indent": 4,
"validthis": true,
"globals": {
"define": false
}
}

View File

@ -1,11 +0,0 @@
language: node_js
node_js:
- "0.10"
sudo: false
before_script:
- npm install -g grunt-cli
script:
- grunt test-travis

View File

@ -1,5 +1,29 @@
# Changelog
### 2.0.6, 2015-12-23
- Add Assign method and deprecate merge and extend ([#895](https://github.com/hammerjs/hammer.js/pull/895)[fc01eae](https://github.com/hammerjs/hammer.js/commit/fc01eaea678acc430c664eb374555fbe3d403bdd))
- Expose Hammer on window or self if either is defined to avoid issues when AMD is present but not used. ( [356f795](https://github.com/hammerjs/hammer.js/commit/356f7955b01f3679c29d6c45931679256b45036e))
- Add support for PointerEvent instead of MSPointerEvent if supported. ([#754](https://github.com/hammerjs/hammer.js/issues/754), [439c7a6](https://github.com/hammerjs/hammer.js/commit/439c7a6c46978ab387b4b8289399e904d1c49535))
- Fixed moz-prefix, prefix should be Moz not moz. ([3ea47f3](https://github.com/hammerjs/hammer.js/commit/3ea47f3aebadc9d3bb6bf52bc8402cad135ef8a9))
- Removed non-existant recognizer ([f1c2d3b](https://github.com/hammerjs/hammer.js/commit/f1c2d3bf05f530ae092ecfc2335fceeff0e9eec9))
- Fixed config leaking between instances([189098f](https://github.com/hammerjs/hammer.js/commit/189098ff7736f6ed2fce9a3d3e1f5a3afee085ba))
- Fixed gaps in gesture configs and update tests to match ([70c2902](https://github.com/hammerjs/hammer.js/commit/70c2902d773a750e92ce8c423f8a4165c07eab97))
- Fixed Manager off method ([#768](https://github.com/hammerjs/hammer.js/issues/768), [da49a27](https://github.com/hammerjs/hammer.js/commit/da49a2730779ecc3b4dd147cc418a0df7c70fad9))
- Added compatibility with requirejs optimizer namespaces ( [70075f2](https://github.com/hammerjs/hammer.js/commit/70075f2df1b855f7c6d8d3caac49b9276b88c8d6))
- Made touchaction test zoomable ( [50264a7](https://github.com/hammerjs/hammer.js/commit/50264a70251ca88bbaf7b666401e527eee616de5))
- Fixed preventing default when for `pan-x pan-y` case ( [95eaafa](https://github.com/hammerjs/hammer.js/commit/95eaafadad27bd1b25d20cf976811a451922f1c4))
- Fixed incorrect touch action pan direction ( [a81da57](https://github.com/hammerjs/hammer.js/commit/a81da57a82ebf37e695e7c443e4e2715e7f32856))
- Fixed combined pan-x pan-y to resolve to none ( [fdae07b](https://github.com/hammerjs/hammer.js/commit/fdae07bc2ba3c90aad28da6791b3d5df627bc612))
- Fixed inverted touch-action for pan recognizer ([#728](https://github.com/hammerjs/hammer.js/issues/728), [605bd3b](https://github.com/hammerjs/hammer.js/commit/605bd3beca780be91dd43f9da8b809d155a43d1a))
- Fixed dependency on non standard touch list ordering ([#610](https://github.com/hammerjs/hammer.js/issues/610), [#791](https://github.com/hammerjs/hammer.js/issues/791), [287720a](https://github.com/hammerjs/hammer.js/commit/287720a6e5067e7f28be8b8b3b266d22905361c4))
- Fixed swipe to not trigger after multitouch gesture ([#640](https://github.com/hammerjs/hammer.js/issues/640), [711d8a1](https://github.com/hammerjs/hammer.js/commit/711d8a1df1aa5057ecb536454a36257e3c0d6d91))
- Fixed swipe recognizer to use overall gesture direction and velocity ( [963fe69](https://github.com/hammerjs/hammer.js/commit/963fe697515273fee508414bc29e2656465cea55))
- Fixed getDirection returning reversed direction ( [e40dcde](https://github.com/hammerjs/hammer.js/commit/e40dcde43bdac7a74c8ce5c05a4f62121089cd91))
- Fixed detection of tap when multi touch gestures are present ( [c46cbba](https://github.com/hammerjs/hammer.js/commit/c46cbba1c2cbbf874b59913416858d9dae297e64))
- Fixed incorrect event order ([#824](https://github.com/hammerjs/hammer.js/issues/824), [92f2d76](https://github.com/hammerjs/hammer.js/commit/92f2d76188480d967e738a19cd508d0b94a31329))
- Fixed leaking options between recognizer instances ([#813](https://github.com/hammerjs/hammer.js/issues/813), [af32c9b](https://github.com/hammerjs/hammer.js/commit/af32c9bace3f04bb34bee852ff56a33cc8fc27cd))
- Fixed detection when element has no style attribute ( [5ca6d8c](https://github.com/hammerjs/hammer.js/commit/5ca6d8cbead02c71929a8073e95ddf98e11c0e06))
### 2.0.4, 2014-09-28
- Fix IE pointer issue. [#665](https://github.com/hammerjs/hammer.js/pull/665)
- Fix multi-touch at different elements. [#668](https://github.com/hammerjs/hammer.js/pull/668)

View File

@ -1,124 +0,0 @@
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
usebanner:
taskName:
options:
position: 'top'
banner: '
/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n
* <%= pkg.homepage %>\n
*\n
* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;\n
* Licensed under the <%= _.pluck(pkg.licenses, "type").join(", ") %> license */'
linebreak: true
files:
src: ['./hammer.js','./hammer.min.js']
concat:
build:
src: [
'src/hammer.prefix.js'
'src/utils.js'
'src/input.js'
'src/input/*.js'
'src/touchaction.js'
'src/recognizer.js'
'src/recognizers/*.js'
'src/hammer.js'
'src/manager.js'
'src/expose.js'
'src/hammer.suffix.js']
dest: 'hammer.js'
uglify:
min:
options:
report: 'gzip'
sourceMap: 'hammer.min.map'
files:
'hammer.min.js': ['hammer.js']
# special test build that exposes everything so it's testable
test:
options:
wrap: "$H"
comments: 'all'
exportAll: true
mangle: false
beautify: true
compress:
global_defs:
exportName: 'Hammer'
files:
'tests/build.js': [
'src/utils.js'
'src/input.js'
'src/input/*.js'
'src/touchaction.js'
'src/recognizer.js'
'src/recognizers/*.js'
'src/hammer.js'
'src/manager.js'
'src/expose.js']
'string-replace':
version:
files:
'hammer.js': 'hammer.js'
options:
replacements: [
pattern: '{{PKG_VERSION}}'
replacement: '<%= pkg.version %>'
]
jshint:
options:
jshintrc: true
build:
src: ['hammer.js']
jscs:
src: [
'src/**/*.js',
'!src/hammer.prefix.js',
'!src/hammer.suffix.js'
]
options:
config: "./.jscsrc"
force: true
watch:
scripts:
files: ['src/**/*.js']
tasks: ['concat','string-replace','uglify','jshint','jscs']
options:
interrupt: true
connect:
server:
options:
hostname: "0.0.0.0"
port: 8000
qunit:
all: ['tests/unit/index.html']
# Load tasks
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-qunit'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-string-replace'
grunt.loadNpmTasks 'grunt-banner'
grunt.loadNpmTasks 'grunt-jscs'
# Default task(s)
grunt.registerTask 'default', ['connect', 'watch']
grunt.registerTask 'default-test', ['connect', 'uglify:test', 'watch']
grunt.registerTask 'build', ['concat', 'string-replace', 'uglify:min', 'usebanner', 'test']
grunt.registerTask 'test', ['jshint', 'jscs', 'uglify:test', 'qunit']
grunt.registerTask 'test-travis', ['build']

View File

@ -3,6 +3,14 @@
"main": "hammer.js",
"ignore": [
"tests",
"src"
"src",
".bowerrc",
".gitignore",
".jscsrc",
".jshintrc",
".travis.yml",
"component.json",
"Gruntfile.coffee",
"package.json"
]
}

View File

@ -0,0 +1,71 @@
var changelog = require( "changelogplease" );
var gittags = require( "git-tags" ).get( function( error, tags ) {
if ( error ) {
throw error
}
console.log( tags[ 1 ] + ".." + tags[ 0 ] );
var exclude = [ "Merge", "Whitespace", "Fixup", "Cleanup", "Formatting", "Ignore" ];
changelog( {
ticketUrl: "https://github.com/hammerjs/hammer.js/issues/{id}",
commitUrl: "https://github.com/hammerjs/hammerjs/commit/{id}",
sort: false,
repo: "./",
committish: tags[ 1 ] + ".." + tags[ 0 ]
}, function( error, log ) {
if ( error ) {
throw error;
}
log = parseLog( log );
console.log( log );
} );
function parseLog( log ) {
var lines = log.split( "\n" );
var newLog = [];
var log = [];
var currentComponent;
lines.shift();
lines.forEach( function( line ) {
var newLine = parseLine( line );
if ( newLine ) {
log.push( line );
}
} );
var log = log.join( "\n" );
return log.replace( /\*/g, "-" ).replace( /__TICKETREF__,/g, "" );
}
function parseLine( line ) {
var parts = getParts( line );
if ( exclude.indexOf( parts.component ) > -1 ) {
return false;
}
return parts;
}
function getParts( line ) {
var parts = line.split( ":" );
var component = "";
var message;
var commits = line.match( /\{\{([A-Za-z0-9 ]){0,99}\}\}/ )
if ( parts.length > 1 && parts[ 0 ].length <= 20 ) {
component = parts[ 0 ];
parts.shift();
message = parts.join( ":" );
} else {
parts = line.split( " " );
component = parts[ 1 ];
parts.shift();
message = parts.join( " " );
}
if ( component ) {
component = component.replace( /\* |,/, "" );
}
return {
component: component,
message: message
};
}
} );

View File

@ -1,8 +0,0 @@
{
"name": "hammerjs",
"version": "2.0.3",
"main": "hammer.js",
"scripts": [
"hammer.js"
]
}

View File

@ -1,4 +1,4 @@
/*! Hammer.JS - v2.0.4 - 2015-12-22
/*! Hammer.JS - v2.0.6 - 2015-12-23
* http://hammerjs.github.io/
*
* Copyright (c) 2015 Jorik Tangelder;
@ -71,15 +71,69 @@ function each(obj, iterator, context) {
}
}
/**
* wrap a method with a deprecation warning and stack trace
* @param {Function} method
* @param {String} name
* @param {String} message
* @returns {Function} A new function wrapping the supplied method.
*/
function deprecate(method, name, message) {
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
return function() {
var e = new Error('get-stack-trace');
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
var log = window.console && (window.console.warn || window.console.log);
if (log) {
log.call(window.console, deprecationMessage, stack);
}
return method.apply(this, arguments);
};
}
/**
* extend object.
* means that properties in dest will be overwritten by the ones in src.
* @param {Object} target
* @param {...Object} objects_to_assign
* @returns {Object} target
*/
var assign;
if (typeof Object.assign !== 'function') {
assign = function assign(target) {
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
} else {
assign = Object.assign;
}
/**
* extend object.
* means that properties in dest will be overwritten by the ones in src.
* @param {Object} dest
* @param {Object} src
* @param {Boolean} [merge]
* @param {Boolean=false} [merge]
* @returns {Object} dest
*/
function extend(dest, src, merge) {
var extend = deprecate(function extend(dest, src, merge) {
var keys = Object.keys(src);
var i = 0;
while (i < keys.length) {
@ -89,7 +143,7 @@ function extend(dest, src, merge) {
i++;
}
return dest;
}
}, 'extend', 'Use `assign`.');
/**
* merge the values from src in the dest.
@ -98,9 +152,9 @@ function extend(dest, src, merge) {
* @param {Object} src
* @returns {Object} dest
*/
function merge(dest, src) {
var merge = deprecate(function merge(dest, src) {
return extend(dest, src, true);
}
}, 'merge', 'Use `assign`.');
/**
* simple class inheritance
@ -117,7 +171,7 @@ function inherit(child, base, properties) {
childP._super = baseP;
if (properties) {
extend(childP, properties);
assign(childP, properties);
}
}
@ -1284,13 +1338,11 @@ var STATE_FAILED = 32;
* @param {Object} options
*/
function Recognizer(options) {
// make sure, options are copied over to a new object to prevent leaking it outside
options = extend({}, options || {});
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
this.options = merge(options, this.defaults);
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
@ -1314,7 +1366,7 @@ Recognizer.prototype = {
* @return {Recognizer}
*/
set: function(options) {
extend(this.options, options);
assign(this.options, options);
// also update the touchAction, in case something changed about the directions/enabled state
this.manager && this.manager.touchAction.update();
@ -1475,7 +1527,7 @@ Recognizer.prototype = {
recognize: function(inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = extend({}, inputData);
var inputDataClone = assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
@ -2040,7 +2092,7 @@ function Hammer(element, options) {
/**
* @const {string}
*/
Hammer.VERSION = '2.0.4';
Hammer.VERSION = '2.0.6';
/**
* default settings
@ -2164,8 +2216,7 @@ var FORCED_STOP = 2;
* @constructor
*/
function Manager(element, options) {
var newOptions = options ? extend({}, options) : {};
this.options = merge(newOptions, Hammer.defaults);
this.options = assign({}, Hammer.defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
@ -2193,7 +2244,7 @@ Manager.prototype = {
* @returns {Manager}
*/
set: function(options) {
extend(this.options, options);
assign(this.options, options);
// Options that need a little more setup
if (options.touchAction) {
@ -2446,7 +2497,7 @@ function triggerDomEvent(event, data) {
data.target.dispatchEvent(gestureEvent);
}
extend(Hammer, {
assign(Hammer, {
INPUT_START: INPUT_START,
INPUT_MOVE: INPUT_MOVE,
INPUT_END: INPUT_END,
@ -2493,6 +2544,7 @@ extend(Hammer, {
each: each,
merge: merge,
extend: extend,
assign: assign,
inherit: inherit,
bindFn: bindFn,
prefixed: prefixed

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,45 +0,0 @@
{
"name": "hammerjs",
"title": "Hammer.JS",
"description": "A javascript library for multi-touch gestures",
"version": "2.0.5",
"homepage": "http://hammerjs.github.io/",
"license": "MIT",
"keywords": [
"touch",
"gestures"
],
"author": {
"name": "Jorik Tangelder",
"email": "j.tangelder@gmail.com"
},
"repository": {
"type": "git",
"url": "git://github.com/hammerjs/hammer.js.git"
},
"bugs": {
"url": "https://github.com/hammerjs/hammer.js/issues"
},
"dependencies": {},
"devDependencies": {
"grunt": "0.4.x",
"grunt-banner": "^0.2.3",
"grunt-contrib-concat": "0.4.x",
"grunt-contrib-connect": "0.7.x",
"grunt-contrib-jshint": "0.10.x",
"grunt-contrib-qunit": "^0.5.1",
"grunt-contrib-uglify": "0.4.x",
"grunt-contrib-watch": "0.6.x",
"grunt-jscs": "^0.8.0",
"grunt-string-replace": "^0.2.7",
"jquery-hammerjs": "2.0.x",
"hammer-simulator": "git://github.com/hammerjs/simulator#master"
},
"main": "hammer.js",
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}

View File

@ -36,7 +36,7 @@
"tag": "v1.0.8",
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_source": "git://github.com/polymerelements/iron-selector.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-selector"
"_originalSource": "polymerelements/iron-selector"
}

View File

@ -892,11 +892,10 @@
showSelections(card);
if (s.stopPropagation) {
if (e.stopPropagation) {
e.stopPropagation();
}
e.preventDefault();
e.stopPropagation();
return false;
}
e.preventDefault();
@ -949,19 +948,17 @@
if (!itemSelectionPanel) {
require(['paper-checkbox'], function () {
itemSelectionPanel = document.createElement('div');
itemSelectionPanel.classList.add('itemSelectionPanel');
itemSelectionPanel = document.createElement('div');
itemSelectionPanel.classList.add('itemSelectionPanel');
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
var chkItemSelect = document.createElement('paper-checkbox');
chkItemSelect.classList.add('chkItemSelect');
var chkItemSelect = document.createElement('paper-checkbox');
chkItemSelect.classList.add('chkItemSelect');
$(chkItemSelect).on('change', onSelectionChange);
$(chkItemSelect).on('change', onSelectionChange);
itemSelectionPanel.appendChild(chkItemSelect);
});
itemSelectionPanel.appendChild(chkItemSelect);
}
}
@ -1018,14 +1015,16 @@
function showSelections(initialCard) {
var cards = document.querySelectorAll('.card');
for (var i = 0, length = cards.length; i < length; i++) {
showSelection(cards[i]);
}
require(['paper-checkbox'], function() {
var cards = document.querySelectorAll('.card');
for (var i = 0, length = cards.length; i < length; i++) {
showSelection(cards[i]);
}
showSelectionCommands();
initialCard.querySelector('.chkItemSelect').checked = true;
updateItemSelection(initialCard, true);
showSelectionCommands();
initialCard.querySelector('.chkItemSelect').checked = true;
updateItemSelection(initialCard, true);
});
}
function hideSelections() {