Browse Source

Switched back to hammer.js 1.0.5 due to issues with 1.0.6

css_transitions
josdejong 10 years ago
parent
commit
f678e076b1
4 changed files with 19 additions and 4 deletions
  1. +1
    -1
      package.json
  2. +2
    -2
      src/graph/Graph.js
  3. +1
    -1
      src/timeline/Range.js
  4. +15
    -0
      src/util.js

+ 1
- 1
package.json View File

@ -29,6 +29,6 @@
"jake-utils": "latest",
"browserify": "latest",
"moment": "latest",
"hammerjs": "latest"
"hammerjs": "1.0.5"
}
}

+ 2
- 2
src/graph/Graph.js View File

@ -603,7 +603,7 @@ Graph.prototype._onMouseWheel = function(event) {
scale *= (1 + zoom);
// calculate the pointer location
var gesture = Hammer.event.collectEventData(this, 'scroll', event);
var gesture = util.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center);
// apply the new scale
@ -624,7 +624,7 @@ Graph.prototype._onMouseWheel = function(event) {
* @private
*/
Graph.prototype._onMouseMoveTitle = function (event) {
var gesture = Hammer.event.collectEventData(this, 'mousemove', event);
var gesture = util.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center);
// check if the previously selected node is still selected

+ 1
- 1
src/timeline/Range.js View File

@ -389,7 +389,7 @@ Range.prototype._onMouseWheel = function(event, component, direction) {
}
// calculate center, the date to zoom around
var gesture = Hammer.event.collectEventData(this, 'scroll', event),
var gesture = util.fakeGesture(this, event),
pointer = getPointer(gesture.touches[0], component.frame),
pointerDate = this._pointerToDate(component, direction, pointer);

+ 15
- 0
src/util.js View File

@ -548,6 +548,21 @@ util.stopPropagation = function stopPropagation(event) {
}
};
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
util.fakeGesture = function fakeGesture (element, event) {
var eventType = null;
// for hammer.js 1.0.5
return Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6
//var touches = Hammer.event.getTouchList(event, eventType);
//return Hammer.event.collectEventData(this, eventType, touches, event);
};
/**
* Cancels the event if it is cancelable, without stopping further propagation of the event.

Loading…
Cancel
Save