mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Fix touch events.
This commit is contained in:
parent
bce2c80fde
commit
2df090ee48
@ -59,8 +59,7 @@ class Morris.Grid extends Morris.EventEmitter
|
||||
@el.bind 'touchstart touchmove touchend', (evt) =>
|
||||
touch = evt.originalEvent.touches[0] or evt.originalEvent.changedTouches[0]
|
||||
offset = @el.offset()
|
||||
@fire 'hover', touch.pageX - offset.left, touch.pageY - offset.top
|
||||
touch
|
||||
@fire 'hovermove', touch.pageX - offset.left, touch.pageY - offset.top
|
||||
|
||||
@el.bind 'click', (evt) =>
|
||||
offset = @el.offset()
|
||||
@ -87,6 +86,9 @@ class Morris.Grid extends Morris.EventEmitter
|
||||
window.clearTimeout @timeoutId
|
||||
@timeoutId = window.setTimeout @resizeHandler, 100
|
||||
|
||||
# Disable tap highlight on iOS.
|
||||
@el.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)')
|
||||
|
||||
@postInit() if @postInit
|
||||
|
||||
# Default options
|
||||
|
@ -127,8 +127,7 @@ Licensed under the BSD-2-Clause License.
|
||||
var offset, touch;
|
||||
touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
|
||||
offset = _this.el.offset();
|
||||
_this.fire('hover', touch.pageX - offset.left, touch.pageY - offset.top);
|
||||
return touch;
|
||||
return _this.fire('hovermove', touch.pageX - offset.left, touch.pageY - offset.top);
|
||||
});
|
||||
this.el.bind('click', function(evt) {
|
||||
var offset;
|
||||
@ -160,6 +159,7 @@ Licensed under the BSD-2-Clause License.
|
||||
return _this.timeoutId = window.setTimeout(_this.resizeHandler, 100);
|
||||
});
|
||||
}
|
||||
this.el.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
|
||||
if (this.postInit) {
|
||||
this.postInit();
|
||||
}
|
||||
|
2
morris.min.js
vendored
2
morris.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user