cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

scroll too fast - trackpad #969

Open ghost opened 9 years ago

ghost commented 9 years ago

I try with mouseWheelSpeed:10,5,0.5,0.001 but the scroll is very very fast, trackpad of MacBook Pro, is a is it my mistake?

myScroll = new IScroll('#wrapper', {
    scrollX: true,
    scrollY: true,
    momentum: false,
    mouseWheel: true,
    mouseWheelSpeed:0.01,
    freeScroll:false,
    snap: '.page'
});
myScroll.on('beforeScrollStart', function(e) {
    console.log('beforeScrollStart'); // scrollEnd event firing twice
});
myScroll.on('scrollStart', function(e) {
    console.log('Start'); // scrollEnd event firing twice
});
myScroll.on('scrollEnd', function(e) {
    console.log('End'); // scrollEnd event firing twice
});
kaansoral commented 9 years ago

I just tested myself, it felt just right, yet my iScroll speed dynamics are all manually edited, you might also benefit from such manual modifications, I don't recall which methods I edited, but the code is pretty readable

speed/acceleration can all be fine-tuned manually

jkiss commented 9 years ago

It's really necessary to enable mousewheel on OS?

ghost commented 9 years ago

can you give me more info? ps. no I can't remove mousewheel on ON

commonpike commented 8 years ago

try it without the snap to see if your problem is really the speed. on iscroll 5.1.3, macbookpro, using snap, iscroll either jumps to the first page or to the last page. there is no way to get in the middle.

the problem is not the speed, the trackpad scroll events just keep popping (a simple flick spawns ~30 events) and on each event, the pageY is decremented. this happens around line 1100.

I would say thats a bug, but not sure how it was intended to work.

commonpike commented 8 years ago

See this as a test for a fix. works for me. https://github.com/commonpike/iscroll/commit/1bc9c5c55e54e776f1d78de86998cb7d38f8eed4

commonpike commented 8 years ago

actually, above patch triggers onScrollEnd twice. To prevent that, also wrap this.wheelTimeout = setTimeout.. in an if (!this.blockMomentum) { }, and add that.momentumTimer = undefined; to this.momentumTimer = setTimeout(function () { ...

see https://github.com/cubiq/iscroll/compare/master...commonpike:commonpike-patch-1