Browse Source

Upgraded hammer.js to v1.1.3

v3_develop
jos 10 years ago
parent
commit
27bc2fb8a6
12 changed files with 4675 additions and 3916 deletions
  1. +1
    -1
      README.md
  2. +92
    -84
      dist/vis-light.js
  3. +1
    -1
      dist/vis-light.map
  4. +11
    -11
      dist/vis-light.min.js
  5. +4521
    -3772
      dist/vis.js
  6. +1
    -1
      dist/vis.map
  7. +14
    -14
      dist/vis.min.js
  8. +28
    -0
      lib/hammerUtil.js
  9. +3
    -2
      lib/network/Network.js
  10. +2
    -1
      lib/timeline/Range.js
  11. +0
    -28
      lib/util.js
  12. +1
    -1
      package.json

+ 1
- 1
README.md View File

@ -80,7 +80,7 @@ component.
The folder `dist` contains bundled versions of vis.js for direct use in the browser. In general, to use vis, load the files `vis.js` and `vis.css`. The folder `dist` contains bundled versions of vis.js for direct use in the browser. In general, to use vis, load the files `vis.js` and `vis.css`.
vis.js offers various bundled files: default or light version, and minified or non-minified. The source code of vis.js consists of commonjs modules, which makes it possible to create custom bundles using tools like [Browserify](http://browserify.org/) or [Webpack](http://webpack.github.io/). This can be bundling just one visualization like the Timeline, or bundling vis.js as part of your own browserified web application.
vis.js offers various bundled files: default or light version, and minified or non-minified. The source code of vis.js consists of commonjs modules, which makes it possible to create custom bundles using tools like [Browserify](http://browserify.org/) or [Webpack](http://webpack.github.io/). This can be bundling just one visualization like the Timeline, or bundling vis.js as part of your own browserified web application. Note that hammer.js v1.0.6 or newer is required.
Bundle | Files | Description Bundle | Files | Description
------ | ----- | ----------- ------ | ----- | -----------

+ 92
- 84
dist/vis-light.js View File

@ -32,7 +32,7 @@
exports["vis"] = factory(require("hammerjs"), require("moment")); exports["vis"] = factory(require("hammerjs"), require("moment"));
else else
root["vis"] = factory(root["hammerjs"], root["moment"]); root["vis"] = factory(root["hammerjs"], root["moment"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_43__, __WEBPACK_EXTERNAL_MODULE_44__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_44__, __WEBPACK_EXTERNAL_MODULE_45__) {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var installedModules = {};
@ -153,7 +153,6 @@ return /******/ (function(modules) { // webpackBootstrap
// first check if moment.js is already loaded in the browser window, if so, // first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs. // use this instance. Else, load via commonjs.
var Hammer = __webpack_require__(40);
var moment = __webpack_require__(41); var moment = __webpack_require__(41);
/** /**
@ -760,33 +759,6 @@ return /******/ (function(modules) { // webpackBootstrap
return target; return target;
}; };
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
exports.fakeGesture = function(element, event) {
var eventType = null;
// for hammer.js 1.0.5
var gesture = Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6
//var touches = Hammer.event.getTouchList(event, eventType);
// var gesture = Hammer.event.collectEventData(this, eventType, touches, event);
// on IE in standards mode, no touches are recognized by hammer.js,
// resulting in NaN values for center.pageX and center.pageY
if (isNaN(gesture.center.pageX)) {
gesture.center.pageX = event.pageX;
}
if (isNaN(gesture.center.pageY)) {
gesture.center.pageY = event.pageY;
}
return gesture;
};
exports.option = {}; exports.option = {};
/** /**
@ -2796,7 +2768,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 5 */ /* 5 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Emitter = __webpack_require__(45);
var Emitter = __webpack_require__(46);
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
var util = __webpack_require__(1); var util = __webpack_require__(1);
@ -6040,8 +6012,8 @@ return /******/ (function(modules) { // webpackBootstrap
/* 12 */ /* 12 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Emitter = __webpack_require__(45);
var Hammer = __webpack_require__(40);
var Emitter = __webpack_require__(46);
var Hammer = __webpack_require__(42);
var util = __webpack_require__(1); var util = __webpack_require__(1);
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
@ -6955,8 +6927,8 @@ return /******/ (function(modules) { // webpackBootstrap
/* 13 */ /* 13 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Emitter = __webpack_require__(45);
var Hammer = __webpack_require__(40);
var Emitter = __webpack_require__(46);
var Hammer = __webpack_require__(42);
var util = __webpack_require__(1); var util = __webpack_require__(1);
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
@ -8072,6 +8044,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
var hammerUtil = __webpack_require__(39);
var moment = __webpack_require__(41); var moment = __webpack_require__(41);
var Component = __webpack_require__(18); var Component = __webpack_require__(18);
@ -8447,7 +8420,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
// calculate center, the date to zoom around // calculate center, the date to zoom around
var gesture = util.fakeGesture(this, event),
var gesture = hammerUtil.fakeGesture(this, event),
pointer = getPointer(gesture.center, this.body.dom.center), pointer = getPointer(gesture.center, this.body.dom.center),
pointerDate = this._pointerToDate(pointer); pointerDate = this._pointerToDate(pointer);
@ -9398,7 +9371,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 20 */ /* 20 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Hammer = __webpack_require__(40);
var Hammer = __webpack_require__(42);
var util = __webpack_require__(1); var util = __webpack_require__(1);
var Component = __webpack_require__(18); var Component = __webpack_require__(18);
@ -10630,7 +10603,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 24 */ /* 24 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Hammer = __webpack_require__(40);
var Hammer = __webpack_require__(42);
var util = __webpack_require__(1); var util = __webpack_require__(1);
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
@ -13685,7 +13658,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 28 */ /* 28 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Hammer = __webpack_require__(40);
var Hammer = __webpack_require__(42);
/** /**
* @constructor Item * @constructor Item
@ -14286,7 +14259,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 31 */ /* 31 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Hammer = __webpack_require__(40);
var Hammer = __webpack_require__(42);
var Item = __webpack_require__(28); var Item = __webpack_require__(28);
/** /**
@ -14583,10 +14556,11 @@ return /******/ (function(modules) { // webpackBootstrap
/* 32 */ /* 32 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Emitter = __webpack_require__(45);
var Hammer = __webpack_require__(40);
var mousetrap = __webpack_require__(46);
var Emitter = __webpack_require__(46);
var Hammer = __webpack_require__(42);
var mousetrap = __webpack_require__(47);
var util = __webpack_require__(1); var util = __webpack_require__(1);
var hammerUtil = __webpack_require__(39);
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
var dotparser = __webpack_require__(38); var dotparser = __webpack_require__(38);
@ -14595,10 +14569,10 @@ return /******/ (function(modules) { // webpackBootstrap
var Node = __webpack_require__(36); var Node = __webpack_require__(36);
var Edge = __webpack_require__(33); var Edge = __webpack_require__(33);
var Popup = __webpack_require__(37); var Popup = __webpack_require__(37);
var MixinLoader = __webpack_require__(42);
var MixinLoader = __webpack_require__(43);
// Load custom shapes into CanvasRenderingContext2D // Load custom shapes into CanvasRenderingContext2D
__webpack_require__(39);
__webpack_require__(40);
/** /**
* @constructor Network * @constructor Network
@ -15809,7 +15783,7 @@ return /******/ (function(modules) { // webpackBootstrap
scale *= (1 + zoom); scale *= (1 + zoom);
// calculate the pointer location // calculate the pointer location
var gesture = util.fakeGesture(this, event);
var gesture = hammerUtil.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center); var pointer = this._getPointer(gesture.center);
// apply the new scale // apply the new scale
@ -15827,7 +15801,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @private * @private
*/ */
Network.prototype._onMouseMoveTitle = function (event) { Network.prototype._onMouseMoveTitle = function (event) {
var gesture = util.fakeGesture(this, event);
var gesture = hammerUtil.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center); var pointer = this._getPointer(gesture.center);
// check if the previously selected node is still selected // check if the previously selected node is still selected
@ -20265,6 +20239,40 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 39 */ /* 39 */
/***/ function(module, exports, __webpack_require__) {
var Hammer = __webpack_require__(42);
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
exports.fakeGesture = function(element, event) {
var eventType = null;
// for hammer.js 1.0.5
// var gesture = Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6+
var touches = Hammer.event.getTouchList(event, eventType);
var gesture = Hammer.event.collectEventData(this, eventType, touches, event);
// on IE in standards mode, no touches are recognized by hammer.js,
// resulting in NaN values for center.pageX and center.pageY
if (isNaN(gesture.center.pageX)) {
gesture.center.pageX = event.pageX;
}
if (isNaN(gesture.center.pageY)) {
gesture.center.pageY = event.pageY;
}
return gesture;
};
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -20495,13 +20503,22 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 40 */
/* 41 */
/***/ function(module, exports, __webpack_require__) {
// first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs.
module.exports = (typeof window !== 'undefined') && window['moment'] || __webpack_require__(45);
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
// Only load hammer.js when in a browser environment // Only load hammer.js when in a browser environment
// (loading hammer.js in a node.js environment gives errors) // (loading hammer.js in a node.js environment gives errors)
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
module.exports = window['Hammer'] || __webpack_require__(43);
module.exports = window['Hammer'] || __webpack_require__(44);
} }
else { else {
module.exports = function () { module.exports = function () {
@ -20511,25 +20528,16 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
// first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs.
module.exports = (typeof window !== 'undefined') && window['moment'] || __webpack_require__(44);
/***/ },
/* 42 */
/* 43 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var PhysicsMixin = __webpack_require__(53);
var ClusterMixin = __webpack_require__(47);
var SectorsMixin = __webpack_require__(48);
var SelectionMixin = __webpack_require__(49);
var ManipulationMixin = __webpack_require__(50);
var NavigationMixin = __webpack_require__(51);
var HierarchicalLayoutMixin = __webpack_require__(52);
var PhysicsMixin = __webpack_require__(54);
var ClusterMixin = __webpack_require__(48);
var SectorsMixin = __webpack_require__(49);
var SelectionMixin = __webpack_require__(50);
var ManipulationMixin = __webpack_require__(51);
var NavigationMixin = __webpack_require__(52);
var HierarchicalLayoutMixin = __webpack_require__(53);
/** /**
* Load a mixin into the network object * Load a mixin into the network object
@ -20724,19 +20732,19 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 43 */
/* 44 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE_43__;
module.exports = __WEBPACK_EXTERNAL_MODULE_44__;
/***/ }, /***/ },
/* 44 */
/* 45 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE_44__;
module.exports = __WEBPACK_EXTERNAL_MODULE_45__;
/***/ }, /***/ },
/* 45 */
/* 46 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
@ -20906,7 +20914,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 46 */
/* 47 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -21711,7 +21719,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 47 */
/* 48 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -22854,7 +22862,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 48 */
/* 49 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
@ -23408,7 +23416,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 49 */
/* 50 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Node = __webpack_require__(36); var Node = __webpack_require__(36);
@ -24119,7 +24127,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 50 */
/* 51 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
@ -24701,7 +24709,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 51 */
/* 52 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
@ -24888,7 +24896,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 52 */
/* 53 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
exports._resetLevels = function() { exports._resetLevels = function() {
@ -25216,13 +25224,13 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 53 */
/* 54 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
var RepulsionMixin = __webpack_require__(54);
var HierarchialRepulsionMixin = __webpack_require__(55);
var BarnesHutMixin = __webpack_require__(56);
var RepulsionMixin = __webpack_require__(55);
var HierarchialRepulsionMixin = __webpack_require__(56);
var BarnesHutMixin = __webpack_require__(57);
/** /**
* Toggling barnes Hut calculation on and off. * Toggling barnes Hut calculation on and off.
@ -25930,7 +25938,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 54 */
/* 55 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -25994,7 +26002,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 55 */
/* 56 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -26153,7 +26161,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
/***/ }, /***/ },
/* 56 */
/* 57 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**

+ 1
- 1
dist/vis-light.map
File diff suppressed because it is too large
View File


+ 11
- 11
dist/vis-light.min.js
File diff suppressed because it is too large
View File


+ 4521
- 3772
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 14
- 14
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 28
- 0
lib/hammerUtil.js View File

@ -0,0 +1,28 @@
var Hammer = require('./module/hammer');
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
exports.fakeGesture = function(element, event) {
var eventType = null;
// for hammer.js 1.0.5
// var gesture = Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6+
var touches = Hammer.event.getTouchList(event, eventType);
var gesture = Hammer.event.collectEventData(this, eventType, touches, event);
// on IE in standards mode, no touches are recognized by hammer.js,
// resulting in NaN values for center.pageX and center.pageY
if (isNaN(gesture.center.pageX)) {
gesture.center.pageX = event.pageX;
}
if (isNaN(gesture.center.pageY)) {
gesture.center.pageY = event.pageY;
}
return gesture;
};

+ 3
- 2
lib/network/Network.js View File

@ -2,6 +2,7 @@ var Emitter = require('emitter-component');
var Hammer = require('../module/hammer'); var Hammer = require('../module/hammer');
var mousetrap = require('mousetrap'); var mousetrap = require('mousetrap');
var util = require('../util'); var util = require('../util');
var hammerUtil = require('../hammerUtil');
var DataSet = require('../DataSet'); var DataSet = require('../DataSet');
var DataView = require('../DataView'); var DataView = require('../DataView');
var dotparser = require('./dotparser'); var dotparser = require('./dotparser');
@ -1224,7 +1225,7 @@ Network.prototype._onMouseWheel = function(event) {
scale *= (1 + zoom); scale *= (1 + zoom);
// calculate the pointer location // calculate the pointer location
var gesture = util.fakeGesture(this, event);
var gesture = hammerUtil.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center); var pointer = this._getPointer(gesture.center);
// apply the new scale // apply the new scale
@ -1242,7 +1243,7 @@ Network.prototype._onMouseWheel = function(event) {
* @private * @private
*/ */
Network.prototype._onMouseMoveTitle = function (event) { Network.prototype._onMouseMoveTitle = function (event) {
var gesture = util.fakeGesture(this, event);
var gesture = hammerUtil.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center); var pointer = this._getPointer(gesture.center);
// check if the previously selected node is still selected // check if the previously selected node is still selected

+ 2
- 1
lib/timeline/Range.js View File

@ -1,4 +1,5 @@
var util = require('../util'); var util = require('../util');
var hammerUtil = require('../hammerUtil');
var moment = require('../module/moment'); var moment = require('../module/moment');
var Component = require('./component/Component'); var Component = require('./component/Component');
@ -374,7 +375,7 @@ Range.prototype._onMouseWheel = function(event) {
} }
// calculate center, the date to zoom around // calculate center, the date to zoom around
var gesture = util.fakeGesture(this, event),
var gesture = hammerUtil.fakeGesture(this, event),
pointer = getPointer(gesture.center, this.body.dom.center), pointer = getPointer(gesture.center, this.body.dom.center),
pointerDate = this._pointerToDate(pointer); pointerDate = this._pointerToDate(pointer);

+ 0
- 28
lib/util.js View File

@ -2,7 +2,6 @@
// first check if moment.js is already loaded in the browser window, if so, // first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs. // use this instance. Else, load via commonjs.
var Hammer = require('./module/hammer');
var moment = require('./module/moment'); var moment = require('./module/moment');
/** /**
@ -609,33 +608,6 @@ exports.getTarget = function(event) {
return target; return target;
}; };
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
exports.fakeGesture = function(element, event) {
var eventType = null;
// for hammer.js 1.0.5
var gesture = Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6
//var touches = Hammer.event.getTouchList(event, eventType);
// var gesture = Hammer.event.collectEventData(this, eventType, touches, event);
// on IE in standards mode, no touches are recognized by hammer.js,
// resulting in NaN values for center.pageX and center.pageY
if (isNaN(gesture.center.pageX)) {
gesture.center.pageX = event.pageX;
}
if (isNaN(gesture.center.pageY)) {
gesture.center.pageY = event.pageY;
}
return gesture;
};
exports.option = {}; exports.option = {};
/** /**

+ 1
- 1
package.json View File

@ -29,7 +29,7 @@
}, },
"dependencies": { "dependencies": {
"emitter-component": "^1.1.1", "emitter-component": "^1.1.1",
"hammerjs": "1.0.5",
"hammerjs": "^1.1.0",
"moment": "^2.7.0", "moment": "^2.7.0",
"mousetrap": "0.0.1" "mousetrap": "0.0.1"
}, },

Loading…
Cancel
Save