Always round x and y coordinates when using mousewheel #488

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@adambom
adambom commented Sep 25, 2013

This addresses all of the blurriness on scroll issues, e.g. #197

Up until now, the best solution I could find to this problem was to disable 3d transforms using the useTransform option. This forced the _translate method to round the coordinates. However, this came at the cost of moving the translation off of the HW. The resulting performance is horrendous on mobile devices.

By always rounding coordinates, we nullify the blurring problem without the performance hit of software animation.

@cubiq
Owner
cubiq commented Sep 25, 2013

this slightly impacts on performance. I'd prefer to avoid it. Anyway all "end" positions are already rounded, when do you get the blurring?

@adambom
adambom commented Sep 25, 2013

On mousewheel

@adambom
adambom commented Sep 25, 2013

And Math.round is a native code method, jsperf is showing over 27 Million ops per second for 2 rounding operations. The performance hit should be negligible, esp. compared to the performance gained by using HW accelleration.

@cubiq
Owner
cubiq commented Sep 25, 2013

on Mac?

@adambom
adambom commented Sep 25, 2013

Mac/Chrome 2.4 GHz Core i7 8 GB 1600 MGz DDR3

@cubiq
Owner
cubiq commented Sep 25, 2013

this is all about performance. 1 cpu cycle spared is a cpu cycle gained. I'd suggest adding the rounding on mousewheel only. I guess that happens on touchpads.

@adambom
adambom commented Sep 25, 2013

Fair enough.

@adambom
adambom commented Sep 25, 2013

Ok, now we're rounding in _wheel only rather than in _translate

@cubiq
Owner
cubiq commented Sep 25, 2013

great thanks!

@ullmark
ullmark commented Oct 3, 2013

👍

@adambom
adambom commented Oct 22, 2013

Is this good to merge? Would love to grab the latest code for my application.

@cubiq
Owner
cubiq commented Oct 29, 2013

a variant of this will be included in the next commit. thank you very much for your support!

@cubiq cubiq closed this Oct 29, 2013
@cubiq cubiq added a commit that referenced this pull request Oct 29, 2013
@cubiq fix #439 #488 #517 #428 #270 #520 #447 #452 #509 052c5ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment